Advertisement
Guest User

Untitled

a guest
Aug 14th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. resource "aws_security_group" "allow_all" {
  2. name = "Allow all intern traffic of VR Office"
  3. description = "Allow all inbound traffic"
  4. vpc_id = "${var.vr_vpc}"
  5.  
  6. tags {
  7. Name = "Allow all intern traffic of VR Office"
  8. }
  9. }
  10.  
  11. resource "aws_security_group_rule" "outbound_internet_access" {
  12. type = "egress"
  13. from_port = 0
  14. to_port = 0
  15. protocol = "-1"
  16. cidr_blocks = ["0.0.0.0/0"]
  17. security_group_id = "${aws_security_group.allow_all.id}"
  18. }
  19.  
  20. resource "aws_security_group_rule" "inbound_internet_access" {
  21. type = "ingress"
  22. from_port = 0
  23. to_port = 65535
  24. protocol = "-1"
  25. cidr_blocks = ["0.0.0.0/0"]
  26. security_group_id = "${aws_security_group.allow_all.id}"
  27. }
  28.  
  29. resource "aws_instance" "instance" {
  30. ami = "${var.aws_ami}"
  31. instance_type = "${var.aws_instance}"
  32. availability_zone = "${var.availability_zone}"
  33. security_groups = ["${var.sg}", "${aws_security_group.allow_all.id}"]
  34. subnet_id = "${var.subnet_id}"
  35. tenancy = "default"
  36. key_name = "${var.client_name}-${var.environment}"
  37.  
  38. provisioner "local-exec" {
  39. command = "./check.sh"
  40. }
  41.  
  42. #provisioner "local-exec" {
  43. # 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"
  44. # }
  45.  
  46. tags {
  47. Name = "${var.instance_name}"
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement