Difference between revisions of "Error: Reference to undeclared resource"
Jump to navigation
Jump to search
(Created page with " terraform plan ╷ │ Error: Reference to undeclared resource │ │ on main.tf line 9, in resource "aws_instance" "example": │ 9: ami...") |
|||
(12 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
[[terraform plan]] | [[terraform plan]] | ||
╷ | ╷ | ||
− | │ Error: Reference to undeclared resource | + | │ Error: Reference to [[undeclared resource]] |
│ | │ | ||
│ on main.tf line 9, in resource "aws_instance" "example": | │ on main.tf line 9, in resource "aws_instance" "example": | ||
│ 9: [[ami]] = data.aws_ami.windows.id | │ 9: [[ami]] = data.aws_ami.windows.id | ||
│ | │ | ||
− | │ A data resource "aws_ami" "windows" has not been declared in the root module. | + | │ A [[data resource]] "aws_ami" "windows" [[has not been declared in the root module]]. |
+ | |||
+ | |||
+ | ╷ | ||
+ | │ Error: Reference to undeclared resource | ||
+ | │ | ||
+ | │ on main.tf line 14, in resource "aws_db_instance" "my_mariadb_instance": | ||
+ | │ 14: [[db_subnet_group_name]] = vpc.subnet-0526dd2XXXXXX | ||
+ | │ | ||
+ | │ A [[managed resource]] "vpc" "subnet-0526dd2e6fce5492b" [[has not been declared in the root module]]. | ||
+ | ╵ | ||
+ | |||
+ | ╷ | ||
+ | │ Error: Reference to undeclared resource | ||
+ | │ | ||
+ | │ on main.tf line 16, in resource "aws_db_instance" "my_mariadb_instance": | ||
+ | │ 16: db_subnet_group_name = "${aws_db_subnet_group.default.id}" | ||
+ | │ | ||
+ | │ A managed resource "aws_db_subnet_group" "default" [[has not been declared in the root module]]. | ||
+ | ╵ | ||
+ | |||
+ | ╷ | ||
+ | │ Error: Reference to undeclared resource | ||
+ | │ | ||
+ | │ on main.tf line 42, in resource "[[aws_security_group]]" "allow_ssh": | ||
+ | │ 42: vpc_id = [[aws_vpc.main.id]] | ||
+ | │ | ||
+ | │ A managed resource "aws_vpc" "default" has not been declared in the root module. | ||
+ | ╵ | ||
+ | |||
+ | == Related == | ||
+ | * [[Terraform plan execution with errors]]: <code>[[Error: Reference to undeclared module]]</code> | ||
+ | * <code>[[Error: Unsupported attribute]]</code> | ||
+ | * <code>[[terraform import]]</code> | ||
+ | * <code>[[tolist]]</code> | ||
== See also == | == See also == |
Latest revision as of 11:27, 27 February 2023
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.
╷ │ Error: Reference to undeclared resource │ │ on main.tf line 14, in resource "aws_db_instance" "my_mariadb_instance": │ 14: db_subnet_group_name = vpc.subnet-0526dd2XXXXXX │ │ A managed resource "vpc" "subnet-0526dd2e6fce5492b" has not been declared in the root module. ╵
╷ │ Error: Reference to undeclared resource │ │ on main.tf line 16, in resource "aws_db_instance" "my_mariadb_instance": │ 16: db_subnet_group_name = "${aws_db_subnet_group.default.id}" │ │ A managed resource "aws_db_subnet_group" "default" has not been declared in the root module. ╵
╷ │ Error: Reference to undeclared resource │ │ on main.tf line 42, in resource "aws_security_group" "allow_ssh": │ 42: vpc_id = aws_vpc.main.id │ │ A managed resource "aws_vpc" "default" has not been declared in the root module. ╵
Related[edit]
- Terraform plan execution with errors:
Error: Reference to undeclared module
Error: Unsupported attribute
terraform import
tolist
See also[edit]
Advertising: