Open umatare5 opened 2 months ago
Confirmed issue!
According to terraform registry the documentation block
content
, mime_type
and subject
are optional. But when we are attempting to create the google_monitoring_alert_policy
it triggers the next error:
Error creating AlertPolicy: googleapi: Error 400: Request was missing field alert_policy.documentation.mime_type: non-empty content requires non-empty MIME type and vice versa.
Community Note
Terraform Version & Provider Version(s)
Affected Resource(s)
google_monitoring_alert_policy
Terraform Configuration
Add
documentation.0.subject = "baz"
to Example Usage - Monitoring Alert Policy Basic.Debug Output
No response
Expected Behavior
Create a resource successfully when run
terraform apply
.Actual Behavior
terraform apply
fails because API returns status code400
as follows:This error is caused by
terraform
completesdocumentation.0.mime_type = "text/markdown"
automatically.Description
From my understanding,
mime_type
is required forcontent
, but not forsubject
.content
andsubject
.So I think the completion is not necessary in this case.
How do you think about adding the condition that
mime_type
is only completed when thecontent
is set?Workaround
Set
mime_type = ""
.Steps to reproduce
terraform apply
Important Factoids
No response
References
subject
was added in following PR later thancontent
andmime_type
.https://github.com/GoogleCloudPlatform/magic-modules/pull/9360
b/349152014