-
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
Validate policy mode value #8795
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 @beandrad
Thanks for this PR - if we can also update the docs then this otherwise LGTM 👍
Thanks!
"Microsoft.MachineLearningServices.Data", | ||
"Microsoft.Network.Data", | ||
"Microsoft.Synapse.Data", | ||
}, false, |
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.
could we also update the values used in the docs here: https://github.com/terraform-providers/terraform-provider-azurerm/blame/master/website/docs/r/policy_definition.html.markdown#L72-L74
* `mode` - (Required) The policy mode that allows you to specify which resource types will be evaluated. Possible values are `All`, `Indexed`, `Microsoft.ContainerService.Data`, `Microsoft.CustomerLockbox.Data`, `Microsoft.DataCatalog.Data`, `Microsoft.KeyVault.Data`, `Microsoft.Kubernetes.Data`, `Microsoft.MachineLearningServices.Data`, `Microsoft.Network.Data` and `Microsoft.Synapse.Data`.
I do think that a DiffSupress Would be better for this them forcing the values. |
Policy creation succeeds even if the policy mode in the request is not capitalized, however, when fetching the policy mode value from Azure, the correct capitalized version is returned, which causes the Terraform state and configuration to be different. Ideally, there should be an enum with a set of allowed values, but this is not the case in the latest version of the Azure Rest API specs. However, the supported mode values are returned in the error response when an invalid mode is requested. Fixes hashicorp#8748
815a885
to
da7bcdb
Compare
@tombuildsstuff thanks for reviewing! docs updated! |
This has been released in version 2.31.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 = "~> 2.31.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! |
Policy creation succeeds even if the policy mode in the request is
not capitalized, however, when fetching the policy mode value from
Azure, the correct capitalized version is returned, which causes
the Terraform state and configuration to be different.
Ideally, there should be an enum with a set of allowed values, but
thi is not the case in the latest version of the Azure Rest API specs.
However, the supported mode values are returned in the create error
response when an invalid mode is requested.
Fixes #8748