zealvora / kplabs-terraform-challenges

35 stars 188 forks source link

Challenge 1 - vscode error and Documentation for aws_eip resource is confusing #1

Open pranjal779 opened 5 months ago

pranjal779 commented 5 months ago

in this block:

resource "aws_eip" "kplabs_app_ip" {
  #   domain = "vpc"
  vpc = true # deprecated
}

according to the Documentation for aws_eip vpc = "true" is vpc - (Optional Deprecated) even the VSCode editor highlights it as Deprecated and the official Document suggests to use domain = "vpc" instead but upon run the command:

terraform plan

the CLI or the cmd will throw this error when vpc = "true" is commented

s\challenge-1>terraform plan

Error: "domain": this field cannot be set

  on tf-challenge-1.tf line 27, in resource "aws_eip" "kplabs_app_ip":
  27: resource "aws_eip" "kplabs_app_ip" {

but when domain = "vpc" is commented it runs fine: -1>terraform plan Refreshing Terraform state in-memory prior to plan... The refreshed state will . . . . . Plan: 1 to add, 0 to change, 0 to destroy.

pranjal779 commented 5 months ago

ok I think I understood the issue, i was not using the lastest version of the terraform using the latest version resloved the issue

pranjal779 commented 5 months ago

Same Issue with Challenge 2

2>terraform plan
╷
│ Error: "domain": this field cannot be set
│
│   with aws_eip.example,
│   on tf-challenge-2.tf line 60, in resource "aws_eip" "example":
│   60: resource "aws_eip" "example" {
│
╵