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

fix: permadiff issue when docker_repository field is not specified #9850

Merged
merged 1 commit into from
Jan 22, 2024

Conversation

kumadee
Copy link
Contributor

@kumadee kumadee commented Jan 21, 2024

When docker repository is not specified, by default docker repository projects/PROJECT_ID/locations/REGION/repositories/gcf-artifacts is used. Refer https://cloud.google.com/functions/docs/reference/rest/v2beta/projects.locations.functions#dockerregistry

In such a case, terraform plan always generates a difference for docker_repository field.

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 prevents unnecessary infrastructure change by setting the default repository id received from API.

Relates to GoogleCloudPlatform/cloud-foundation-fabric#1987

Release Note Template for Downstream PRs (will be copied)

Fixed an issue when `docker_repository` is not specified in build_config section of the `google_cloudfunctions2_function`, the provider should not generate a diff during plan for the default value used by the API.

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
Copy link
Collaborator

Hello! I am a robot. It looks like you are a: Community Contributor Googler Core Contributor. Tests will require approval to run.

@trodge, a repository maintainer, has been assigned to review your changes. If you have not received review feedback within 2 business days, please leave a comment on this PR asking them to take a look.

You can help make sure that review is quick by doing a self-review and by running impacted tests locally.

@modular-magician modular-magician added the awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests label Jan 21, 2024
@kumadee kumadee marked this pull request as ready for review January 22, 2024 13:22
@modular-magician modular-magician added service/cloudfunctions and removed awaiting-approval Pull requests that needs reviewer's approval to run presubmit tests labels Jan 22, 2024
@modular-magician
Copy link
Collaborator

Hi there, I'm the Modular magician. I've detected the following information about your changes:

Diff report

Your PR generated some diffs in downstreams - here they are.

Terraform GA: Diff ( 1 file changed, 1 insertion(+))
Terraform Beta: Diff ( 1 file changed, 1 insertion(+))

@modular-magician
Copy link
Collaborator

Tests analytics

Total tests: 14
Passed tests 13
Skipped tests: 1
Affected tests: 0

Click here to see the affected service packages
  • cloudfunctions2

$\textcolor{green}{\textsf{All tests passed in REPLAYING mode.}}$
View the build log

@trodge trodge merged commit 3540e66 into GoogleCloudPlatform:main Jan 22, 2024
14 checks passed
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.
pengq-google pushed a commit to pengq-google/magic-modules that referenced this pull request May 21, 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
3 participants