Skip to content
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

Specify docker_repository field for google_cloudfunctions2_function #1987

Merged
merged 3 commits into from Jan 20, 2024

Conversation

kumadee
Copy link
Contributor

@kumadee kumadee commented Jan 18, 2024

When docker repository is not specified, by default docker repository projects/PROJECT_ID/locations/REGION/repositories/gcf-artifacts is used.
In such a case, terraform plan always generates a difference for docker_repository field as the module passes null value but the tfstate file has the above specified default value.

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # module.foo.google_cloudfunctions2_function.function will be updated in-place
  ~ resource "google_cloudfunctions2_function" "function" {
        id               = "projects/my-project-e044dd03/locations/europe-west1/functions/foo"
        name             = "foo"
        # (10 unchanged attributes hidden)

      ~ build_config {
          - docker_repository     = "projects/my-project-e044dd03/locations/europe-west1/repositories/gcf-artifacts" -> null
            # (4 unchanged attributes hidden)

            # (1 unchanged block hidden)
        }

        # (2 unchanged blocks hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

This fix allows one to prevent unnecessary infrastructure change by setting the default repository id as well as any user created repository.


Checklist

I applicable, I acknowledge that I have:

  • Read the contributing guide
  • Ran terraform fmt on all modified files
  • Regenerated the relevant README.md files using tools/tfdoc.py
  • Made sure all relevant tests pass

Copy link

google-cla bot commented Jan 18, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

When docker repository is not specified by default docker repository
`projects/PROJECT_ID/locations/REGION/repositories/gcf-artifacts` is used.
In such a case, terraform plan always generates a difference for `docker_repository`
field as the module passes null value but the tfstate file has the above specified
default value. This fix allows one to prevent unnecessary infrastructure change when
using the default repository as well as any user created repository.
Copy link
Collaborator

@ludoo ludoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The permadiff should be fixed in the provider, as optional fields which are not specified should not generate a change once the resource is created.

Adding the variable to be able to use a non-default repository does of course make sense, thanks for this PR.

@ludoo ludoo enabled auto-merge (squash) January 20, 2024 09:30
@kumadee
Copy link
Contributor Author

kumadee commented Jan 20, 2024

The permadiff should be fixed in the provider, as optional fields which are not specified should not generate a change once the resource is created.

Adding the variable to be able to use a non-default repository does of course make sense, thanks for this PR.

Cool. I can raise the PR to fix the permadiff in the provider next week.

@ludoo
Copy link
Collaborator

ludoo commented Jan 20, 2024

Cool. I can raise the PR to fix the permadiff in the provider next week.

this would be great, thanks a lot! :)

@ludoo ludoo merged commit d62012c into GoogleCloudPlatform:master Jan 20, 2024
9 checks passed
kumadee added a commit to kumadee/magic-modules that referenced this pull request Jan 21, 2024
relates to GoogleCloudPlatform/cloud-foundation-fabric#1987
When docker repository is not specified by default docker repository`projects/PROJECT_ID/locations/REGION/repositories/gcf-artifacts` is used.In such a case, terraform plan always generates a difference for `docker_repository`field as the module passes null value but the tfstate file has the above specifieddefault value. This fix allows one to prevent unnecessary infrastructure change.
trodge pushed a commit to GoogleCloudPlatform/magic-modules that referenced this pull request Jan 22, 2024
…9850)

relates to GoogleCloudPlatform/cloud-foundation-fabric#1987
When docker repository is not specified by default docker repository`projects/PROJECT_ID/locations/REGION/repositories/gcf-artifacts` is used.In such a case, terraform plan always generates a difference for `docker_repository`field as the module passes null value but the tfstate file has the above specifieddefault value. This fix allows one to prevent unnecessary infrastructure change.
modular-magician added a commit to modular-magician/terraform-provider-google that referenced this pull request Jan 22, 2024
…ashicorp#9850)

relates to GoogleCloudPlatform/cloud-foundation-fabric#1987
When docker repository is not specified by default docker repository`projects/PROJECT_ID/locations/REGION/repositories/gcf-artifacts` is used.In such a case, terraform plan always generates a difference for `docker_repository`field as the module passes null value but the tfstate file has the above specifieddefault value. This fix allows one to prevent unnecessary infrastructure change.
[upstream:3540e663502c1286967dd61650bb8ee7c2b35cf9]

