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]: terraform apply is always changing the aws_route_table. #27007

Closed
Mahesh-008 opened this issue Sep 28, 2022 · 4 comments
Closed

[Bug]: terraform apply is always changing the aws_route_table. #27007

Mahesh-008 opened this issue Sep 28, 2022 · 4 comments
Labels
bug Addresses a defect in current functionality. service/vpc Issues and PRs that pertain to the vpc service.

Comments

@Mahesh-008
Copy link

Mahesh-008 commented Sep 28, 2022

Terraform Core Version

Terraform v1.3.0

AWS Provider Version

aws v4.32.0

Affected Resource(s)

resource "aws_network_interface" "nat_network_interface" {
  subnet_id         = local.pri_sub_ids[0]
  source_dest_check = false
  security_groups   = [aws_security_group.nat-sg.id]

  tags = {
    Name = "${local.environment}-nat_instance_network_interface"
  }
}

resource "aws_route_table" "dev-vpc-private-rt" {
  vpc_id = aws_vpc.dev-vpc.id

  route {
    cidr_block = "0.0.0.0/0"
    #nat_gateway_id = aws_nat_gateway.dev-vpc-nat-gw.id
    network_interface_id = aws_network_interface.nat_network_interface.id
  }

  tags = {
    Name = "${local.environment}-Private-Route-Table"
  }
}

Expected Behavior

it should say no changes.

Actual Behavior

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # aws_route_table.dev-vpc-private-rt will be updated in-place
  ~ resource "aws_route_table" "dev-vpc-private-rt" {
        id               = "rtb-0483528a4c0b5cf2f"
      ~ route            = [
          + {
              + carrier_gateway_id         = ""
              + cidr_block                 = "0.0.0.0/0"
              + core_network_arn           = ""
              + destination_prefix_list_id = ""
              + egress_only_gateway_id     = ""
              + gateway_id                 = ""
              + instance_id                = ""
              + ipv6_cidr_block            = ""
              + local_gateway_id           = ""
              + nat_gateway_id             = ""
              + network_interface_id       = "eni-019e42a1babbffe7e"
              + transit_gateway_id         = ""
              + vpc_endpoint_id            = ""
              + vpc_peering_connection_id  = ""
            },
          - {
              - carrier_gateway_id         = ""
              - cidr_block                 = "0.0.0.0/0"
              - core_network_arn           = ""
              - destination_prefix_list_id = ""
              - egress_only_gateway_id     = ""
              - gateway_id                 = ""
              - instance_id                = "i-066a7f52283db0dee"
              - ipv6_cidr_block            = ""
              - local_gateway_id           = ""
              - nat_gateway_id             = ""
              - network_interface_id       = "eni-019e42a1babbffe7e"
              - transit_gateway_id         = ""
              - vpc_endpoint_id            = ""
              - vpc_peering_connection_id  = ""
            },
        ]
        tags             = {
            "Name" = "DEV-VPC-Private-Route-Table"
        }
        # (5 unchanged attributes hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.
aws_route_table.dev-vpc-private-rt: Modifying... [id=rtb-0483528a4c0b5cf2f]
aws_route_table.dev-vpc-private-rt: Modifications complete after 1s [id=rtb-0483528a4c0b5cf2f]

Apply complete! Resources: 0 added, 1 changed, 0 destroyed.

Relevant Error/Panic Output Snippet

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # aws_route_table.dev-vpc-private-rt will be updated in-place
  ~ resource "aws_route_table" "dev-vpc-private-rt" {
        id               = "rtb-0483528a4c0b5cf2f"
      ~ route            = [
          + {
              + carrier_gateway_id         = ""
              + cidr_block                 = "0.0.0.0/0"
              + core_network_arn           = ""
              + destination_prefix_list_id = ""
              + egress_only_gateway_id     = ""
              + gateway_id                 = ""
              + instance_id                = ""
              + ipv6_cidr_block            = ""
              + local_gateway_id           = ""
              + nat_gateway_id             = ""
              + network_interface_id       = "eni-019e42a1babbffe7e"
              + transit_gateway_id         = ""
              + vpc_endpoint_id            = ""
              + vpc_peering_connection_id  = ""
            },
          - {
              - carrier_gateway_id         = ""
              - cidr_block                 = "0.0.0.0/0"
              - core_network_arn           = ""
              - destination_prefix_list_id = ""
              - egress_only_gateway_id     = ""
              - gateway_id                 = ""
              - instance_id                = "i-066a7f52283db0dee"
              - ipv6_cidr_block            = ""
              - local_gateway_id           = ""
              - nat_gateway_id             = ""
              - network_interface_id       = "eni-019e42a1babbffe7e"
              - transit_gateway_id         = ""
              - vpc_endpoint_id            = ""
              - vpc_peering_connection_id  = ""
            },
        ]
        tags             = {
            "Name" = "DEV-VPC-Private-Route-Table"
        }
        # (5 unchanged attributes hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.
aws_route_table.dev-vpc-private-rt: Modifying... [id=rtb-0483528a4c0b5cf2f]
aws_route_table.dev-vpc-private-rt: Modifications complete after 1s [id=rtb-0483528a4c0b5cf2f]

Apply complete! Resources: 0 added, 1 changed, 0 destroyed.

Terraform Configuration Files

resource "aws_network_interface" "nat_network_interface" {
  subnet_id         = local.pri_sub_ids[0]
  source_dest_check = false
  security_groups   = [aws_security_group.nat-sg.id]

  tags = {
    Name = "${local.environment}-nat_instance_network_interface"
  }
}

resource "aws_route_table" "dev-vpc-private-rt" {
  vpc_id = aws_vpc.dev-vpc.id

  route {
    cidr_block = "0.0.0.0/0"
    #nat_gateway_id = aws_nat_gateway.dev-vpc-nat-gw.id
    network_interface_id = aws_network_interface.nat_network_interface.id
  }

  tags = {
    Name = "${local.environment}-Private-Route-Table"
  }
}

Steps to Reproduce

  1. terraform init.
  2. terraform plan (without making the any changes)

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

No response

@Mahesh-008 Mahesh-008 added bug Addresses a defect in current functionality. needs-triage Waiting for first response or review from a maintainer. labels Sep 28, 2022
@github-actions
Copy link

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added the service/vpc Issues and PRs that pertain to the vpc service. label Sep 28, 2022
@ewbankkit ewbankkit removed the needs-triage Waiting for first response or review from a maintainer. label Sep 28, 2022
@ewbankkit
Copy link
Contributor

Relates #1426.
Relates #14197.

@ewbankkit
Copy link
Contributor

I'm going to close this issue as a duplicate of #1426 so that we can concentrate discussion in the linked issue.
Please add any additional comments there.

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/vpc Issues and PRs that pertain to the vpc service.
Projects
None yet
Development

No branches or pull requests

2 participants