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

feat: add tag maps to azurerm_key_vault_secrets and azurerm_key_vault_certificates data sources #24857

Merged
merged 1 commit into from
Feb 15, 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
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/services/keyvault/parse"
"github.com/hashicorp/terraform-provider-azurerm/internal/tags"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
"github.com/hashicorp/terraform-provider-azurerm/internal/timeouts"
"github.com/hashicorp/terraform-provider-azurerm/utils"
Expand Down Expand Up @@ -62,6 +63,8 @@ func dataSourceKeyVaultCertificates() *pluginsdk.Resource {
Type: pluginsdk.TypeBool,
Computed: true,
},

"tags": tags.SchemaDataSource(),
},
},
},
Expand Down Expand Up @@ -125,8 +128,14 @@ func expandCertificate(name string, item keyvault.CertificateItem) map[string]in
"name": name,
"id": *item.ID,
}

if item.Attributes != nil && item.Attributes.Enabled != nil {
cert["enabled"] = *item.Attributes.Enabled
}

if item.Tags != nil {
cert["tags"] = tags.Flatten(item.Tags)
}

return cert
}
9 changes: 9 additions & 0 deletions internal/services/keyvault/key_vault_secrets_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/hashicorp/go-azure-helpers/resourcemanager/commonschema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-provider-azurerm/internal/clients"
"github.com/hashicorp/terraform-provider-azurerm/internal/tags"
"github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk"
"github.com/hashicorp/terraform-provider-azurerm/internal/timeouts"
"github.com/hashicorp/terraform-provider-azurerm/utils"
Expand Down Expand Up @@ -57,6 +58,8 @@ func dataSourceKeyVaultSecrets() *pluginsdk.Resource {
Type: pluginsdk.TypeBool,
Computed: true,
},

"tags": tags.SchemaDataSource(),
},
},
},
Expand Down Expand Up @@ -132,8 +135,14 @@ func expandSecrets(name string, item keyvault.SecretItem) map[string]interface{}
"id": *item.ID,
"name": name,
}

if item.Attributes != nil && item.Attributes.Enabled != nil {
res["enabled"] = *item.Attributes.Enabled
}

if item.Tags != nil {
res["tags"] = tags.Flatten(item.Tags)
}

return res
}
8 changes: 6 additions & 2 deletions website/docs/d/key_vault_certificates.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,13 @@ In addition to the arguments above, the following attributes are exported:

A `certificates` block supports following:

* `name` - The name of secret.
* `name` - The name of certificate.

* `enabled` - Whether this secret is enabled.
* `enabled` - Whether this certificate is enabled.

* `id` - The ID of this certificate.

* `tags` - The tags of this certificate.

## Timeouts

Expand Down
2 changes: 2 additions & 0 deletions website/docs/d/key_vault_secrets.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ A `secrets` block supports following:

* `id` - The ID of this secret.

* `tags` - The tags of this secret.

## Timeouts

The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/language/resources/syntax#operation-timeouts) for certain actions:
Expand Down
Loading