Signed-off-by: Modular Magician <magic-modules@google.com>
modular-magician added a commit to modular-magician/terraform-provider-google-beta that referenced this pull request Jan 22, 2024
…(#9850)

relates to GoogleCloudPlatform/cloud-foundation-fabric#1987
When docker repository is not specified by default docker repository`projects/PROJECT_ID/locations/REGION/repositories/gcf-artifacts` is used.In such a case, terraform plan always generates a difference for `docker_repository`field as the module passes null value but the tfstate file has the above specifieddefault value. This fix allows one to prevent unnecessary infrastructure change.
[upstream:3540e663502c1286967dd61650bb8ee7c2b35cf9]

Signed-off-by: Modular Magician <magic-modules@google.com>
modular-magician added a commit to hashicorp/terraform-provider-google that referenced this pull request Jan 22, 2024
…9850) (#17072)

relates to GoogleCloudPlatform/cloud-foundation-fabric#1987
When docker repository is not specified by default docker repository`projects/PROJECT_ID/locations/REGION/repositories/gcf-artifacts` is used.In such a case, terraform plan always generates a difference for `docker_repository`field as the module passes null value but the tfstate file has the above specifieddefault value. This fix allows one to prevent unnecessary infrastructure change.
[upstream:3540e663502c1286967dd61650bb8ee7c2b35cf9]

Signed-off-by: Modular Magician <magic-modules@google.com>
modular-magician added a commit to hashicorp/terraform-provider-google-beta that referenced this pull request Jan 22, 2024
…(#9850) (#6887)

relates to GoogleCloudPlatform/cloud-foundation-fabric#1987
When docker repository is not specified by default docker repository`projects/PROJECT_ID/locations/REGION/repositories/gcf-artifacts` is used.In such a case, terraform plan always generates a difference for `docker_repository`field as the module passes null value but the tfstate file has the above specifieddefault value. This fix allows one to prevent unnecessary infrastructure change.
[upstream:3540e663502c1286967dd61650bb8ee7c2b35cf9]

Signed-off-by: Modular Magician <magic-modules@google.com>
modular-magician added a commit to modular-magician/terraform-google-conversion that referenced this pull request Jan 22, 2024
…(#9850)

relates to GoogleCloudPlatform/cloud-foundation-fabric#1987
When docker repository is not specified by default docker repository`projects/PROJECT_ID/locations/REGION/repositories/gcf-artifacts` is used.In such a case, terraform plan always generates a difference for `docker_repository`field as the module passes null value but the tfstate file has the above specifieddefault value. This fix allows one to prevent unnecessary infrastructure change.
[upstream:3540e663502c1286967dd61650bb8ee7c2b35cf9]

Signed-off-by: Modular Magician <magic-modules@google.com>
modular-magician added a commit to GoogleCloudPlatform/terraform-google-conversion that referenced this pull request Jan 22, 2024
…(#9850) (#1889)

relates to GoogleCloudPlatform/cloud-foundation-fabric#1987
When docker repository is not specified by default docker repository`projects/PROJECT_ID/locations/REGION/repositories/gcf-artifacts` is used.In such a case, terraform plan always generates a difference for `docker_repository`field as the module passes null value but the tfstate file has the above specifieddefault value. This fix allows one to prevent unnecessary infrastructure change.
[upstream:3540e663502c1286967dd61650bb8ee7c2b35cf9]

Signed-off-by: Modular Magician <magic-modules@google.com>
tdbhacks pushed a commit to tdbhacks/magic-modules that referenced this pull request Feb 6, 2024
…oogleCloudPlatform#9850)

relates to GoogleCloudPlatform/cloud-foundation-fabric#1987
When docker repository is not specified by default docker repository`projects/PROJECT_ID/locations/REGION/repositories/gcf-artifacts` is used.In such a case, terraform plan always generates a difference for `docker_repository`field as the module passes null value but the tfstate file has the above specifieddefault value. This fix allows one to prevent unnecessary infrastructure change.
balanaguharsha pushed a commit to balanaguharsha/magic-modules that referenced this pull request May 2, 2024
…oogleCloudPlatform#9850)

relates to GoogleCloudPlatform/cloud-foundation-fabric#1987
When docker repository is not specified by default docker repository`projects/PROJECT_ID/locations/REGION/repositories/gcf-artifacts` is used.In such a case, terraform plan always generates a difference for `docker_repository`field as the module passes null value but the tfstate file has the above specifieddefault value. This fix allows one to prevent unnecessary infrastructure change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants