Ao realizar uma alteração onde foi acrescentado um novo Bucket, ao executar o comando terraform plan apresenta a mensagem (The argument "region" is required, but was not set.) conforme abaixo:
Waiting for the plan to start...
Terraform v0.14.4
Configuring remote state backend...
Initializing Terraform configuration...
Error: Missing required argument
The argument "region" is required, but was not set.
TENTATIVA
- adicionei a tag provider = aws.us-east-1 nos demais resource, mas não resolveu.
OBSERVAÇÕES
- Quando eu executava o comando "terraform plan" com o stage local ele pedia a região, eu colocava e rodava perfeito, depois que começamos a usar o stage remote que apresentou esses problemas.
- Erros apresentados após inclusão de resource com outro provider
ABAIXO main.cf
provider "aws" {
alias = "us-east-1"
region = "us-east-1"
}
provider "aws" {
alias = "us-east-2"
region = "us-east-2"
}
resource "aws_instance" "dev" {
count = 2
ami = "ami-00ddb0e5626798373"
instance_type = "t2.micro"
key_name = "terraform-aws"
tags = {
Name = "dev${count.index}"
}
vpc_security_group_ids = [aws_security_group.acess_ssh.id]
}
resource "aws_instance" "dev3" {
ami = "ami-00ddb0e5626798373"
instance_type = "t2.micro"
key_name = "terraform-aws"
tags = {
Name = "dev3"
}
vpc_security_group_ids = [aws_security_group.acess_ssh.id]
depends_on = [aws_s3_bucket.dev3]
}
resource "aws_instance" "dev4" {
provider = aws.us-east-2
ami = "ami-01aab85a5e4a5a0fe"
instance_type = "t2.micro"
key_name = "terraform-aws"
tags = {
Name = "dev4"
}
vpc_security_group_ids = [aws_security_group.acess_ssh_us_east_2.id]
depends_on = [aws_dynamodb_table.dynamodb-homologacao]
}
resource "aws_s3_bucket" "dev3" {
bucket = "rmerceslabs-dev3"
acl = "private"
tags = {
Name = "rmerceslabs-dev1"
}
}
resource "aws_s3_bucket" "homologacao" {
bucket = "rmerceslabs-homologacao"
acl = "private"
tags = {
Name = "rmerceslabs-homologacao"
}
}
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"
}
}