terraform-google-modules / terraform-google-bastion-host

Generates a bastion host VM compatible with OS Login and IAP Tunneling that can be used to access internal VMs
https://registry.terraform.io/modules/terraform-google-modules/bastion-host/google
Apache License 2.0
128 stars 92 forks source link

Add variable allow_stopping_for_update #111

Open intotecho opened 2 years ago

intotecho commented 2 years ago

TL;DR

So when terraform updates the host, say with a new startup script. terraform apply won't fail with

Error: Changing the machine_type, min_cpu_platform, service_account, enable_display, shielded_instance_config, scheduling.node_affinities or network_interface.[#d].(network/subnetwork/subnetwork_project) or advanced_machine_features on a started instance requires stopping it. To acknowledge this, please set allow_stopping_for_update = true in your config. You can also stop it by setting desired_status = "TERMINATED", but the instance will not be restarted after the update.

Terraform Resources

No response

Detailed design

No response

Additional information

No response

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

stevereaver commented 2 years ago

This would actually be pretty easy to implement, but what would be the point ? The instance would not start itself back up resulting in you having to go into the project and re-start it yourself anyway. It might be better to use metadata_startup_script for the startup script that way it will destroy the instance and recreate it from scratch leaving you with a running instance. But that would lead to other requirements.....

g-awmalik commented 2 years ago

I think adding a var to set allow_stopping_for_update is reasonable for this use case. Also, we encourage PRs if you're able to create one and I'll be happy to review it for you.