Terraform Error: Warning: Value for undeclared variable

Error

C:\Users\Rajesh Kumar\Desktop\Terarform\ws>terraform plan
╷
│ Warning: Value for undeclared variable
│
│ The root module does not declare a variable named "mytags" but a value was found in file "terraform.tfvars". If you
│ meant to use this value, add a "variable" block to the configuration.
│
│ To silence these warnings, use TF_VAR_... environment variables to provide certain "global" settings to all
│ configurations in your organization. To reduce the verbosity of these warnings, use the -compact-warnings option.
╵
╷
│ Error: Reference to undeclared input variable
│
│   on main.tf line 7, in resource "aws_instance" "dbserver":
│    7:     Name = var.mytags
│
│ An input variable with the name "mytags" has not been declared. This variable can be declared with a variable
│ "mytags" {} block.
╵

Solution

Make sure you declare variable

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x