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

azurerm_keyvault_secret: support versionless_id attribute #10738

Merged
merged 1 commit into from
Feb 26, 2021
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 @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"log"
"strings"
"time"

"github.com/Azure/azure-sdk-for-go/services/keyvault/2016-10-01/keyvault"
Expand Down Expand Up @@ -81,6 +82,11 @@ func resourceKeyVaultSecret() *schema.Resource {
Computed: true,
},

"versionless_id": {
Type: schema.TypeString,
Computed: true,
},

"tags": tags.Schema(),
},
}
Expand Down Expand Up @@ -336,6 +342,7 @@ func resourceKeyVaultSecretRead(d *schema.ResourceData, meta interface{}) error
d.Set("value", resp.Value)
d.Set("version", respID.Version)
d.Set("content_type", resp.ContentType)
d.Set("versionless_id", fmt.Sprintf("%s/%s/%s", strings.TrimSuffix(id.KeyVaultBaseUrl, "/"), id.NestedItemType, id.Name))

if attributes := resp.Attributes; attributes != nil {
if v := attributes.NotBefore; v != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ func TestAccKeyVaultSecret_complete(t *testing.T) {
check.That(data.ResourceName).Key("expiration_date").HasValue("2020-01-01T01:02:03Z"),
check.That(data.ResourceName).Key("tags.%").HasValue("1"),
check.That(data.ResourceName).Key("tags.hello").HasValue("world"),
check.That(data.ResourceName).Key("versionless_id").HasValue(fmt.Sprintf("https://acctestkv-%s.vault.azure.net/secrets/secret-%s", data.RandomString, data.RandomString)),
),
},
data.ImportStep(),
Expand Down
1 change: 1 addition & 0 deletions website/docs/r/key_vault_secret.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ The following attributes are exported:

* `id` - The Key Vault Secret ID.
* `version` - The current version of the Key Vault Secret.
* `versionless_id` - The Base ID of the Key Vault Secret.

## Timeouts

Expand Down