hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.81k stars 9.16k forks source link

[Bug]: vpc/route_table: Allow local inline routes #32794 is not working on my test #34674

Open nicknameyu opened 10 months ago

nicknameyu commented 10 months ago

Terraform Core Version

1.5.7

AWS Provider Version

5.28.0

Affected Resource(s)

aws_route_table

Expected Behavior

According to #32794, below piece of code is supposed to be working.

resource "aws_vpc" "test" {
  cidr_block = "10.1.0.0/16"

  tags = {
    Name = "lihaspoj"
  }
}

resource "aws_route_table" "test" {
  vpc_id = aws_vpc.test.id

  route {
    cidr_block           = aws_vpc.test.cidr_block
    network_interface_id = aws_network_interface.test.id
  }

  tags = {
    Name = "lihaspoj"
  }
}

resource "aws_subnet" "test" {
  cidr_block = "10.1.1.0/24"
  vpc_id     = aws_vpc.test.id

  tags = {
    Name = "lihaspoj"
  }
}

resource "aws_network_interface" "test" {
  subnet_id = aws_subnet.test.id

  tags = {
    Name = "lihaspoj"
  }
}

Actual Behavior

it reports the same error #32794 was supposed to resolve.

Relevant Error/Panic Output Snippet

aws_vpc.test: Creating...
aws_vpc.test: Creation complete after 1s [id=vpc-0ab000bf777ae7d8e]
aws_subnet.test: Creating...
aws_subnet.test: Creation complete after 1s [id=subnet-08dd99a1656be229f]
aws_network_interface.test: Creating...
aws_network_interface.test: Creation complete after 0s [id=eni-0f13bda21ff3a6e5f]
aws_route_table.test: Creating...
╷
│ Error: creating Route in Route Table (rtb-00b1dad528fa9f783) with destination (10.1.0.0/16): RouteAlreadyExists: The route identified by 10.1.0.0/16 already exists.
│       status code: 400, request id: 55690ff3-2c91-4e1c-880f-dbff02744e69
│ 
│   with aws_route_table.test,
│   on main.tf line 9, in resource "aws_route_table" "test":
│    9: resource "aws_route_table" "test" {
│ 
╵
test % terraform -version
Terraform v1.5.7
on darwin_arm64
+ provider registry.terraform.io/hashicorp/aws v5.28.0

Your version of Terraform is out of date! The latest version
is 1.6.5. You can update by downloading from https://www.terraform.io/downloads.html

Terraform Configuration Files

terraform {
  required_providers {
    aws = {
      source = "hashicorp/aws"
      version = "5.28.0"
    }
  }
}

provider "aws" {
  # Configuration options
  region = "us-west-1"
}

Steps to Reproduce

  1. copy the code in #32794 to create main.tf;
  2. compose a provider.tf with
    
    terraform {
    required_providers {
    aws = {
      source = "hashicorp/aws"
      version = "5.28.0"
    }
    }
    }

provider "aws" {

Configuration options

region = "us-west-1" }


3. run `terraform init`
4. run `terraform apply`

### Debug Output

_No response_

### Panic Output

_No response_

### Important Factoids

_No response_

### References

_No response_

### Would you like to implement a fix?

No
github-actions[bot] commented 10 months ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue