diff --git a/README.md b/README.md index b15bc89..32f6b8f 100644 --- a/README.md +++ b/README.md @@ -4,4 +4,5 @@ Módulo para criação do ambiente sugerido pelo professor # TODO ( Para fazer) - - Uma etapa do pipeline que atualize automaticamente a versão do example \ No newline at end of file + - Uma etapa do pipeline que atualize automaticamente a versão do example + - Adicionar teste automatizado no pipeline \ No newline at end of file diff --git a/main.tf b/main.tf index 8711dd8..fa9b0a1 100644 --- a/main.tf +++ b/main.tf @@ -16,7 +16,7 @@ data "aws_ami" "ubuntu" { resource "aws_instance" "this" { ami = data.aws_ami.ubuntu.id - instance_type = each.value["instance_type"] + instance_type = "t3.micro" dynamic "ebs_block_device" { for_each = var.ebs_block_devices diff --git a/outputs.tf b/outputs.tf index 4f4683e..8799d30 100644 --- a/outputs.tf +++ b/outputs.tf @@ -1,5 +1,6 @@ output "public_ip" { description = "IPs públicos" - value = { for key, instance in aws_instance.this : instance.tags["Env"] => instance.public_ip... } + value = aws_instance.this.public_ip } + \ No newline at end of file diff --git a/tests/instancia.tftest.hcl b/tests/instancia.tftest.hcl new file mode 100644 index 0000000..0a5e254 --- /dev/null +++ b/tests/instancia.tftest.hcl @@ -0,0 +1,15 @@ +variables { + nome = "test" +} + +run "validar_nome" { + + command = apply + + assert { + condition = aws_instance.this.tags["Name"] == var.nome + error_message = "Nome inválido" + } + +} +