Skip to content

Passing variables between Terragrunt and Terraform #137

Answered by ulankford
ulankford asked this question in Help
Discussion options

You must be logged in to vote

OK so I have this almost working fully, well in fact it does work, I can grab the instance id and attach an ebs volume to this instance, but at the same time the ebs directory tries to create a new ec2 instance. This is not what I want as I have a ec2 directory looking after the entire ec2 instance creation.

├── ebs
│ ├── ebs.tf
│ └── terragrunt.hcl
└── ec2-instance
└── terragrunt.hcl

ebs.tf

variable "instance_id" {
  type = string
}

resource "aws_ebs_volume" "this" {
  availability_zone = "ap-southeast-2a"
  size              = 20
}

resource "aws_volume_attachment" "this" {
  device_name = "/dev/sdh"
  volume_id   = aws_ebs_volume.this.id
  instance_id = "${var.instance_id}"
}

terragr…

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@ulankford
Comment options

Comment options

You must be logged in to vote
1 reply
@ulankford
Comment options

Comment options

You must be logged in to vote
2 replies
@denis256
Comment options

@ulankford
Comment options

Answer selected by denis256
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
2 participants