Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
nilgaar committed Jul 13, 2024
1 parent 246c94a commit 5277acb
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion IaC/aws/terraform/ec2.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,27 @@ data "aws_ssm_parameter" "ubuntu22" {

resource "aws_instance" "ec2example" {
ami = data.aws_ssm_parameter.ubuntu22.value
instance_type = "t3.small"
instance_type = "t3.medium"
availability_zone = "eu-west-1a"
subnet_id = aws_subnet.subnet.id
vpc_security_group_ids = [aws_security_group.sec_group.id]
associate_public_ip_address = true
key_name = aws_key_pair.ec2_key_pair.key_name

provisioner "remote-exec" {
inline = [
"echo 'Waiting for instance to be fully ready...'",
"sleep 240"
]
}

provisioner "local-exec" {
command = "ansible-playbook -i '${self.public_ip},' ${path.module}/../../ansible/apache.yml"
}

connection {
type = "ssh"
user = "ubuntu"
host = self.public_ip
}
}

0 comments on commit 5277acb

Please sign in to comment.