Terraform plan execution errors

From wikieduonline
Jump to navigation Jump to search

Error: Missing required argument

│ Error: Missing required argument
│
│   with module.compute.aws_instance.this[0],
│   on ../path/to/your/terraformodule.tf  line 1, in resource "aws_instance" "this":
│    1: resource "aws_instance" "this" {
│
│ "launch_template": one of `ami,instance_type,launch_template` must be specified


Error: Error in function call

│ Error: Error in function call
│
│   on ../path/to/your/terraformodule.tf line 7, in resource "aws_instance" "this":
│    7:   subnet_id = element(var.subnet_ids,count.index)
│     ├────────────────
│     │ count.index is 0
│     │ var.subnet_ids is empty list of string
│
│ Call to function "element" failed: cannot use element function with an empty list.
  • Solution: if your element if from type list make user provide values using proper format: [value1, value2]

Error: Invalid value for module argument

│ Error: Invalid value for module argument
│
│   on main.tf line 8, in module "yourModuleName":
│    8:   subnet_ids = var.subnet_id
│
│ The given value is not suitable for child module variable "subnet_ids" defined at
│ ../path/to/your/terraformodule.tf :79,1-22: list of string required.
  • Solution: if your element if from type list make user provide values using proper format: [value1, value2]

Error: undeclared resource

 terraform plan
╷
│ Error: Reference to undeclared resource
│
│   on main.tf line 9, in resource "aws_instance" "example":
│    9:   ami               = data.aws_ami.windows.id
│
│ A data resource "aws_ami" "windows" has not been declared in the root module.

No configuration files

terraform plan

Error: No configuration files 

Plan requires configuration to be present. Planning without a configuration
would mark everything for destruction, which is normally not what is desired.
If you would like to destroy everything, run plan with the -destroy option.
Otherwise, create a Terraform configuration file (.tf file) and try again.

Related terms

See also

Advertising: