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.75k stars 9.11k forks source link

[Bug]: Error: setting forward_path_component on aws_ec2_network_insights_analysis #28683

Closed it-happens-nl closed 1 year ago

it-happens-nl commented 1 year ago

Terraform Core Version

v1.0.1, v1.3.7

AWS Provider Version

v4.48.0

Affected Resource(s)

aws_ec2_network_insights_analysis

Expected Behavior

After setting "aws_ec2_network_insights_path" "source" to "aws_network_interface.arn" instead of "aws_network_interface.id" (to allow for cross-account connectivity testing) a path analysis should be triggered without errors as with "source" set to "aws_network_interface.id"

Actual Behavior

Terraform plan/apply fail with an error after setting "aws_ec2_network_insights_path" "source" to "aws_network_interface.arn". The analysis is created successfully in AWS, but the plan/apply fail because of this error. The error doesn't occur with "aws_ec2_network_insights_path" "source" set to "aws_network_interface.id"

Relevant Error/Panic Output Snippet

Error: setting forward_path_components: Invalid address to set: []string{"forward_path_components", "13", "transit_gateway_route_table_route", "0", "route_orign"}

Terraform Configuration Files

#---------                    Test to egress public                    ---------
resource "aws_ec2_network_insights_path" "egress_path" {
  provider    = aws.local
  source      = aws_network_interface.connectivity_test.arn
  destination = var.egress_connectivity_test_nic_id
  protocol    = "tcp"
}

resource "aws_ec2_network_insights_analysis" "egress_analysis" {
  provider                 = aws.local
  network_insights_path_id = aws_ec2_network_insights_path.egress_path.id
}

Steps to Reproduce

Plan/apply resource to see the error. Change to:

resource "aws_ec2_network_insights_path" "egress_path" {
  provider    = aws.local
  source      = aws_network_interface.connectivity_test.id
  destination = var.egress_connectivity_test_nic_id
  protocol    = "tcp"
}

to see resource being created without error

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

github-actions[bot] commented 1 year ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

odg0318 commented 1 year ago

I am struggling with this issue. I also share my terraform log using TF_LOG=debug. I found http.status_code=200 in response as below but terraform plan failed.


