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_group_manager fails with stateful_external_ip and stateful_internal_ip #13735

Closed
Assignees
Labels
bug forward/review In review; remove label to forward service/compute-managed

Comments

@amit-dube-b24
Copy link

amit-dube-b24 commented Feb 14, 2023

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 version
Terraform v1.3.7

Affected Resource(s)

  • google_compute_instance_group_manager

Terraform Configuration Files

resource "google_compute_instance_group_manager" "mig" {
  provider = google-beta
  name     = "mig"

  project = ******

  base_instance_name = "app"
  zone = "europe-west3-a"

  version {
    name              = "version-1"
    instance_template = google_compute_instance_template.template.id. // this exist and has default network attached.
  }
  target_size = 2

  named_port {
    name = "http"
    port = 80
  }
  named_port {
    name = "https"
    port = 443
  }

  stateful_external_ip {
    delete_rule    = "ON_PERMANENT_INSTANCE_DELETION"
    interface_name = "default"
  }

  stateful_internal_ip {
    delete_rule    = "ON_PERMANENT_INSTANCE_DELETION"
    interface_name = "default"
  }
}

Debug Output

│ Error: Error updating managed group instances: googleapi: Error 400: Invalid value for field 'resource.versions[0].instanceTemplate': ''. Network interface [default] does not exist in the instance template shop-template., invalid

│ with module.mig[0].google_compute_instance_group_manager.mig,
│ on mig/mig.tf line 1, in resource "google_compute_instance_group_manager" "mig":
│ 1: resource "google_compute_instance_group_manager" "mig" {

Panic Output

│ Error: Error updating managed group instances: googleapi: Error 400: Invalid value for field 'resource.versions[0].instanceTemplate': ''. Network interface [default] does not exist in the instance template shop-template., invalid

│ with module.mig[0].google_compute_instance_group_manager.mig,
│ on mig/mig.tf line 1, in resource "google_compute_instance_group_manager" "mig":
│ 1: resource "google_compute_instance_group_manager" "mig" {

Expected Behavior

Terraform should apply successfully.

Actual Behavior

│ Error: Error updating managed group instances: googleapi: Error 400: Invalid value for field 'resource.versions[0].instanceTemplate': ''. Network interface [default] does not exist in the instance template shop-template., invalid

│ with module.mig[0].google_compute_instance_group_manager.mig,
│ on mig/mig.tf line 1, in resource "google_compute_instance_group_manager" "mig":
│ 1: resource "google_compute_instance_group_manager" "mig" {

Steps to Reproduce

create an instance template and add reference to that instance template.

1. terraform init
2. terraform apply

Important Factoids

References

  • #0000
@edwardmedia
Copy link
Contributor

edwardmedia commented Feb 15, 2023

@amit-dube-b24 help me to understand why the failure is linked to stateful_external_ip and stateful_internal_ip? Below is the error I refer to and seems different

Error: Error updating managed group instances: googleapi: Error 400: Invalid value for field 'resource.versions[0].instanceTemplate': ''. Network interface [default] does not exist in the instance template shop-template., invalid

@hao-nan-li
Copy link
Collaborator

I remember seeing in the design doc that the default value for interface_name should be "nic0". If that solves your problem we should probably update the doc.

@edwardmedia
Copy link
Contributor

#13961

@edwardmedia
Copy link
Contributor

@amit-dube-b24 using below config, it is fine with me. Can't repro your issue. Can you try?

resource "google_compute_target_pool" "igm-basic" {
  description      = "Resource created for Terraform acceptance testing"
  name             = "issue13961"
  session_affinity = "CLIENT_IP_PROTO"
}

resource "google_compute_instance_group_manager" "igm-basic" {
  description = "Terraform test instance group manager"
  name        = "issue13961"
  version {
    instance_template = google_compute_instance_template.igm-basic.self_link
    name              = "prod"
  }
  target_pools       = [google_compute_target_pool.igm-basic.self_link]
  base_instance_name = "tf-test-igm-basic"
  zone               = "us-central1-c"
  target_size        = 2
  stateful_disk {
    device_name = "my-stateful-disk"
    delete_rule = "ON_PERMANENT_INSTANCE_DELETION"
  }
  stateful_internal_ip {
    interface_name = "nic0"
    delete_rule = "ON_PERMANENT_INSTANCE_DELETION"
  }

  stateful_external_ip {
    interface_name = "nic0"
    delete_rule = "NEVER"
  }
}

@hao-nan-li
Copy link
Collaborator

I'm going to update the doc for what to put in the stateful_external_ip interface_name to make things clear.

@github-actions
Copy link

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 16, 2023
@github-actions github-actions bot added forward/review In review; remove label to forward service/compute-managed labels Jan 14, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.