-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
google_sql_database_instance inconsistent defaulting for ipv4_enabled #6012
google_sql_database_instance inconsistent defaulting for ipv4_enabled #6012
Comments
I am able to repro the error behavior and i see provider is defaulting to false for API - https://cloud.google.com/sql/docs/mysql/admin-api/rest/v1beta4/instances/insert
@danawillow what are your thoughts on this ? |
Sounds like a bug to me! Will prepare a fix. |
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 👉 hashibot-feedback@hashicorp.com. Thanks! |
Community Note
modular-magician
user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned tohashibot
, a community member has claimed the issue already.Terraform Version
Terraform v0.12.24
Affected Resource(s)
Terraform Configuration Files
SQL instance with unspecified
settings.ip_configuration
; works just fine:SQL instance with a partially specified
settings.ip_configuration
(partial in the sense that not all fields nested withinip_configuration
are specified); fails onterraform apply
:Debug Output
https://gist.github.com/jcanseco/93d49f98950a0131f891d49db4445dff
Expected Behavior
Should be able to
terraform apply
the second provided configuration as well.Actual Behavior
Applying second provided configuration fails with the following error:
It seems that the Terraform provider lets GCP default
settings.ip_configuration.ipv4_enabled
ifsettings.ip_configuration
is unspecified, and that the value ofipv4_enabled
will depend on whether the instance is a 1st gen or 2nd gen instance (source).However, if
ip_configuration
is specified at all, then ifipv4_enabled
is not specified, Terraform sets it tofalse
, which is then rejected by GCP if the instance is 2nd gen since the IPv4 address cannot be disabled for 2nd gen instances (source: see docs foripConfiguration
field here). It seems that eitheripv4_enabled
must be set totrue
or aprivate_network
must be specified in this case (source).It seems surprising that you can successfully create a 2nd gen instance without specifying
ipv4_enabled
orprivate_network
, but then fail to do so the momentip_configuration
is specified at all even ifipv4_enabled
andprivate_network
remain unspecified. Moreover, this experience is inconsistent with 1st gen instances, which (I believe) can be created in both scenarios (specified or unspecifiedip_configuration
with noipv4_enabled
andprivate_network
).Do you think it would be possible for Terraform to not set these fields at all and let GCP default them as long as they are not set by the user?
Steps to Reproduce
terraform apply
the second configuration provided.The text was updated successfully, but these errors were encountered: