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 documentation template #825

Merged
merged 2 commits into from
Apr 25, 2024
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
4 changes: 4 additions & 0 deletions .changelog/825.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
```release-note:bug
Fix documentation of hcp_vault_secrets_app_iam_binding and hcp_vault_secrets_app_iam_policy

```
34 changes: 28 additions & 6 deletions docs/resources/vault_secrets_app_iam_binding.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,41 @@
---
page_title: "{{.Type}} {{.Name}} - {{.ProviderName}}"
page_title: "Resource hcp_vault_secrets_app_iam_binding - terraform-provider-hcp"
subcategory: "Cloud Platform"
description: |-
{{ .Description | plainmarkdown | trimspace | prefixlines " " }}
Updates the Vault Secrets App IAM policy to bind a role to a new member. Existing bindings are preserved.
---

# {{.Name}} ({{.Type}})
# hcp_vault_secrets_app_iam_binding (Resource)

{{ .Description | trimspace }}
Updates the Vault Secrets App IAM policy to bind a role to a new member. Existing bindings are preserved.

~> **Note:** `hcp_vault_secrets_app_iam_binding` cannot be used in conjunction with
`hcp_vault_secrets_app_iam_policy`.

## Example Usage

{{ tffile "examples/resources/hcp_vault_secrets_app_iam_binding/resource.tf" }}
```terraform
resource "hcp_service_principal" "sp" {
name = "example-sp"
}

{{ .SchemaMarkdown | trimspace }}
resource "hcp_vault_secrets_app" "example" {
app_name = "example-app-name"
description = "My new app!"
}

resource "hcp_vault_secrets_app_iam_binding" "example" {
resource_name = hcp_vault_secrets_app.example.resource_name
principal_id = hcp_service_principal.sp.resource_id
role = "roles/secrets.app-secret-reader"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `principal_id` (String) The principal to bind to the given role.
- `resource_name` (String) The app's resource name in the format secrets/project/<project ID>/app/<app Name>.
- `role` (String) The role name to bind to the given principal.
49 changes: 42 additions & 7 deletions docs/resources/vault_secrets_app_iam_policy.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
page_title: "{{.Type}} {{.Name}} - {{.ProviderName}}"
page_title: "Resource hcp_vault_secrets_app_iam_policy - terraform-provider-hcp"
subcategory: "Cloud Platform"
description: |-
{{ .Description | plainmarkdown | trimspace | prefixlines " " }}
Sets the Vault Secrets App IAM policy and replaces any existing policy.
---

# {{.Name}} ({{.Type}})
# hcp_vault_secrets_app_iam_policy (Resource)

!> **Be Careful!** You can accidentally lock yourself out of your vault secrets app using
this resource. Deleting a hcp_vault_secrets_app_iam_policy removes access from anyone
Expand All @@ -14,19 +14,54 @@ If you are trying to additively give permissions to the app, prefer using
`hcp_vault_secrets_app_iam_binding`. If you do use this resource, it is recommended to
import the policy before applying the change.

{{ .Description | trimspace }}
Sets the Vault Secrets App IAM policy and replaces any existing policy.

~> **Note:** `hcp_vault_secrets_app_iam_policy` can not be used in conjunction with
`hcp_vault_secrets_app_iam_binding`.

## Example Usage

{{ tffile "examples/resources/hcp_project_iam_policy/resource.tf" }}
```terraform
data "hcp_iam_policy" "example" {
bindings = [
{
role = "roles/contributor"
principals = [
"example-user-id-1",
"example-group-id-1",
"example-sp-1"
]
},
]
}

{{ .SchemaMarkdown | trimspace }}
resource "hcp_project" "my_project" {
name = "example"
}

resource "hcp_project_iam_policy" "project_policy" {
project_id = hcp_project.my_project.resource_id
policy_data = data.hcp_iam_policy.example.policy_data
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `policy_data` (String) The policy to apply.
- `resource_name` (String) The app's resource name in the format secrets/project/<project ID>/app/<app Name>.

### Read-Only

- `etag` (String) The etag captures the existing state of the policy.

## Import

Import is supported using the following syntax:

{{ codefile "shell" "examples/resources/hcp_vault_secrets_app_iam_policy/import.sh" }}
```shell
# Vault Secrets App IAM Policy can be imported by specifying the resource name of the app
terraform import hcp_vault_secrets_app_iam_policy.example secrets/project/41d107a7-eea6-4b5e-8481-508ab29e2b07/app/example-app-name
```