Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- resource "aws_instance" "consul-server" {
- ami = var.consul-server
- instance_type = "t2.nano"
- key_name = var.aws_key_name
- iam_instance_profile = "dna_inst_mgmt"
- vpc_security_group_ids = [
- "${aws_security_group.yutani_consul.id}",
- "${aws_security_group.yutani_ssh.id}"
- ]
- subnet_id = "${aws_subnet.public_1_subnet_us_east_1c.id}"
- associate_public_ip_address = true
- tags = {
- Name = "consul-server${count.index}"
- }
- root_block_device {
- volume_size = "30"
- delete_on_termination = "true"
- }
- connection {
- type = "ssh"
- user = "chef"
- private_key = "${file("${var.aws_key_path}")}"
- timeout = "2m"
- agent = false
- host = self.public_ip
- }
- count = var.consul-server_count
- provisioner "chef" {
- attributes_json = <<-EOF
- {
- "consul": {
- "servers": ["${split(",",aws_instance.consul-server[count.index].id)}"]
- }
- }
- EOF
- use_policyfile = true
- policy_name = "consul_server"
- policy_group = "aws_stage_enc"
- node_name = "consul-server${count.index}"
- server_url = var.chef_server_url
- recreate_client = true
- skip_install = true
- user_name = var.chef_username
- user_key = "${file("${var.chef_user_key}")}"
- version = "14"
- }
- }
- Error: Cycle: aws_instance.consul-server[1], aws_instance.consul-server[0]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement