Após migrar para o Terraform Cloud, estou recebendo este erro ao executar "terraform apply".
remote-state.tf
# Using a single workspace:
terraform {
backend "remote" {
hostname = "app.terraform.io"
organization = "grgouveia"
workspaces {
name = "aws-grgouvei"
}
}
}
main.tf
# Configure the AWS Provider
provider "aws" {
version = "~> 2.0"
region = "sa-east-1"
}
provider "aws" {
alias = "us-east-1"
version = "~> 2.0"
region = "us-east-1"
}
resource "aws_s3_bucket" "dip" {
bucket = "grgouveia-dip"
acl = "private"
tags = {
Name = "dip"
}
}
resource "aws_instance" "k8s-master" {
ami = "${var.amis["sa-east-1"]}"
instance_type = "t2.micro"
# each region must have its own key pairs
key_name = "${var.key_name}"
tags = {
Name = "k8s-master"
}
# Bind ssh security group refering the security group name's variable "allow-ssh"
vpc_security_group_ids = ["${aws_security_group.allow-ssh.id}"]
depends_on = ["aws_s3_bucket.dip", "aws_dynamodb_table.dynamodb-homologation"]
}
resource "aws_instance" "worker-nodes" {
count = 2
ami = "${var.amis["sa-east-1"]}"
instance_type = "t2.micro"
# each region must have its own key pairs
key_name = "${var.key_name}"
tags = {
Name = "node${count.index}"
}
# Bind ssh security group refering the security group name's variable "allow-ssh"
vpc_security_group_ids = ["${aws_security_group.allow-ssh.id}"]
depends_on = ["aws_s3_bucket.dip"]
}
resource "aws_instance" "ansible" {
provider = "aws.us-east-1"
ami = "${var.amis["us-east-1"]}"
instance_type = "t2.micro"
# each region must have its own key pairs
key_name = "${var.key_name}"
tags = {
Name = "ansible"
}
# Bind ssh security group refering the security group name's variable "allow-ssh"
vpc_security_group_ids = ["${aws_security_group.allow-ssh-us-east-1.id}"]
depends_on = ["aws_s3_bucket.dip"]
}
resource "aws_dynamodb_table" "dynamodb-homologation" {
name = "DIP"
billing_mode = "PAY_PER_REQUEST"
hash_key = "UserId"
range_key = "GameTitle"
attribute {
name = "UserId"
type = "S"
}
attribute {
name = "GameTitle"
type = "S"
}
attribute {
name = "TopScore"
type = "N"
}
ttl {
attribute_name = "TimeToExist"
enabled = false
}
global_secondary_index {
name = "GameTitleIndex"
hash_key = "GameTitle"
range_key = "TopScore"
write_capacity = 10
read_capacity = 10
projection_type = "INCLUDE"
non_key_attributes = ["UserId"]
}
tags = {
Name = "dynamodb-dip-1"
}
}
outputs.tf
output "k8s-master-ip" {
value = "${aws_instance.k8s-master.public_ip}"
}
output "node1-ip" {
value = "${aws_instance.worker-nodes[0].public_ip}"
}
output "node2-ip" {
value = "${aws_instance.worker-nodes[1].public_ip}"
}
output "ansible-ip" {
value = "${aws_instance.ansible.public_ip}"
}
vars.tf
output "k8s-master-ip" {
value = "${aws_instance.k8s-master.public_ip}"
}
output "node1-ip" {
value = "${aws_instance.worker-nodes[0].public_ip}"
}
output "node2-ip" {
value = "${aws_instance.worker-nodes[1].public_ip}"
}
output "ansible-ip" {
value = "${aws_instance.ansible.public_ip}"
}