Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Module fails when subnet with unassociated rt is specified in (this|peer)_subnet_ids variable #108

Open
herrbpl opened this issue Nov 21, 2023 · 0 comments
Assignees
Labels

Comments

@herrbpl
Copy link
Contributor

herrbpl commented Nov 21, 2023

Describe the bug
When user specifies any subnet that is not associated with route table in vpc as value in variables:

  • peer_subnets_ids
  • this_subnet_ids

then module is unable to find route tables for these subnets and fails to peer vpcs

Terraform version: 1.5.6

Module version: 6.0.0

Error message:

Error: query returned no results. Please change your search criteria and try again
│ 
│   with module.partial_subnets.data.aws_route_table.peer_subnet_rts[0],

Terraform code that produces the error:

module "partial_subnets" {
  
  source  = "../../"
  #version = "6.0.0"

  providers = {
    aws.this = aws.this
    aws.peer = aws.peer
  }

  this_vpc_id = var.this_vpc_id
  peer_vpc_id = var.peer_vpc_id

  auto_accept_peering = true
  peer_dns_resolution = true
  this_dns_resolution = true  
  peer_subnets_ids = ["subnet-unassociated-with-any-rt", "subnet-associated-with-rt-x"]
  this_subnets_ids = var.this_subnets_ids
  this_rts_ids = var.this_rts_ids
  peer_rts_ids = ["peer_main_rt", "peer_rt-x"]

  tags = {
    Name        = "tf-partial-subnets"
    Environment = "Test"
  }
  
}

Additional context
Will provide a fix via PR

@herrbpl herrbpl added the bug label Nov 21, 2023
@herrbpl herrbpl changed the title [BUG] [BUG] Module fails when subnet with unassociated rt is specified in (this|peer)_subnet_ids variable Nov 21, 2023
grem11n pushed a commit that referenced this issue Dec 15, 2023
* Test fixture for partial-subnets

* Update gitignore

* Fix unable to find route table bug
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants