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

google_cloudbuild_worker_pool is claiming "forces replacement" repeatedly when network_config is unspecified #11194

Closed
gecko655 opened this issue Mar 1, 2022 · 3 comments
Labels

Comments

@gecko655
Copy link

gecko655 commented Mar 1, 2022

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to the 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 to hashibot, a community member has claimed the issue already.

Terraform Version

❯ terraform -v
Terraform v1.1.6
on darwin_amd64
+ provider registry.terraform.io/hashicorp/google v4.12.0
+ provider registry.terraform.io/hashicorp/google-beta v4.12.0
+ provider registry.terraform.io/hashicorp/null v3.1.0
+ provider registry.terraform.io/hashicorp/random v3.1.0

Affected Resource(s)

  • google_cloudbuild_worker_pool

Terraform Configuration Files

resource "google_cloudbuild_worker_pool" "pool" {
  name     = "gecko655-test-pool"
  location = "asia-northeast1"
  worker_config {
    disk_size_gb   = 100
    machine_type   = "e2-highcpu-8"
    no_external_ip = false
  }
}

Debug Output

https://gist.github.com/gecko655/9b69b16e369ddd1b27c68a0c321de7c1

Panic Output

N/A

Expected Behavior

Once terraform apply is done, google_cloudbuild_worker_pool will never output "forces replacement" when terraform plan

Actual Behavior

After terraform apply is done, google_cloudbuild_worker_pool continuously output "forces replacement" when terraform plan.

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
-/+ destroy and then create replacement

Terraform will perform the following actions:

  # google_cloudbuild_worker_pool.pool must be replaced
-/+ resource "google_cloudbuild_worker_pool" "pool" {
      - annotations = {} -> null
      ~ create_time = "2022-03-01T04:38:20.566133700Z" -> (known after apply)
      + delete_time = (known after apply)
      ~ id          = "projects/[project_id]/locations/asia-northeast1/workerPools/gecko655-test-pool" -> (known after apply)
        name        = "gecko655-test-pool"
      ~ project     = "[project_id]" -> (known after apply)
      ~ state       = "RUNNING" -> (known after apply)
      ~ uid         = "6b2507db-511b-43b1-9e83-d69332794267" -> (known after apply)
      ~ update_time = "2022-03-01T04:38:20.566133700Z" -> (known after apply)
        # (1 unchanged attribute hidden)

      - network_config { # forces replacement}

        # (1 unchanged block hidden)
    }

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

Steps to Reproduce

  1. terraform apply
  2. terraform plan

Important Factoids

After terraform apply is done, terraform state show shows:

❯ terraform state show google_cloudbuild_worker_pool.pool
# google_cloudbuild_worker_pool.pool:
resource "google_cloudbuild_worker_pool" "pool" {
    create_time = "2022-03-01T04:30:57.846121048Z"
    id          = "projects/[project_id]/locations/asia-northeast1/workerPools/gecko655-test-pool"
    location    = "asia-northeast1"
    name        = "gecko655-test-pool"
    project     = "[project_id]"
    state       = "RUNNING"
    uid         = "1dea1eaf-145f-4c64-b815-4432273dbfd3"
    update_time = "2022-03-01T04:30:57.846121048Z"

    network_config {}

    worker_config {
        disk_size_gb   = 100
        machine_type   = "e2-highcpu-8"
        no_external_ip = false
    }
}

Google provider official document says network_config.peered_network is required when network_config is specified.
The state looks strange considering this.

Google Cloud official document says:

If you don't specify a value (of PEERED_NETWORK), Cloud Build uses the service provider network.

So, when network_config is left unspecified, I suspect the provider have to let it unspecified.

This behavior is observed on terraform google provider v4.12.0. (Released today)
This is NOT reproduced on terraform google provider v4.11.0.

References

  • No relevant issue
@gecko655 gecko655 added the bug label Mar 1, 2022
@gecko655 gecko655 changed the title google_cloudbuild_worker_pool is claiming "forces replacement" when network_config is unspecified google_cloudbuild_worker_pool is claiming "forces replacement" repeatedly when network_config is unspecified Mar 1, 2022
@slevenick
Copy link
Collaborator

I believe this is fixed in the newest unreleased version of the provider. I thought that it wasn't going to be included in 4.12.0, but it should be fixed once 4.13.0 goes out. I would recommend downgrading until then

Fixed by: GoogleCloudPlatform/magic-modules#5762

@gecko655
Copy link
Author

gecko655 commented Mar 8, 2022

I confirmed that this issue is fixed as of https://github.com/hashicorp/terraform-provider-google/releases/tag/v4.13.0 . Thank you!

@gecko655 gecko655 closed this as completed Mar 8, 2022
@github-actions
Copy link

github-actions bot commented Apr 8, 2022

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants