Bom dia!
Estou com o seguinte problema...
Terraform 0.13 and earlier allowed provider version constraints inside the provider configuration │ block, but that is now deprecated and will be removed in a future version of Terraform. To│ silence this warning, move the provider version constraint into the required_providers block.│ │ (and one more similar warning elsewhere) ╵ ╷ │ Warning: Quoted references are deprecated │ │ on main.tf line 54, in resource "aws_instance" "dev6": │ 54: provider = "aws.us-east-2" │ │ In this context, references are expected literally rather than in quotes. Terraform 0.11 and│ earlier required quotes, but quoted references are now deprecated and will be removed in a future │ version of Terraform. Remove the quotes surrounding this reference to silence this warning.│ │ (and 3 more similar warnings elsewhere) ╵ ╷ │ Error: Invalid quoted type constraints │ │ on vars.tf line 2, in variable "amis": │ 2: type = "map" │ │ Terraform 0.11 and earlier required type constraints to be given in quotes, but that form is now│ deprecated and will be removed in a future version of Terraform. Remove the quotes around "map"│ and write map(string) instead to explicitly indicate that the map elements are strings.
main.tf
provider "aws" { version = "~> 2.0" region = "us-east-1" }
provider "aws" { alias = "us-east-2" version = "~> 2.0" region = "us-east-2" }
resource "aws_instance" "dev" { count = 3 ami = "ami-026c8acd92718196b" instance_type = "t2.micro" key_name = "terraform-aws" tags = { Name = "dev${count.index}" } vpc_security_group_ids = ["sg-000e7dbfa4e45f7b4"] }
resource "aws_instance" "dev4" { ami = "ami-026c8acd92718196b" instance_type = "t2.micro" key_name = "terraform-aws" tags = { Name = "dev4" } vpc_security_group_ids = ["sg-000e7dbfa4e45f7b4"] depends_on = [aws_s3_bucket.dev4]
}
resource "aws_instance" "dev5" { ami = var.amis["us-east-1"] instance_type = "t2.micro" key_name = "terraform-aws" tags = { Name = "dev5" } vpc_security_group_ids = ["${aws_security_group.acesso-ssh.id}"] }
resource "aws_instance" "dev6" { provider = "aws.us-east-2" ami = var.amis["us-east-2"] instance_type = "t2.micro" key_name = "terraform-aws" tags = { Name = "dev6" } vpc_security_group_ids = ["${aws_security_group.acesso-ssh-us-east-2.id}"] depends_on = ["aws_dynamodb_table.dynamodb-homologacao"] }
resource "aws_s3_bucket" "dev4" { bucket = "alevatolabs-dev4" acl = "private"
tags = { Name = "My bucket" Environment = "alevatolabs-dev4" } }
resource "aws_dynamodb_table" "dynamodb-homologacao" { provider = "aws.us-east-2" name = "GameScores" billing_mode = "PAY_PER_REQUEST" hash_key = "UserId" range_key = "GameTitle"
attribute { name = "UserId" type = "S" }
attribute { name = "GameTitle" type = "S" } }
vars.tf
variable "amis" { type = "map"
default = {
"us-east-1" = "ami-026c8acd92718196b"
"us-east-2" = "ami-002068ed284fb165b"
}
}