generated from hashicorp/terraform-provider-scaffolding
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: [PL-38510]: added resource for api tokens (#556)
* [PL-38510]: added resource for api tokens
- Loading branch information
Showing
13 changed files
with
1,274 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```release-note:new-resource | ||
platform_token - Added apikey token in Harness terraform provider | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "harness_platform_token Data Source - terraform-provider-harness" | ||
subcategory: "Next Gen" | ||
description: |- | ||
Data source for retrieving a Harness ApiKey Token. | ||
--- | ||
|
||
# harness_platform_token (Data Source) | ||
|
||
Data source for retrieving a Harness ApiKey Token. | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
data "harness_platform_token" "test" { | ||
identifier = "test_token" | ||
parent_id = "apikey_parent_id" | ||
org_id = "org_id" | ||
project_id = "project_id" | ||
apikey_id = "apikey_id" | ||
apikey_type = "USER" | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `account_id` (String) Account Identifier for the Entity | ||
- `apikey_id` (String) Identifier of the API Key | ||
- `apikey_type` (String) Type of the API Key | ||
- `identifier` (String) Identifier of the Token | ||
- `name` (String) Name of the Token | ||
- `parent_id` (String) Parent Entity Identifier of the API Key | ||
|
||
### Optional | ||
|
||
- `description` (String) Description of the Token | ||
- `email` (String) Email Id of the user who created the Token | ||
- `encoded_password` (String) Encoded password of the Token | ||
- `org_id` (String) Organization Identifier for the Entity | ||
- `project_id` (String) Project Identifier for the Entity | ||
- `scheduled_expire_time` (Number) Scheduled expiry time in milliseconds | ||
- `tags` (Map of String) Tags for the Token | ||
- `username` (String) Name of the user who created the Token | ||
- `valid` (Boolean) Boolean value to indicate if Token is valid or not. | ||
- `valid_from` (Number) This is the time from which the Token is valid. The time is in milliseconds | ||
- `valid_to` (Number) This is the time till which the Token is valid. The time is in milliseconds | ||
|
||
### Read-Only | ||
|
||
- `id` (String) The ID of this resource. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "harness_platform_token Resource - terraform-provider-harness" | ||
subcategory: "Next Gen" | ||
description: |- | ||
Resource for creating tokens. | ||
--- | ||
|
||
# harness_platform_token (Resource) | ||
|
||
Resource for creating tokens. | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
# Create token for account level apikey | ||
resource "harness_platform_token" "test" { | ||
identifier = "test_token" | ||
name = "test token" | ||
parent_id = "apikey_parent_id" | ||
account_id = "account_id" | ||
apikey_type = "USER" | ||
apikey_id = "apikey_id" | ||
} | ||
# Create token for org level apikey | ||
resource "harness_platform_token" "test" { | ||
identifier = "test_token" | ||
name = "test token" | ||
parent_id = "apikey_parent_id" | ||
account_id = "account_id" | ||
org_id = "org_id" | ||
apikey_type = "USER" | ||
apikey_id = "apikey_id" | ||
} | ||
# Create token for project level apikey | ||
resource "harness_platform_token" "test" { | ||
identifier = "test_token" | ||
name = "test token" | ||
parent_id = "apikey_parent_id" | ||
account_id = "account_id" | ||
org_id = "org_id" | ||
project_id = "project_id" | ||
apikey_type = "USER" | ||
apikey_id = "apikey_id" | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `account_id` (String) Account Identifier for the Entity | ||
- `apikey_id` (String) Identifier of the API Key | ||
- `apikey_type` (String) Type of the API Key | ||
- `identifier` (String) Identifier of the Token | ||
- `name` (String) Name of the Token | ||
- `parent_id` (String) Parent Entity Identifier of the API Key | ||
|
||
### Optional | ||
|
||
- `description` (String) Description of the Token | ||
- `email` (String) Email Id of the user who created the Token | ||
- `encoded_password` (String) Encoded password of the Token | ||
- `org_id` (String) Organization Identifier for the Entity | ||
- `project_id` (String) Project Identifier for the Entity | ||
- `scheduled_expire_time` (Number) Scheduled expiry time in milliseconds | ||
- `tags` (Map of String) Tags for the Token | ||
- `username` (String) Name of the user who created the Token | ||
- `valid` (Boolean) Boolean value to indicate if Token is valid or not. | ||
- `valid_from` (Number) This is the time from which the Token is valid. The time is in milliseconds | ||
- `valid_to` (Number) This is the time till which the Token is valid. The time is in milliseconds | ||
|
||
### Read-Only | ||
|
||
- `id` (String) The ID of this resource. | ||
|
||
## Import | ||
|
||
Import is supported using the following syntax: | ||
|
||
```shell | ||
# Import account level token | ||
terraform import harness_platform_token <parent_id>/<apikey_id>/<apikey_type>/<token_id> | ||
|
||
# Import org level token | ||
terraform import harness_platform_token <org_id>/<parent_id>/<apikey_id>/<apikey_type>/<token_id> | ||
|
||
# Import project level token | ||
terraform import harness_platform_token <org_id>/<project_id>/<parent_id>/<apikey_id>/<apikey_type>/<token_id> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
data "harness_platform_token" "test" { | ||
identifier = "test_token" | ||
parent_id = "apikey_parent_id" | ||
org_id = "org_id" | ||
project_id = "project_id" | ||
apikey_id = "apikey_id" | ||
apikey_type = "USER" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Import account level token | ||
terraform import harness_platform_token <parent_id>/<apikey_id>/<apikey_type>/<token_id> | ||
|
||
# Import org level token | ||
terraform import harness_platform_token <org_id>/<parent_id>/<apikey_id>/<apikey_type>/<token_id> | ||
|
||
# Import project level token | ||
terraform import harness_platform_token <org_id>/<project_id>/<parent_id>/<apikey_id>/<apikey_type>/<token_id> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Create token for account level apikey | ||
resource "harness_platform_token" "test" { | ||
identifier = "test_token" | ||
name = "test token" | ||
parent_id = "apikey_parent_id" | ||
account_id = "account_id" | ||
apikey_type = "USER" | ||
apikey_id = "apikey_id" | ||
} | ||
|
||
# Create token for org level apikey | ||
resource "harness_platform_token" "test" { | ||
identifier = "test_token" | ||
name = "test token" | ||
parent_id = "apikey_parent_id" | ||
account_id = "account_id" | ||
org_id = "org_id" | ||
apikey_type = "USER" | ||
apikey_id = "apikey_id" | ||
} | ||
|
||
# Create token for project level apikey | ||
resource "harness_platform_token" "test" { | ||
identifier = "test_token" | ||
name = "test token" | ||
parent_id = "apikey_parent_id" | ||
account_id = "account_id" | ||
org_id = "org_id" | ||
project_id = "project_id" | ||
apikey_type = "USER" | ||
apikey_id = "apikey_id" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.