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

aws_lb_listener_certificate throws error parsing ELBv2 Listener Certificate ID if iam cert name contains "_" #17639

Closed
greedy52 opened this issue Feb 16, 2021 · 4 comments · Fixed by #17645
Assignees
Labels
bug Addresses a defect in current functionality. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. service/elbv2 Issues and PRs that pertain to the elbv2 service.
Milestone

Comments

@greedy52
Copy link

greedy52 commented Feb 16, 2021

Terraform Version

Terraform v0.13.5

Affected Resource(s)

  • aws_lb_listener_certificate throws

Terraform Configuration Files

resource aws_lb_listener_certificate alb {                                                                          
  listener_arn    = aws_lb_listener.alb.arn                                
  certificate_arn = var.extra_lb_cert_arn                           
} 

Note that the extra_lb_cert_arn is an iam cert arn something like arn:aws:iam::221108671772:server-certificate/<example.domain.com>_Sep2019

Terraform Plan Error Output

Error: error parsing ELBv2 Listener Certificate ID (arn:aws:elasticloadbalancing:us-east-1:221108671772:listener/app///_arn:aws:iam::221108671772:server-certificate/<example.domain.com>_Sep2019): unexpected format for ID ("arn:aws:elasticloadbalancing:us-east-1:221108671772:listener/app///_arn:aws:iam::221108671772:server-certificate/<example.domain.com>_Sep2019"), expected listener-arn_certificate-arn

Expected Behavior

Terraform plan Success

Actual Behavior

  • With aws release 3.27.0 terraform plan succeed
  • With aws release 3.28.0 terraform plan throws about error

References

I believe the breaking change is introduced in this pull request: #16474

The ListenerCertificateParseID function expects the id has two parts split by _. But in the case where _ exists in the name of the cert, it fails this parse check.

@ghost ghost added the service/elbv2 Issues and PRs that pertain to the elbv2 service. label Feb 16, 2021
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Feb 16, 2021
@bflad bflad added bug Addresses a defect in current functionality. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. and removed needs-triage Waiting for first response or review from a maintainer. labels Feb 16, 2021
@bflad bflad self-assigned this Feb 16, 2021
bflad added a commit that referenced this issue Feb 16, 2021
…or with IAM Server Certificate names containing underscores

Reference: #17639

Previously:

```
=== CONT  TestAccAwsLbListenerCertificate_CertificateArn_Underscores
    resource_aws_lb_listener_certificate_test.go:54: Step 1/2 error: Error running apply: exit status 1

        Error: error parsing ELBv2 Listener Certificate ID (arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/tf-acc-test-1918488772698388616/37ea83aabfff17e9/c77f900678310ecd_arn:aws:iam::123456789012:server-certificate/tf_acc_test_1918488772698388616): unexpected format for ID ("arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/tf-acc-test-1918488772698388616/37ea83aabfff17e9/c77f900678310ecd_arn:aws:iam::123456789012:server-certificate/tf_acc_test_1918488772698388616"), expected listener-arn_certificate-arn

--- FAIL: TestAccAwsLbListenerCertificate_CertificateArn_Underscores (161.31s)
```

Output from acceptance testing in AWS Commercial:

```
--- PASS: TestAccAwsLbListenerCertificate_disappears (165.35s)
--- PASS: TestAccAwsLbListenerCertificate_CertificateArn_Underscores (167.76s)
--- PASS: TestAccAwsLbListenerCertificate_basic (168.14s)
--- PASS: TestAccAwsLbListenerCertificate_multiple (243.26s)
```

Output from acceptance testing in AWS GovCloud (US):

```
--- PASS: TestAccAwsLbListenerCertificate_CertificateArn_Underscores (159.16s)
--- PASS: TestAccAwsLbListenerCertificate_disappears (162.81s)
--- PASS: TestAccAwsLbListenerCertificate_basic (170.08s)
--- PASS: TestAccAwsLbListenerCertificate_multiple (272.30s)
```
@bflad
Copy link
Contributor

bflad commented Feb 16, 2021

Fix submitted: #17645

bflad added a commit that referenced this issue Feb 17, 2021
…or with IAM Server Certificate names containing underscores (#17645)

Reference: #17639

Previously:

```
=== CONT  TestAccAwsLbListenerCertificate_CertificateArn_Underscores
    resource_aws_lb_listener_certificate_test.go:54: Step 1/2 error: Error running apply: exit status 1

        Error: error parsing ELBv2 Listener Certificate ID (arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/tf-acc-test-1918488772698388616/37ea83aabfff17e9/c77f900678310ecd_arn:aws:iam::123456789012:server-certificate/tf_acc_test_1918488772698388616): unexpected format for ID ("arn:aws:elasticloadbalancing:us-west-2:123456789012:listener/app/tf-acc-test-1918488772698388616/37ea83aabfff17e9/c77f900678310ecd_arn:aws:iam::123456789012:server-certificate/tf_acc_test_1918488772698388616"), expected listener-arn_certificate-arn

--- FAIL: TestAccAwsLbListenerCertificate_CertificateArn_Underscores (161.31s)
```

Output from acceptance testing in AWS Commercial:

```
--- PASS: TestAccAwsLbListenerCertificate_disappears (165.35s)
--- PASS: TestAccAwsLbListenerCertificate_CertificateArn_Underscores (167.76s)
--- PASS: TestAccAwsLbListenerCertificate_basic (168.14s)
--- PASS: TestAccAwsLbListenerCertificate_multiple (243.26s)
```

Output from acceptance testing in AWS GovCloud (US):

```
--- PASS: TestAccAwsLbListenerCertificate_CertificateArn_Underscores (159.16s)
--- PASS: TestAccAwsLbListenerCertificate_disappears (162.81s)
--- PASS: TestAccAwsLbListenerCertificate_basic (170.08s)
--- PASS: TestAccAwsLbListenerCertificate_multiple (272.30s)
```
@bflad
Copy link
Contributor

bflad commented Feb 17, 2021

The fix for this has been merged and will release with version 3.29.0 of the Terraform AWS Provider, tomorrow. 👍

@ghost
Copy link

ghost commented Feb 19, 2021

This has been released in version 3.29.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 for triage. Thanks!

@ghost
Copy link

ghost commented Mar 19, 2021

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Mar 19, 2021
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. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. service/elbv2 Issues and PRs that pertain to the elbv2 service.
Projects
None yet
2 participants