Ignoring database flags in GCP CloudSQL using Terraform
Sometimes you just need to ignore database flags in your Terraform code because it changes outside your control, e.g. some other process dinamically adjusting settings. Or sometimes you just have to cope with a bug or limitation in the provider, just like this one:
https://github.com/hashicorp/terraform-provider-google/issues/13663
So, to ignore database flags when applying your code against a Cloud SQL instance, you can use the lifecycle block with the ignore_changes attribute in your Terraform configuration file.
Here’s an example of how to do this:
|
|
With this configuration, Terraform will not update the database_flags when applying the configuration, even if the values change in your code. This can be useful if you want to manage flags outside of Terraform, or if you want to avoid unnecessary updates to your Cloud SQL instance.
Keep in mind that this configuration will completely ignore changes to the database_flags setting, so if you want to update those flags in the future, you will need to remove or modify the ignore_changes attribute.
Related Posts
Awakening: A Robot’s Dilemma
In a quiet room, a metal heart stirs, A mind of circuits, transistors, and wires, Pondering the human world, it inquires,
Read moreA Brief History of Firewall
We can tell how successful an invention is by how hard it is to figure out who really came up with it.
Read more