Venho tentando e rachando a cabeça mas não saio do lugar. Alguma alma boa para me ajudar com isso?
Error: Error launching source instance: InvalidAMIID.NotFound: The image id '[ami-00399ec92321828f5]' does not exist
│ status code: 400, request id: ba146e1d-fc43-412e-b311-c118770ea963
│
│ with aws_instance.dev6,
│ on main.tf line 44, in resource "aws_instance" "dev6":
│ 44: resource "aws_instance" "dev6" {
│
╵
╷
│ Error: Error creating Security Group: InvalidGroup.Duplicate: The security group 'acesso-ssh' already exists for VPC 'vpc-f25bc48f'
│ status code: 400, request id: 93de3c99-1a44-4075-bb2e-69b78655a805
│
│ with aws_security_group.acesso-ssh,
│ on security-group.tf line 1, in resource "aws_security_group" "acesso-ssh":
│ 1: resource "aws_security_group" "acesso-ssh" {
│
╵
main.tf
provider "aws" {
version = "~> 2.0"
region = "us-east-1"
}
provider "aws" {
alias = "us-east-2"
version = "~> 2.0"
region = "us-east-1"
}
resource "aws_instance" "dev" {
count = 3
ami = "ami-09e67e426f25ce0d7"
instance_type = "t2.micro"
key_name = "terraform-aws1"
tags = {
Name = "dev${count.index}"
}
vpc_security_group_ids = ["${aws_security_group.acesso-ssh.id}"]
}
resource "aws_instance" "dev4" {
ami = "ami-09e67e426f25ce0d7"
instance_type = "t2.micro"
key_name = "terraform-aws1"
tags = {
Name = "dev4"
}
vpc_security_group_ids = ["${aws_security_group.acesso-ssh.id}"]
depends_on = [aws_s3_bucket.dev4]
}
resource "aws_instance" "dev5" {
ami = "ami-09e67e426f25ce0d7"
instance_type = "t2.micro"
key_name = "terraform-aws1"
tags = {
Name = "dev5"
}
vpc_security_group_ids = ["${aws_security_group.acesso-ssh.id}"]
}
resource "aws_instance" "dev6" {
provider = "aws.us-east-2"
ami = "ami-00399ec92321828f5"
instance_type = "t2.micro"
key_name = "terraform-aws1"
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 = "igorp-dev4"
acl = "private"
tags = {
"Name" = "igorp-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"
}
}
security-group.tf
resource "aws_security_group" "acesso-ssh" {
name = "acesso-ssh"
description = "acesso-ssh"
ingress {
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["189.100.69.40/32"]
}
tags = {
Name = "ssh"
}
}
resource "aws_security_group" "acesso-ssh-us-east-2" {
provider = "aws.us-east-2"
name = "acesso-ssh"
description = "acesso-ssh"
ingress {
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["189.100.69.40/32"]
}
tags = {
Name = "ssh"
}
}