2023-07-07T17:53:51.043+0900 [DEBUG] provider.terraform-provider-aws_v5.7.0_x5: HTTP Request Sent: aws.sdk=aws-sdk-go aws.service=EC2 http.flavor=1.1 http.request.body="Acti******************************yses&Netw*****************isId.1=nia-0572*********c609&Version=2016-11-15
" http.request.header.x_amz_security_token=***** tf_resource_type=aws_ec2_network_insights_analysis tf_provider_addr=registry.terraform.io/hashicorp/aws @caller=github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2@v2.0.0-beta.32/logger.go:96 @module=aws http.request.header.authorization="AWS4-HMAC-SHA256 Credential=ASIA************TJDD********7/ap-northeast-2/ec2/aws4_request, Sign*************tent-length;content-type;host;x-amz-date;x-amz-security-token, Signature=*****" http.url=https://ec2.ap-northeast-2.amazonaws.com/ net.peer.name=ec2.ap-northeast-2.amazonaws.com tf_mux_provider=*schema.GRPCProviderServer tf_req_id=6d3ec2bd-a09d-4b2d-c022-af9a744d7576 aws.operation=DescribeNetworkInsightsAnalyses http.method=POST http.request.header.content_type="application/x-www-form-urlencoded; charset=utf-8" aws.region=ap-northeast-2 http.request.header.x_amz_date=20230707T085351Z http.request_content_length=107 http.user_agent="APN/1.0 HashiCorp/1.0 Terraform/1.2.9 (+https://www.terraform.io) terraform-provider-aws/5.7.0 (+https://registry.terraform.io/providers/hashicorp/aws) aws-sdk-go/1.44.297 (go1.20.5; darwin; arm64)" tf_rpc=ReadResource timestamp=2023-07-07T17:53:51.043+0900
2023-07-07T17:53:51.109+0900 [DEBUG] provider.terraform-provider-aws_v5.7.0_x5: HTTP Response Received: @module=aws aws.operation=DescribeNetworkInsightsAnalyses aws.service=EC2 http.response.header.cache_control="no-cache, no-store" tf_mux_provider=*schema.GRPCProviderServer tf_req_id=3730fc57-61e5-9073-b9f6-bb492c912a3a aws.sdk=aws-sdk-go http.response.header.content_type=text/xml;charset=UTF-8 http.response.header.x_amzn_requestid=615d504a-23f6-47c8-8a34-2a0ad83f6751 http.response.header.date="Fri, 07 Jul 2023 08:53:50 GMT" http.response.header.server=AmazonEC2 http.response.header.vary=accept-encoding http.status_code=200 tf_rpc=ReadResource http.response.header.strict_transport_security="max-age=31536000; includeSubDomains" tf_provider_addr=registry.terraform.io/hashicorp/aws tf_resource_type=aws_ec2_network_insights_analysis @caller=github.com/hashicorp/aws-sdk-go-base/v2/awsv1shim/v2@v2.0.0-beta.32/logger.go:144 aws.region=ap-northeast-2 http.duration=82 http.response.body="<?xml version="1.0" encoding="UTF-8"?>
<Desc*******************************onse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/">
    <requestId>615d504a-23f6-47c8-8a34-2a0ad83f6751</requestId>
    <netw******************sSet>
        <item>
            <forw***************tSet>
                <item>
                    <addi************Set/>
                    <attachedTo>
                        <arn>arn:aws:ec2:ap-northeast-2:842134318810:transit-gateway/tgw-0844*********c3e7</arn>
                        <id>tgw-0844*********c3e7</id>
                        <name>tgw-tmapcore-seoul-65412</name>
                    </attachedTo>
                    <component>
                        <arn>arn:aws:ec2:ap-northeast-2:624347164499:transit-gateway-attachment/tgw-attach-074c*********f55c</arn>
                        <id>tgw-attach-074c*********f55c</id>
                        <name>vpc/tmobi/tmap-mdp/mdp-prd</name>
                    </component>
                    <explanationSet/>
                    <outboundHeader>
                        <dest*************sSet>
                            <item>100.64.22.128/27</item>
                        </des**************sSet>
                        <dest***************eSet>
                            <item>
                                <from>0</from>
                                <to>65535</to>
                            </item>
                        </des****************eSet>
                        <protocol>6</protocol>
                        <sour********sSet>
                            <item>0.0.0.0/0</item>
                        </sou*********sSet>
                        <sour**********eSet>
                            <item>
                                <from>0</from>
                                <to>65535</to>
                            </item>
                        </sou***********eSet>
                    </outboundHeader>
                    <sequenceNumber>1</sequenceNumber>
                    <transitGateway>
                        <arn>arn:aws:ec2:ap-northeast-2:842134318810:transit-gateway/tgw-0844*********c3e7</arn>
                        <id>tgw-0844*********c3e7</id>
                        <name>tgw-tmapcore-seoul-65412</name>
                    </transitGateway>
                </item>
                <item>
                    <addi************Set/>
                    <component>
                        <arn>arn:aws:ec2:ap-northeast-2:842134318810:transit-gateway-route-table/tgw-rtb-0a75*********2d30</arn>
                        <id>tgw-rtb-0a75*********2d30</id>
                        <name>tgw-rtb-prdstg</name>
                    </component>
                    <explanationSet/>
                    <sequenceNumber>2</sequenceNumber>
                    <transitGateway>
                        <arn>arn:aws:ec2:ap-northeast-2:842134318810:transit-gateway/tgw-0844*********c3e7</arn>
                        <id>tgw-0844*********c3e7</id>
                        <name>tgw-tmapcore-seoul-65412</name>
                    </transitGateway>
                    <tran*********************oute>
                        <attachmentId>tgw-attach-0f07*********aaa7</attachmentId>
                        <destinationCidr>100.64.22.128/27</des********Cidr>
                        <resourceId>vpc-03d2*********85d8</resourceId>
                        <resourceType>vpc</resourceType>
                        <routeOrigin>propagated</routeOrigin>
                        <state>active</state>
                    </tra**********************oute>
                </item>
                <item>
                    <addi***********lSet>
                        <item>
                            <addi************Type>UNIDIRECTIONAL_PATH_ANALYSIS_ONLY</add*************Type>
                        </item>
                    </add************lSet>
                    <attachedTo>
                        <arn>arn:aws:ec2:ap-northeast-2:842134318810:transit-gateway/tgw-0844*********c3e7</arn>
                        <id>tgw-0844*********c3e7</id>
                        <name>tgw-tmapcore-seoul-65412</name>
[truncated...]" timestamp=2023-07-07T17:53:51.108+0900
2023-07-07T17:53:51.109+0900 [ERROR] provider.terraform-provider-aws_v5.7.0_x5: [ERROR] setting state: Invalid address to set: []string{"forward_path_components", "1", "transit_gateway_route_table_route", "0", "route_orign"}
2023-07-07T17:53:51.109+0900 [ERROR] provider.terraform-provider-aws_v5.7.0_x5: Response contains error diagnostic: @caller=github.com/hashicorp/terraform-plugin-go@v0.17.0/tfprotov5/internal/diag/diagnostics.go:58 tf_proto_version=5.3 @module=sdk.proto diagnostic_detail= diagnostic_severity=ERROR diagnostic_summary="setting forward_path_components: Invalid address to set: []string{"forward_path_components", "1", "transit_gateway_route_table_route", "0", "route_orign"}" tf_provider_addr=registry.terraform.io/hashicorp/aws tf_req_id=3730fc57-61e5-9073-b9f6-bb492c912a3a tf_resource_type=aws_ec2_network_insights_analysis tf_rpc=ReadResource timestamp=2023-07-07T17:53:51.109+0900
github-actions[bot] commented 1 year ago

This functionality has been released in v5.14.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

github-actions[bot] commented 12 months ago

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.