terraform-google-modules/terraform-google-vm

Module for `instance_template` fails `terraform validate` in `v9.0.0` release

lhriley opened this issue · 2 comments

TL;DR

Module for instance_template fails terraform validate in v9.0.0 release.

Expected behavior

module passes terraform validate

Observed behavior

❯ terraform validate
╷
│ Error: Unsupported argument
│ 
│   on .terraform/modules/instance_template/modules/instance_template/main.tf line 168, in resource "google_compute_instance_template" "tpl":
│  168:     provisioning_model          = var.spot ? "SPOT" : null
│ 
│ An argument named "provisioning_model" is not expected here.
╵
╷
│ Error: Unsupported argument
│ 
│   on .terraform/modules/instance_template/modules/instance_template/main.tf line 169, in resource "google_compute_instance_template" "tpl":
│  169:     instance_termination_action = var.spot ? "STOP" : null
│ 
│ An argument named "instance_termination_action" is not expected here.

Terraform Configuration

module "instance_template" {
  source = "git::https://github.com/terraform-google-modules/terraform-google-vm.git//modules/instance_template?ref=v9.0.0"

  service_account = {
    email  = module.gcp_service_account.email
    scopes = ["cloud-platform"]
  }
}

Terraform Version

multiple versions:

❯ terraform version
Terraform v1.4.6
on linux_amd64
+ provider registry.terraform.io/hashicorp/google v3.90.1
+ provider registry.terraform.io/hashicorp/random v3.5.1
+ provider registry.terraform.io/hashicorp/template v2.2.0

Your version of Terraform is out of date! The latest version
is 1.5.6. You can update by downloading from https://www.terraform.io/downloads.html
❯ terraform version
Terraform v1.5.6
on linux_amd64
+ provider registry.terraform.io/hashicorp/google v3.90.1
+ provider registry.terraform.io/hashicorp/random v3.5.1
+ provider registry.terraform.io/hashicorp/template v2.2.0

Additional information

This is not an issue in the v8.0.1 release of the module.

I think #330 may resolve your issue. The problem is likely that the minimum version of the google plugin was set too low. I think you have two options:

  • run terraform init -upgrade
  • point your source to a pre-release of 10.0.0 and run terraform init

The 2nd solution would look like:

module "instance_template" {
  source = "git::https://github.com/terraform-google-modules/terraform-google-vm.git//modules/instance_template?ref=f067e54"
  ...

A quick scan of release notes for the provider plugin suggests this needs to read at least 4.30.0 for v9.0.0. #330 bumps that further to 4.67.0.

+ provider registry.terraform.io/hashicorp/google v3.90.1

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