diff --git a/docs/data-sources/platform_apikey.md b/docs/data-sources/platform_apikey.md new file mode 100644 index 000000000..08f9e66a0 --- /dev/null +++ b/docs/data-sources/platform_apikey.md @@ -0,0 +1,48 @@ +--- +# 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. +--- + +# harness_platform_apikey (Data Source) + +Data source for retrieving a Harness ApiKey. + +## Example Usage + +```terraform +data "harness_platform_apikey" "test" { + identifier = "test_apikey" + name = "test_apikey" + parent_id = "parent_id" + apikey_type = "USER" + account_id = "account_id" + org_id = "org_id" + project_id = "project_id" +} +``` + + +## Schema + +### Required + +- `account_id` (String) Account Identifier for the Entity +- `apikey_type` (String) Type of the API Key +- `identifier` (String) Identifier of the API Key +- `name` (String) Name of the API Key +- `parent_id` (String) Parent Entity Identifier of the API Key + +### Optional + +- `description` (String) Description of the API Key +- `tags` (String) Tags for the API Key +- `default_time_to_expire_token` (Number) Default expiration time of the Token within API Key +- `org_id` (String) Organization Identifier for the Entity +- `project_id` (String) Project Identifier for the Entity + +### Read-Only + +- `id` (String) The ID of this resource. diff --git a/docs/resources/platform_apikey.md b/docs/resources/platform_apikey.md new file mode 100644 index 000000000..c14f8397b --- /dev/null +++ b/docs/resources/platform_apikey.md @@ -0,0 +1,83 @@ +--- +# 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 apikeys. +--- + +# harness_platform_token (Resource) + +Resource for creating apikeys. + +## Example Usage + +```terraform +# Create token for account level apikey +resource ""harness_platform_apikey" "test" { + identifier = "test_apikey" + name = "test_apikey" + parent_id = "parent_id" + apikey_type = "USER" + account_id = "account_id" +} + +# Create token for org level apikey +resource "harness_platform_apikey" "test" { + identifier = "test_apikey" + name = "test_apikey" + parent_id = "parent_id" + apikey_type = "USER" + account_id = "account_id" + org_id = "org_id" +} + +# Create token for project level apikey +resource "harness_platform_apikey" "test" { + identifier = "test_apikey" + name = "test_apikey" + parent_id = "parent_id" + apikey_type = "USER" + account_id = "account_id" + org_id = "org_id" + project_id = "project_id" +} +``` + + +## Schema + +### Required + +- `account_id` (String) Account Identifier for the Entity +- `apikey_type` (String) Type of the API Key +- `identifier` (String) Identifier of the API Key +- `name` (String) Name of the API Key +- `parent_id` (String) Parent Entity Identifier of the API Key + +### Optional + +- `description` (String) Description of the API Key +- `tags` (String) Tags for the API Key +- `default_time_to_expire_token` (Number) Default expiration time of the Token within API Key +- `org_id` (String) Organization Identifier for the Entity +- `project_id` (String) Project Identifier for the Entity + +### Read-Only + +- `id` (String) The ID of this resource. + +## Import + +Import is supported using the following syntax: + +```shell +# Import account level apikey +terraform import harness_platform_apikey // + +# Import org level apikey +terraform import harness_platform_apikey /// + +# Import project level apikey +terraform import harness_platform_apikey //// +``` diff --git a/examples/data-sources/harness_platform_apikey/data_source.tf b/examples/data-sources/harness_platform_apikey/data_source.tf new file mode 100644 index 000000000..3830fa753 --- /dev/null +++ b/examples/data-sources/harness_platform_apikey/data_source.tf @@ -0,0 +1,9 @@ +data "harness_platform_apikey" "test" { + identifier = "test_apikey" + name = "test_apikey" + parent_id = "parent_id" + apikey_type = "USER" + account_id = "account_id" + org_id = "org_id" + project_id = "project_id" +} diff --git a/examples/resources/harness_platform_apikey/import.sh b/examples/resources/harness_platform_apikey/import.sh new file mode 100644 index 000000000..f483ef311 --- /dev/null +++ b/examples/resources/harness_platform_apikey/import.sh @@ -0,0 +1,8 @@ +# Import account level apikey +terraform import harness_platform_apikey // + +# Import org level apikey +terraform import harness_platform_apikey /// + +# Import project level apikey +terraform import harness_platform_apikey //// diff --git a/examples/resources/harness_platform_apikey/resource.tf b/examples/resources/harness_platform_apikey/resource.tf new file mode 100644 index 000000000..f803137bf --- /dev/null +++ b/examples/resources/harness_platform_apikey/resource.tf @@ -0,0 +1,29 @@ +# Create token for account level apikey +resource "harness_platform_apikey" "test" { + identifier = "test_apikey" + name = "test_apikey" + parent_id = "parent_id" + apikey_type = "USER" + account_id = "account_id" +} + +# Create token for org level apikey +resource "harness_platform_apikey" "test" { + identifier = "test_apikey" + name = "test_apikey" + parent_id = "parent_id" + apikey_type = "USER" + account_id = "account_id" + org_id = "org_id" +} + +# Create token for project level apikey +resource "harness_platform_apikey" "test" { + identifier = "test_apikey" + name = "test_apikey" + parent_id = "parent_id" + apikey_type = "USER" + account_id = "account_id" + org_id = "org_id" + project_id = "project_id" +}