diff --git a/internal/services/managedhsm/key_vault_managed_hardware_security_module_key_resource.go b/internal/services/managedhsm/key_vault_managed_hardware_security_module_key_resource.go index 648ca252f25e..4552f465c46b 100644 --- a/internal/services/managedhsm/key_vault_managed_hardware_security_module_key_resource.go +++ b/internal/services/managedhsm/key_vault_managed_hardware_security_module_key_resource.go @@ -42,11 +42,11 @@ import ( type AutomaticModel struct { DurationAfterCreation string `tfschema:"duration_after_creation"` - TimeBeforeExpiry string `tfschema:"time_before_expiry"` + DurationBeforeExpiry string `tfschema:"duration_before_expiry"` } type RotationPolicyModel struct { - Automatic []AutomaticModel `tfschema:"automatic"` - ExpireAfter string `tfschema:"expire_after"` + Automatic []AutomaticModel `tfschema:"automatic"` + ExpireAfterDuration string `tfschema:"expire_after_duration"` // NotifyBeforeExpiry string `tfschema:"notify_before_expiry"` } type KeyVaultManagedHardwareSecurityModuleKeyModel struct { @@ -215,16 +215,16 @@ func (KeyVaultManagedHardwareSecurityModuleKeyResouece) Arguments() map[string]* MaxItems: 1, Elem: &pluginsdk.Resource{ Schema: map[string]*pluginsdk.Schema{ - "expire_after": { + "expire_after_duration": { Type: pluginsdk.TypeString, Optional: true, ValidateFunc: validate.ISO8601DurationBetween("P28D", "P100Y"), AtLeastOneOf: []string{ - "rotation_policy.0.expire_after", + "rotation_policy.0.expire_after_duration", "rotation_policy.0.automatic", }, RequiredWith: []string{ - "rotation_policy.0.expire_after", + "rotation_policy.0.expire_after_duration", }, }, @@ -240,16 +240,16 @@ func (KeyVaultManagedHardwareSecurityModuleKeyResouece) Arguments() map[string]* ValidateFunc: validate.ISO8601Duration, AtLeastOneOf: []string{ "rotation_policy.0.automatic.0.duration_after_creation", - "rotation_policy.0.automatic.0.time_before_expiry", + "rotation_policy.0.automatic.0.duration_before_expiry", }, }, - "time_before_expiry": { + "duration_before_expiry": { Type: pluginsdk.TypeString, Optional: true, ValidateFunc: validate.ISO8601Duration, AtLeastOneOf: []string{ "rotation_policy.0.automatic.0.duration_after_creation", - "rotation_policy.0.automatic.0.time_before_expiry", + "rotation_policy.0.automatic.0.duration_before_expiry", }, }, }, @@ -748,8 +748,8 @@ func (k KeyVaultManagedHardwareSecurityModuleKeyResouece) expandKeyVaultKeyRotat policy := v[0] var expiryTime *string = nil // needs to be set to nil if not set - if policy.ExpireAfter != "" { - expiryTime = pointer.To(policy.ExpireAfter) + if policy.ExpireAfterDuration != "" { + expiryTime = pointer.To(policy.ExpireAfterDuration) } lifetimeActions := make([]keyvault.LifetimeActions, 0) @@ -767,8 +767,8 @@ func (k KeyVaultManagedHardwareSecurityModuleKeyResouece) expandKeyVaultKeyRotat lifetimeActionRotate.Trigger.TimeAfterCreate = &autoRotationRaw.DurationAfterCreation } - if autoRotationRaw.TimeBeforeExpiry != "" { - lifetimeActionRotate.Trigger.TimeBeforeExpiry = &autoRotationRaw.TimeBeforeExpiry + if autoRotationRaw.DurationBeforeExpiry != "" { + lifetimeActionRotate.Trigger.TimeBeforeExpiry = &autoRotationRaw.DurationBeforeExpiry } lifetimeActions = append(lifetimeActions, lifetimeActionRotate) @@ -789,7 +789,7 @@ func (k KeyVaultManagedHardwareSecurityModuleKeyResouece) flattenKeyVaultKeyRota var policy RotationPolicyModel if input.Attributes != nil { - policy.ExpireAfter = pointer.From(input.Attributes.ExpiryTime) + policy.ExpireAfterDuration = pointer.From(input.Attributes.ExpiryTime) } if input.LifetimeActions != nil { @@ -801,7 +801,7 @@ func (k KeyVaultManagedHardwareSecurityModuleKeyResouece) flattenKeyVaultKeyRota if strings.EqualFold(string(action.Type), string(keyvault.ActionTypeRotate)) { var autoRotation AutomaticModel autoRotation.DurationAfterCreation = pointer.From(trigger.TimeAfterCreate) - autoRotation.TimeBeforeExpiry = pointer.From(trigger.TimeBeforeExpiry) + autoRotation.DurationBeforeExpiry = pointer.From(trigger.TimeBeforeExpiry) policy.Automatic = append(policy.Automatic, autoRotation) } } diff --git a/internal/services/managedhsm/key_vault_managed_hardware_security_module_key_resource_test.go b/internal/services/managedhsm/key_vault_managed_hardware_security_module_key_resource_test.go index a0a486c87a03..df2747a73737 100644 --- a/internal/services/managedhsm/key_vault_managed_hardware_security_module_key_resource_test.go +++ b/internal/services/managedhsm/key_vault_managed_hardware_security_module_key_resource_test.go @@ -227,10 +227,10 @@ resource "azurerm_key_vault_managed_hardware_security_module_key" "test" { rotation_policy { automatic { - time_before_expiry = "P30D" + duration_before_expiry = "P30D" } - expire_after = "P60D" + expire_after_duration = "P60D" } tags = { Env = "test" diff --git a/website/docs/r/key_vault_managed_hardware_security_module_key.html.markdown b/website/docs/r/key_vault_managed_hardware_security_module_key.html.markdown index 5441f03b71c2..24f1794832d6 100644 --- a/website/docs/r/key_vault_managed_hardware_security_module_key.html.markdown +++ b/website/docs/r/key_vault_managed_hardware_security_module_key.html.markdown @@ -163,10 +163,10 @@ resource "azurerm_key_vault_managed_hardware_security_module_key" "example" { "verify", ] rotation_policy { - expire_after = "P66D" + expire_after_duration = "P66D" automatic { - time_before_expiry = "P30D" + duration_before_expiry = "P30D" } } @@ -205,7 +205,7 @@ The following arguments are supported: A `rotation_policy` block supports the following: -* `expire_after` - (Optional) Expire a Managed Hardware Security Module Key after given duration as an [ISO 8601 duration](https://en.wikipedia.org/wiki/ISO_8601#Durations). +* `expire_after_duration` - (Optional) Expire a Managed Hardware Security Module Key after given duration as an [ISO 8601 duration](https://en.wikipedia.org/wiki/ISO_8601#Durations). * `automatic` - (Optional) An `automatic` block as defined below. @@ -215,7 +215,7 @@ An `automatic` block supports the following: * `duration_after_creation` - (Optional) Rotate automatically at a duration after create as an [ISO 8601 duration](https://en.wikipedia.org/wiki/ISO_8601#Durations). -* `time_before_expiry` - (Optional) Rotate automatically at a duration before expiry as an [ISO 8601 duration](https://en.wikipedia.org/wiki/ISO_8601#Durations). +* `duration_before_expiry` - (Optional) Rotate automatically at a duration before expiry as an [ISO 8601 duration](https://en.wikipedia.org/wiki/ISO_8601#Durations). ## Attributes Reference