1. Jenkins will trigger the terraform
2. Terraform will create a instance on AWS.
3. Ansible fetch the instance details and it will perform configuration management.
The terraform module look like
resource "aws_instance" "devsecops"
{
ami = var.instance_ami
instance_type = var.instance_type
subnet_id = var.subnet_id
vpc_security_group_ids = var.vpc_security_group_ids
key_name = var.key_name
# here i am using provisioner local-exec which will filter the ip address from the output of above module and will store in the ip.txt
provisioner "local-exec"
{
command = "echo ip: ${aws_instance.devsecops.public_ip} >> public_ip.txt"
}
}
0 Comments