Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- resource "aws_security_group" "allow_all" {
- name = "Allow all intern traffic of VR Office"
- description = "Allow all inbound traffic"
- vpc_id = "${var.vr_vpc}"
- tags {
- Name = "Allow all intern traffic of VR Office"
- }
- }
- resource "aws_security_group_rule" "outbound_internet_access" {
- type = "egress"
- from_port = 0
- to_port = 0
- protocol = "-1"
- cidr_blocks = ["0.0.0.0/0"]
- security_group_id = "${aws_security_group.allow_all.id}"
- }
- resource "aws_security_group_rule" "inbound_internet_access" {
- type = "ingress"
- from_port = 0
- to_port = 65535
- protocol = "-1"
- cidr_blocks = ["0.0.0.0/0"]
- security_group_id = "${aws_security_group.allow_all.id}"
- }
- resource "aws_instance" "instance" {
- ami = "${var.aws_ami}"
- instance_type = "${var.aws_instance}"
- availability_zone = "${var.availability_zone}"
- security_groups = ["${var.sg}", "${aws_security_group.allow_all.id}"]
- subnet_id = "${var.subnet_id}"
- tenancy = "default"
- key_name = "${var.client_name}-${var.environment}"
- provisioner "local-exec" {
- command = "./check.sh"
- }
- #provisioner "local-exec" {
- # command = "sleep 120; ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -e 'ansible_python_interpreter=/usr/bin/python3' -u ec2-user --private-key ./${var.client_name}-${var.environment} -i '${aws_instance.instance.private_ip}', /home/felipe/Rivendel/clientes/vr/ansible/roles/playbook.yml"
- # }
- tags {
- Name = "${var.instance_name}"
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement