Skip to content

Instantly share code, notes, and snippets.

@tanmay-bhat
Last active June 7, 2022 15:41
Show Gist options
  • Save tanmay-bhat/01da4cc02086b3461db72ba3504e4ac1 to your computer and use it in GitHub Desktop.
Save tanmay-bhat/01da4cc02086b3461db72ba3504e4ac1 to your computer and use it in GitHub Desktop.
Jotting down some common terraform error messages one might encounter in their terraform journey.

Jotting down some common terraform error messages one might encounter in their terraform journey.


│   on main.tf line xxx, in resource "google_compute_global_address" "xxx":
│  region = "us-central1"
│ 
│ An argument named "region" is not expected here.

Solution : there isn't an argument called region for this resource. Remove that and the problem is resolved. Global IP is not bound to an region.


│   on main.tf line 182, in resource "google_compute_firewall" "allow-health-check":
│  182:     port_range = "80"
│ 
│ An argument named "port_range" is not expected here.

Solution :

There isn't an argumemnt named port_range. If you want to specify which port to open, then the block looks like below :

  allow {
        protocol = "tcp"
        ports    = ["80"]
    }

│ Error: Unsupported argument
│ 
│   on main.tf line 169, in resource "google_compute_instance_group_manager" "lb-backend-group":
│  169:     instance_template = google_compute_instance_template.lb-backend-template.self_link
│ 
│ An argument named "instance_template" is not expected here.

Solution :

You cant directly define tthe argment : instance_template. It has to be nested inside version,like beloow :

    version {
        instance_template = google_compute_instance_template.lb-backend-template.self_link
        name = "backend-servers"
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment