Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Unsupported argument output

I have the next config.

main.tf

./modules/vpc

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

vpc.tf

./modules/compute_engine

ce.tf

on main I have

module "vpc" {
  source = "./modules/vpc"
}

module "compute_engine_controller" {
  source = "./modules/compute_engine"
  vpc_name = module.vpc.vpc_network_name
}

on vpc I have

output "vpc_network_name" {
  value = google_compute_network.vpc_network.name
}

on ce I have

resource "google_compute_instance" "controller" {
...
  network_interface {
    network = var.vpc_name
  }
...
}

I get an error

│ Error: Unsupported argument

│ on main.tf line 34, in module "compute_engine_controller":
│ 34: vpc_name = module.vpc.vpc_network_name

│ An argument named "vpc_name" is not expected here.

why?

>Solution :

Since the module is complaining about not expecting an argument called vpc_name, that means that the corresponding variable has not been defined in the variables.tf of the module. To fix this, what needs to be added is:

variable "vpc_name" {
  type        = string
  description = "The name of the VPC to be used."
}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading