Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: [PL-39755]: Added docs for harness apiKeys resource #601

Merged
merged 3 commits into from
Jul 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions docs/data-sources/platform_apikey.md
Original file line number Diff line number Diff line change
@@ -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 generated by tfplugindocs -->
## 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.
83 changes: 83 additions & 0 deletions docs/resources/platform_apikey.md
Original file line number Diff line number Diff line change
@@ -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 generated by tfplugindocs -->
## 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 <parent_id>/<apikey_id>/<apikey_type>

# Import org level apikey
terraform import harness_platform_apikey <org_id>/<parent_id>/<apikey_id>/<apikey_type>

# Import project level apikey
terraform import harness_platform_apikey <org_id>/<project_id>/<parent_id>/<apikey_id>/<apikey_type>
```
9 changes: 9 additions & 0 deletions examples/data-sources/harness_platform_apikey/data_source.tf
Original file line number Diff line number Diff line change
@@ -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"
}
8 changes: 8 additions & 0 deletions examples/resources/harness_platform_apikey/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Import account level apikey
terraform import harness_platform_apikey <parent_id>/<apikey_id>/<apikey_type>

# Import org level apikey
terraform import harness_platform_apikey <org_id>/<parent_id>/<apikey_id>/<apikey_type>

# Import project level apikey
terraform import harness_platform_apikey <org_id>/<project_id>/<parent_id>/<apikey_id>/<apikey_type>
29 changes: 29 additions & 0 deletions examples/resources/harness_platform_apikey/resource.tf
Original file line number Diff line number Diff line change
@@ -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"
}