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_compute_instance_template: Error: doesn't support update #7971

Closed
dpogorzelski opened this issue Dec 9, 2020 · 4 comments
Closed
Assignees
Labels

Comments

@dpogorzelski
Copy link

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

0.14.1

Affected Resource(s)

  • google_compute_instance_template

Terraform Configuration Files

resource "google_compute_instance_template" "test" {
  name_prefix = "${var.env}-${replace(var.role, "_", "-")}-"

  tags = [
    var.env,
  ]

  labels = {
    env      = var.env
  }

  machine_type = var.size

  scheduling {
    automatic_restart = true
  }

  disk {
    source_image = var.build != "" ? "aproject/test-${replace(var.role, "_", "-")}-${var.build}" : "aproject/test-${replace(var.role, "_", "-")}"
    auto_delete  = true
    boot         = true
    disk_type    = "pd-standard"
  }

  network_interface {
    network = var.vpc_name
    access_config {
      nat_ip = ""
    }
  }



  metadata = {
    role                         = var.role
    env                          = var.env
  }

  service_account {
    email = var.compute_service_account.email
    scopes = [
      "cloud-platform",
    ]
  }

  lifecycle {
    create_before_destroy = true
  }
}

Debug Output

  # module.mymodule.google_compute_instance_template.test will be updated in-place
  ~ resource "google_compute_instance_template" "test" {
        id                   = "projects/arpoject/global/instanceTemplates/myenv-myservice-20201208204739443400000010"
        name                 = "myenv-myservice-20201208204739443400000010"
        tags                 = [
            "myenv",
        ]
        # (12 unchanged attributes hidden)




        # (4 unchanged blocks hidden)
    }

...........

Error: doesn't support update

Expected Behavior

When running consecutive apply/plan steps there should be no diff

Actual Behavior

An attempt to "update" the template is performed even though there are no changes to the template.
The second issue with this is that templates cannot be updated, new one should be created instead.

Steps to Reproduce

  1. terraform apply
  2. terraform apply
@ghost ghost added the bug label Dec 9, 2020
@edwardmedia edwardmedia self-assigned this Dec 9, 2020
@edwardmedia
Copy link
Contributor

edwardmedia commented Dec 9, 2020

@dawidpogorzelski this is by design. GCP API does not support update. Please close the issue if this makes sense to you

@dpogorzelski
Copy link
Author

dpogorzelski commented Dec 9, 2020

Well there's 2 issue with the above code,
first that there is a change detected even tho there was no change made but somehow the resource is marked to be updated.
The second is that the provider attempts to update the resource in place even tho the api doesn't allow it. the google provider should destroy and recreate the resource, that's how it used to be prior to 0.14.0. This issue only happens from terraform 0.14.0 on

@ghost ghost removed the waiting-response label Dec 9, 2020
@edwardmedia
Copy link
Contributor

@dawidpogorzelski oh I see. Probably there is not much we can do with it within the provider plugin. Mind file an issue with Terraform against 0.14.0 instead?

@ghost
Copy link

ghost commented Jan 9, 2021

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Jan 9, 2021
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