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

Azure Rotating Secrets Changes #1143

Merged
merged 11 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from 7 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
3 changes: 3 additions & 0 deletions .changelog/1143.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:feature
add vault_secrets_integration_azure resource and add support for azure secrets to vault_secrets_rotating_secret resource
```
75 changes: 75 additions & 0 deletions docs/resources/vault_secrets_integration_azure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "hcp_vault_secrets_integration_azure Resource - terraform-provider-hcp"
subcategory: ""
description: |-
The Vault Secrets Azure integration resource manages an Azure integration.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feel incomplete.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to the above comment, this is a standard message across integrations.

---

# hcp_vault_secrets_integration_azure (Resource)

The Vault Secrets Azure integration resource manages an Azure integration.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feel incomplete.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.


## Example Usage

```terraform
resource "hcp_vault_secrets_integration_azure" "example" {
name = "my-azure-1"
capabilities = ["ROTATION"]
client_secret = {
"tenant_id" : "7eb3...",
"client_id" : "9de0...",
"client_secret" : "WZk8..."
}
}
```

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

### Required

- `capabilities` (Set of String) Capabilities enabled for the integration. See the Vault Secrets documentation for the list of supported capabilities per provider.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as dicussed in a preivous PR, i didnt foudn this documentaiton

Copy link
Contributor Author

@murali-partha murali-partha Dec 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a standard message across all integrations. AWS, GCP, Twilio

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think linking users to our docs' landing page would be helpful?

https://developer.hashicorp.com/hcp/docs/vault-secrets

Copy link
Contributor Author

@murali-partha murali-partha Dec 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could do that, the docs page doesn't directly talk about the capabilities option though. Another approach would be to list the options [ 'sync', 'rotation', 'dynamic'] in the same string. I am fine with adding either of these.

Note: This is a generated file, hence making this change will affect all the integration doc files where capabilities is listed.

- `name` (String) The Vault Secrets integration name.

### Optional

- `client_secret` (Attributes) Azure client secret used to authenticate against the target Azure application. Cannot be used with `federated_workload_identity`. (see [below for nested schema](#nestedatt--client_secret))
- `federated_workload_identity` (Attributes) (Recommended) Federated identity configuration to authenticate against the target Azure application. Cannot be used with `client_secret`. (see [below for nested schema](#nestedatt--federated_workload_identity))
- `project_id` (String) HCP project ID that owns the HCP Vault Secrets integration. Inferred from the provider configuration if omitted.

### Read-Only

- `organization_id` (String) HCP organization ID that owns the HCP Vault Secrets integration.
- `resource_id` (String) Resource ID used to uniquely identify the integration instance on the HCP platform.
- `resource_name` (String) Resource name used to uniquely identify the integration instance on the HCP platform.

<a id="nestedatt--client_secret"></a>
### Nested Schema for `client_secret`

Required:

- `client_id` (String) Azure client ID corresponding to the Azure application.
- `client_secret` (String) Secret value corresponding to the Azure client secret.
- `tenant_id` (String) Azure tenant ID corresponding to the Azure application.


<a id="nestedatt--federated_workload_identity"></a>
### Nested Schema for `federated_workload_identity`

Required:

- `audience` (String) Audience configured on the Azure federated identity credentials to federate access with HCP.
- `client_id` (String) Azure client ID corresponding to the Azure application.
- `tenant_id` (String) Azure tenant ID corresponding to the Azure application.

## Import

Import is supported using the following syntax:

```shell
# Vault Secrets Azure Integration can be imported by specifying the name of the integration
# Note that since the client secret is never returned on the Vault Secrets API,
# the next plan or apply will show a diff for that field.
terraform import hcp_vault_secrets_integration_confluent.example my-azure-1
```
22 changes: 22 additions & 0 deletions docs/resources/vault_secrets_rotating_secret.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,18 @@ resource "hcp_vault_secrets_rotating_secret" "example_confluent" {
service_account_id = "<service-account-id>"
}
}

resource "hcp_vault_secrets_rotating_secret" "example_azure" {
app_name = "my-app-1"
secret_provider = "azure"
name = "my_azure_1_secret"
integration_name = "my-azure-1"
rotation_policy_name = "built-in:60-days-2-active"
azure_application_password_params = {
app_object_id = "<app_object_id>"
app_client_id = "<app_client_id>"
}
}
```

<!-- schema generated by tfplugindocs -->
Expand All @@ -82,6 +94,7 @@ resource "hcp_vault_secrets_rotating_secret" "example_confluent" {
### Optional

- `aws_access_keys` (Attributes) AWS configuration to manage the access key rotation for the given IAM user. Required if `secret_provider` is `aws`. (see [below for nested schema](#nestedatt--aws_access_keys))
- `azure_application_password_params` (Attributes) Azure configuration to manage the application password rotation for the given application. Required if `secret_provider` is `confluent`. (see [below for nested schema](#nestedatt--azure_application_password_params))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- `azure_application_password_params` (Attributes) Azure configuration to manage the application password rotation for the given application. Required if `secret_provider` is `confluent`. (see [below for nested schema](#nestedatt--azure_application_password_params))
- `azure_application_password` (Attributes) Azure configuration to manage the application password rotation for the given application. Required if `secret_provider` is `azure`. (see [below for nested schema](#nestedatt--azure_application_password_params))

The param suffix feels redundant and the other credential types did not add it. There is a Confluent copy-paste leftover.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops I think this is the generated code. Nvm the suggestion but the comment are relevant to the resource schema.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for noticing this. Updated.

- `confluent_service_account` (Attributes) Confluent configuration to manage the cloud api key rotation for the given service account. Required if `secret_provider` is `confluent`. (see [below for nested schema](#nestedatt--confluent_service_account))
- `gcp_service_account_key` (Attributes) GCP configuration to manage the service account key rotation for the given service account. Required if `secret_provider` is `gcp`. (see [below for nested schema](#nestedatt--gcp_service_account_key))
- `mongodb_atlas_user` (Attributes) MongoDB Atlas configuration to manage the user password rotation on the given database. Required if `secret_provider` is `mongodb_atlas`. (see [below for nested schema](#nestedatt--mongodb_atlas_user))
Expand All @@ -100,6 +113,15 @@ Required:
- `iam_username` (String) AWS IAM username to rotate the access keys for.


<a id="nestedatt--azure_application_password_params"></a>
### Nested Schema for `azure_application_password_params`

Required:

- `app_client_id` (String) Application client ID to rotate the application password for.
- `app_object_id` (String) Application object ID to rotate the application password for.


<a id="nestedatt--confluent_service_account"></a>
### Nested Schema for `confluent_service_account`

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Vault Secrets Azure Integration can be imported by specifying the name of the integration
# Note that since the client secret is never returned on the Vault Secrets API,
# the next plan or apply will show a diff for that field.
terraform import hcp_vault_secrets_integration_confluent.example my-azure-1
murali-partha marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
resource "hcp_vault_secrets_integration_azure" "example" {
name = "my-azure-1"
capabilities = ["ROTATION"]
client_secret = {
"tenant_id" : "7eb3...",
"client_id" : "9de0...",
"client_secret" : "WZk8..."
}
}
murali-partha marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,14 @@ resource "hcp_vault_secrets_rotating_secret" "example_confluent" {
}
}

resource "hcp_vault_secrets_rotating_secret" "example_azure" {
app_name = "my-app-1"
secret_provider = "azure"
name = "my_azure_1_secret"
integration_name = "my-azure-1"
rotation_policy_name = "built-in:60-days-2-active"
azure_application_password_params = {
app_object_id = "<app_object_id>"
app_client_id = "<app_client_id>"
}
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/hashicorp/go-cty v1.4.1-0.20200723130312-85980079f637
github.com/hashicorp/go-uuid v1.0.3
github.com/hashicorp/go-version v1.7.0
github.com/hashicorp/hcp-sdk-go v0.123.0
github.com/hashicorp/hcp-sdk-go v0.124.0
github.com/hashicorp/terraform-plugin-docs v0.19.4
github.com/hashicorp/terraform-plugin-framework v1.5.0
github.com/hashicorp/terraform-plugin-framework-validators v0.12.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ github.com/hashicorp/hc-install v0.7.0 h1:Uu9edVqjKQxxuD28mR5TikkKDd/p55S8vzPC16
github.com/hashicorp/hc-install v0.7.0/go.mod h1:ELmmzZlGnEcqoUMKUuykHaPCIR1sYLYX+KSggWSKZuA=
github.com/hashicorp/hcl/v2 v2.19.1 h1://i05Jqznmb2EXqa39Nsvyan2o5XyMowW5fnCKW5RPI=
github.com/hashicorp/hcl/v2 v2.19.1/go.mod h1:ThLC89FV4p9MPW804KVbe/cEXoQ8NZEh+JtMeeGErHE=
github.com/hashicorp/hcp-sdk-go v0.123.0 h1:kUf/kSCVkQ4XXyny8GUyUWjvIIIanGRRkhRmgj2lC+4=
github.com/hashicorp/hcp-sdk-go v0.123.0/go.mod h1:vQ4fzdL1AmhIAbCw+4zmFe5Hbpajj3NvRWkJoVuxmAk=
github.com/hashicorp/hcp-sdk-go v0.124.0 h1:Th4qCAAqlPrC5s2riHnMTsHFIZ5GsFWzK7l2W7vqsN4=
github.com/hashicorp/hcp-sdk-go v0.124.0/go.mod h1:vQ4fzdL1AmhIAbCw+4zmFe5Hbpajj3NvRWkJoVuxmAk=
github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y=
github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
github.com/hashicorp/terraform-exec v0.21.0 h1:uNkLAe95ey5Uux6KJdua6+cv8asgILFVWkd/RG0D2XQ=
Expand Down
1 change: 1 addition & 0 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ func (p *ProviderFramework) Resources(ctx context.Context) []func() resource.Res
vaultsecrets.NewVaultSecretsIntegrationMongoDBAtlasResource,
vaultsecrets.NewVaultSecretsIntegrationTwilioResource,
vaultsecrets.NewVaultSecretsIntegrationsConfluentResource,
vaultsecrets.NewVaultSecretsIntegrationAzureResource,
vaultsecrets.NewVaultSecretsDynamicSecretResource,
vaultsecrets.NewVaultSecretsRotatingSecretResource,
// IAM
Expand Down
Loading