terraform-aws-gitlab-runner icon indicating copy to clipboard operation
terraform-aws-gitlab-runner copied to clipboard

Error: no matching EC2 Subnet found on terraform or terragrunt plan command

Open BehbudSh opened this issue 3 years ago • 1 comments
trafficstars

Hi. First of all thanks for this great module.

I've faced an issue when running terragrunt plan command

Error: no matching EC2 Subnet found │ │ with data.aws_subnet.runners, │ on main.tf line 3, in data "aws_subnet" "runners": │ 3: data "aws_subnet" "runners" {

It's because of the resource data "aws_subnet" "runners" { id = length(var.subnet_id) > 0 ? var.subnet_id : var.subnet_id_runners }

I've other dependent resources from subnet_id but they are working as expected with the "mock_outputs" function of the Terragrunt. I have managed to fix it with some changes in the source module. Could you please fix this issue?

My changes: deleted these data resources from the main.tf file

data "aws_subnet" "runners" { id = length(var.subnet_id) > 0 ? var.subnet_id : var.subnet_id_runners } data "aws_availability_zone" "runners" { name = data.aws_subnet.runners.availability_zone }

and assigned variable "subnet _id" directly in the main.tf file as well. Lines 78,79

template_runner_config = templatefile("${path.module}/template/runner-config.tpl", { aws_region = var.aws_region gitlab_url = var.runners_gitlab_url runners_vpc_id = var.vpc_id runners_subnet_id = var.subnet_id runners_aws_zone = 'us-east-1a' ommited ... hardcoded the value of the "runners_aws_zone" for testing purposes :)

Thanks!

BehbudSh avatar Jun 09 '22 15:06 BehbudSh

Hi @BehbudSh,

not sure if I understand this correctly. Deleting the resources seems to be easy, but how do you know the availability zone of the subnet?

Note: subnet_id_runners and some other variables are deprecated and shouldn't be used anymore. They were removed with #420 to clean up the variable section.

kayman-mk avatar Jun 19 '22 11:06 kayman-mk

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 15 days.

github-actions[bot] avatar Mar 02 '23 03:03 github-actions[bot]

This issue was closed because it has been stalled for 15 days with no activity.

github-actions[bot] avatar Mar 18 '23 02:03 github-actions[bot]