Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. resource "aws_instance" "consul-server" {
  2. ami = var.consul-server
  3. instance_type = "t2.nano"
  4. key_name = var.aws_key_name
  5. iam_instance_profile = "dna_inst_mgmt"
  6. vpc_security_group_ids = [
  7. "${aws_security_group.yutani_consul.id}",
  8. "${aws_security_group.yutani_ssh.id}"
  9. ]
  10. subnet_id = "${aws_subnet.public_1_subnet_us_east_1c.id}"
  11. associate_public_ip_address = true
  12. tags = {
  13. Name = "consul-server${count.index}"
  14. }
  15.  
  16. root_block_device {
  17. volume_size = "30"
  18. delete_on_termination = "true"
  19. }
  20.  
  21. connection {
  22. type = "ssh"
  23. user = "chef"
  24. private_key = "${file("${var.aws_key_path}")}"
  25. timeout = "2m"
  26. agent = false
  27. host = self.public_ip
  28. }
  29.  
  30. count = var.consul-server_count
  31.  
  32. provisioner "chef" {
  33. attributes_json = <<-EOF
  34. {
  35. "consul": {
  36. "servers": ["${split(",",aws_instance.consul-server[count.index].id)}"]
  37. }
  38. }
  39. EOF
  40. use_policyfile = true
  41. policy_name = "consul_server"
  42. policy_group = "aws_stage_enc"
  43. node_name = "consul-server${count.index}"
  44. server_url = var.chef_server_url
  45. recreate_client = true
  46. skip_install = true
  47. user_name = var.chef_username
  48. user_key = "${file("${var.chef_user_key}")}"
  49. version = "14"
  50. }
  51. }
  52.  
  53. Error: Cycle: aws_instance.consul-server[1], aws_instance.consul-server[0]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement