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

Missing allow_stopping_for_update into google_compute_instance_template #1768

Closed
Maxime-SIQUIER opened this issue Jul 13, 2018 · 5 comments
Closed

Comments

@Maxime-SIQUIER
Copy link

Terraform Version

Terraform v0.10.7
+ provider-google-version 1.16.0

Affected Resource(s)

  • google_compute_instance_template

Terraform Configuration Files

resource "google_compute_instance_template" "openshift_node" {
  name_prefix               = "${var.stack_name}-ose3-${var.cluster_name}-${var.node_name_suffix}"
  region                    = "${var.gce_region}"
  machine_type              = "${var.node_flavor_name}"
  min_cpu_platform          = "${var.node_min_cpu_platform}"

  scheduling {
    automatic_restart = "${lookup(var.preemptible_auto_restart, var.node_is_preemptible)}"
    preemptible       = "${lookup(var.true_false, var.node_is_preemptible)}"
  }

  disk {
    disk_type    = "${var.node_disk_type}"
    source_image = "${var.node_image_id}"
    boot         = true
    disk_size_gb = "${var.node_disk_size}"
  }

  network_interface {
    # Providing both ID's (network together with subnetwork) is not supported.
    # Giving subnetwork a higher precedence.
    network = "${var.subnetwork_id == "" ? var.network_id : ""}"

    subnetwork         = "${var.subnetwork_id}"
    subnetwork_project = "${var.subnetwork_project}"
  }

  metadata {
    "stackname"      = "${var.stack_name}"
    "host-type"      = "node"
    "env-host-type"  = "${var.stack_name}-openshift-${var.node_subtype}"
    "sub-host-type"  = "compute"
    "is-preemptible" = "${lookup(var.yes_no, var.node_is_preemptible)}"
    "clusterid"      = "${var.stack_name}-${var.cluster_name}"
    "consul_ready"   = "${var.consul_ready}"
  }

  # This section might be updated soon on openshift-ansible
  # Tags are used by openshift-ansible on GCE (not byo mode)
  tags = [
    "${var.cluster_tag}",
    "${local.nodetype_id}",
    "host-type-node",
    "sub-host-type-compute",
    "${var.stack_name}-${var.cluster_name}-${local.role}-${var.node_subtype_name}",
    "${var.stack_name}",
  ]

  metadata {
    startup-script = "${data.template_file.openshift_node_user_data.rendered}"
  }

  service_account {
    email  = "${var.service_account_email}"
    scopes = ["useraccounts-ro", "compute-rw", "storage-rw", "logging-write", "monitoring-write", "service-management", "service-control"]
  }

  # 1 if number of nodes > 0, otherwise 0
  count = "${var.node_count > 0 ? 1 : 0}"

  lifecycle {
    create_before_destroy = true
  }

  allow_stopping_for_update = true
}

Debug Output

N/A

Panic Output

N/A

Expected Behavior

I should be able to set allow_stopping_for_update into google_compute_instance_template

Actual Behavior

I am not able to set allow_stopping_for_update into google_compute_instance_template and it generate the follwing error when I perform a terraform validate :

Errors:

  * module.ext-a.module.minions-compute.google_compute_instance_template.openshift_node: : invalid or unknown key: allow_stopping_for_update

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform validate

Important Factoids

N/A

References

I think that the bug has been introduced with the following PR : #1005

@paddycarver
Copy link
Contributor

Hi @Maxime-SIQUIER, just to check, have you ever been able to use this field with google_compute_instance_template? #1005 only affects google_compute_instance, as far as I can tell.

And because this isn't an API feature, but a Terraform behaviour toggle, I'm not sure what you're asking for here. Instance Templates can't be stopped. Can you talk about a workflow you'd like enabled that currently isn't possible?

@Maxime-SIQUIER
Copy link
Author

Hi @paddycarver,

First of all thanks for the quick answer.

No it has never worked for sure but I expected it to work when I started to think about to implement it following the management of the min CPU platform.

My problem is that I manage all my instance thanks to the template feature, and since I have added the min_cpu_platform, I would like to ensure that user understand that an update of this variable will lead to a reboot of the VM by forcing them to set it at true. As from my understanding but maybe I am wrong, with #1005 we are removing the ForceNew on min_cpu_platform to just a stop/update/reboot if we set the allow_stopping_for_update to true but with the google_compute_instance_template if I update my min_cpu_platform it will lead to a forceNew and I will not be able to benefit of the what I will call soft-update. Am i right ? And does my explanation is clear enough ? I am a little bit quite new on this... ^^"

@paddycarver
Copy link
Contributor

Hi @Maxime-SIQUIER, how are you turning instance templates into instances? Managed instance groups? compute_instance_from_template? #1005 seems unrelated, and is just where this feature was introduced for google_compute_instance, but that doesn't interact with templates at all. Instance templates can't be updated--it's an API limitation--so any change to an instance template must always be ForceNew. There's no such thing as an update to an instance template, soft or not. There's only replacing it.

@Maxime-SIQUIER
Copy link
Author

Understood and agreed.

@ghost
Copy link

ghost commented Nov 17, 2018

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 and limited conversation to collaborators Nov 17, 2018
@ghost ghost removed the waiting-response label Nov 17, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants