Code Monkey home page Code Monkey logo

Comments (4)

ggtisc avatar ggtisc commented on June 14, 2024

Hi @verdel!

As I understand reading the main conversation between you and imrannayer from the attached link and from this one:

You have an existing google_sql_database resource, but then when you update any other resources that aren't the google_sql_database it internally changes the settings.version

Please confirm this statement to understand your needs.

from terraform-provider-google.

verdel avatar verdel commented on June 14, 2024

@ggtisc, not quite. I'm creating a google_sql_database_instance(not google_sql_database) resource, and after some time when executing terraform plan or terraform apply, I get a warning in the command output indicating that the settings.version attribute of the resource has changed. Meanwhile, no other attributes within settings change (although, based on the purpose of settings.version— which is to be an incrementing revision number of settings — this attribute should not change unless another settings key changes).

The warning that I receive in the command output:

Terraform detected the following changes made outside of Terraform since the
last "terraform apply" which may have affected this plan

from terraform-provider-google.

ggtisc avatar ggtisc commented on June 14, 2024

Then you have the existing google_sql_database_instance resource without making changes for a long time. And one day without making any change again to that same resource or adding other new resources to that project you simply run a terraform apply or a terraform plan and it change the version of this unique resource? or were there changes to other resources in the same project?

from terraform-provider-google.

verdel avatar verdel commented on June 14, 2024

@ggtisc, the Terraform code does not change between calls to terraform apply. No changes are made in the web interface or through gcloud either. Nothing changes in other resources within the project. The output of terraform plan or terraform apply indicates that only the settings.version attribute changes.

In the JSON API documentation, it is written that settingsVersion is the version of instance settings. This means that changes to this attribute(settings.version) can only occur if the settings object itself changes.

I thought that one possible reason for the change in settings.version might be that some sub-attributes present in a Google Cloud PostgreSQL instance are not being saved in the Terraform state. If this sub-attribute changes on the platform side, then settings.version will change, but since the sub-attribute is beyond the visibility for the Terraform state, in the output of terraform plan or terraform apply we will only see the change in settings.version.

I checked in the resource_sql_database_instance.go code all the sub-attributes that are saved in the Terraform state and noticed a discrepancy with the documentation only in one attribute - databaseReplicationEnabled. This is just my guess, but it is the only difference from the documentation that I see right now.

Unfortunately, I can't yet explain why the real state of a Google Cloud PostgreSQL instance might only differ in settings.version from the Terraform state.

I am currently waiting for the settings.version change to be reproduced without changes in other sub-attributes.

As I currently do not have my own data to confirm this behavior, in the process of creating this issue, I requested data from another participant(@juliusoh) in the discussion of the issue in the terraform-google-modules/terraform-google-sql-db repository.

from terraform-provider-google.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.