-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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_key_vault_secret
- support for not_before_date
and expiration_date
#4873
azurerm_key_vault_secret
- support for not_before_date
and expiration_date
#4873
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @aqche, this PR is nearly there. We just need to do a nil check and remove a duplicated line and we should be good
@@ -280,6 +334,14 @@ func resourceArmKeyVaultSecretRead(d *schema.ResourceData, meta interface{}) err | |||
d.Set("version", respID.Version) | |||
d.Set("content_type", resp.ContentType) | |||
|
|||
if v := resp.Attributes.NotBefore; v != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Attributes
has the potential to be nil so we should that it isn't nil before referencing NotBefore
and Expires
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good call, added a nil check for Attributes
@@ -153,6 +153,9 @@ func TestAccAzureRMKeyVaultSecret_complete(t *testing.T) { | |||
Config: config, | |||
Check: resource.ComposeTestCheckFunc( | |||
testCheckAzureRMKeyVaultSecretExists(resourceName), | |||
resource.TestCheckResourceAttr(resourceName, "not_before_date", "2019-01-01T01:02:03Z"), | |||
resource.TestCheckResourceAttr(resourceName, "expiration_date", "2020-01-01T01:02:03Z"), | |||
resource.TestCheckResourceAttr(resourceName, "tags.hello", "world"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same check is done just a couple lines below. Can we remove this one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whoops, removed!
@mbfrahry thanks for the review! addressed the comments. please take a look again when you have the chance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect! Thanks for addressing that
notBeforeDate, err := time.Parse(time.RFC3339, v.(string)) | ||
if err != nil { | ||
return fmt.Errorf("error parsing `not_before_date` time: %s", err) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
technically we don't need to check for an error here because the validation function should catch all non valid time strings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense, removed 👍
expirationDate, err := time.Parse(time.RFC3339, v.(string)) | ||
if err != nil { | ||
return fmt.Errorf("error parsing `expiration_date` time: %s", err) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TestAccAzureRMPostgreSQLDatabase_collationWithHyphen
notBeforeDate, err := time.Parse(time.RFC3339, v.(string)) | ||
if err != nil { | ||
return fmt.Errorf("error parsing `not_before_date` time: %s", err) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TestAccAzureRMPostgreSQLDatabase_collationWithHyphen
expirationDate, err := time.Parse(time.RFC3339, v.(string)) | ||
if err != nil { | ||
return fmt.Errorf("error parsing `expiration_date` time: %s", err) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TestAccAzureRMPostgreSQLDatabase_collationWithHyphen
@katbyte updated per your suggestion, let me know what you think! |
not_before_date
and expiration_date
args to azurerm_key_vault_secret
azurerm_key_vault_secret
- support for not_before_date
and expiration_date
Perfect! Thanks for getting this written. We'll get that out in the next release |
This has been released in version 1.37.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example: provider "azurerm" {
version = "~> 1.37.0"
}
# ... other configuration ... |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks! |
Fixes #4858
Adds the
not_before_date
andexpiration_date
options to theazurerm_key_vault_secret
resource.