Created
October 9, 2019 15:00
-
-
Save agarat/752edfc0b61d1c8d6320e813a78dbebf to your computer and use it in GitHub Desktop.
Simple managed instance group definition
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| resource "google_compute_instance_template" "template" { | |
| name_prefix = "my-template-" | |
| machine_type = "n1-standard-1" | |
| region = "us-central1" | |
| scheduling { | |
| automatic_restart = true | |
| on_host_maintenance = "MIGRATE" | |
| } | |
| disk { | |
| disk_type = "pd-standard" | |
| source_image = "centos-7-v20190619" | |
| disk_size_gb = "100gb" | |
| } | |
| } | |
| resource "google_compute_region_instance_group_manager" "mig" { | |
| name = "my-mig" | |
| base_instance_name = "mig-instance" | |
| instance_template = google_compute_instance_template.template.self_link | |
| region = "us-central1" | |
| target_size = 5 | |
| wait_for_instances = true | |
| timeouts { | |
| create = "15m" | |
| update = "15m" | |
| } | |
| } |
Author
sir, A facing with below error if I ran the script
on main.tf line 30, in resource "google_compute_region_instance_group_manager" "mig":
30: instance_template = google_compute_instance_template.template.self_linkAn argument named "instance_template" is not expected here.
Hi! This gist is almost two years old, so it's probable that the arguments of the module have changed from that time to now. I would suggest taking a look at the most recent documentation for the module. Here's a link with an example you can use to adapt the code: https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_region_instance_group_manager#example-usage-with-top-level-instance-template-google-provider
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
sir, A facing with below error if I ran the script
on main.tf line 30, in resource "google_compute_region_instance_group_manager" "mig":
30: instance_template = google_compute_instance_template.template.self_link
An argument named "instance_template" is not expected here.