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]: aws_api_gateway_domain_name - wrong parameters for GetDomainName API call #40699

Closed
A-Shevchenko opened this issue Dec 26, 2024 · 4 comments · Fixed by #40708
Closed
Labels
bug Addresses a defect in current functionality. service/acm Issues and PRs that pertain to the acm service. service/apigateway Issues and PRs that pertain to the apigateway service.
Milestone

Comments

@A-Shevchenko
Copy link
Contributor

A-Shevchenko commented Dec 26, 2024

Terraform Core Version

1.10.3

AWS Provider Version

5.82.2

Affected Resource(s)

aws_api_gateway_domain_name

Expected Behavior

Resource created/updated without errors

Actual Behavior

Error: waiting for API Gateway Domain Name (DOMAIN_NAME/DOMAIN_NAME_ID) update: couldn't find resource

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

locals {
  domain_name = "DOMAIN_NAME"
  upper_level_domain_name="TOP_LEVEL_DOMAIN_NAME"
}

data "aws_acm_certificate" "wildcard" {
  domain = "*.${local.upper_level_domain_name}"
}

resource "aws_api_gateway_domain_name" "domain_name" {
  domain_name = local.domain_name
  endpoint_configuration {
    types = ["PRIVATE"]
  }
  certificate_arn = data.aws_acm_certificate.wildcard.arn
  policy = <<JSON
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": "*",
            "Action": "execute-api:Invoke",
            "Resource": [
                "execute-api:/*"
            ]
        },
        {
            "Effect": "Deny",
            "Principal": "*",
            "Action": "execute-api:Invoke",
            "Resource": [
                "execute-api:/*"
            ],
            "Condition" : {
                "StringNotEquals": {
                    "aws:SourceVpce": "VPCE_ID"
                }
            }
        }
    ]
}
JSON
}

Steps to Reproduce

try to apply configuration above

Debug Output

No response

Panic Output

No response

Important Factoids

In debug logs I can see that request is made to the following URL:

http.url="https:
//apigateway.us-east-1.amazonaws.com/domainnames/DOMAIN_NAME%2FDOMAIN_NAME_ID?domainNameId=DOMAIN_NAME_ID"

However, it doesn't seem to be correct - DOMAIN_NAME_ID is present in both path and query string param.
According to API documentation - path should contain DOMAIN_NAME only, without %2FDOMAIN_NAME_ID

References

No response

Would you like to implement a fix?

None

@A-Shevchenko A-Shevchenko added the bug Addresses a defect in current functionality. label Dec 26, 2024
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 service/acm Issues and PRs that pertain to the acm service. service/apigateway Issues and PRs that pertain to the apigateway service. needs-triage Waiting for first response or review from a maintainer. labels Dec 26, 2024
@A-Shevchenko
Copy link
Contributor Author

Found the problem:
https://github.com/hashicorp/terraform-provider-aws/blob/main/internal/service/apigateway/domain_name.go#L441
here: waitDomainNameUpdated(ctx, conn, d.Id(), domainNameID) - domainName should be used instead of d.Id() (as d.Id() is a composite value parsed into domainName and domainNameID above)
Will try to add tests for this and prepare PR in the next few days

@ewbankkit ewbankkit removed service/acm Issues and PRs that pertain to the acm service. needs-triage Waiting for first response or review from a maintainer. labels Dec 27, 2024
@github-actions github-actions bot added the service/acm Issues and PRs that pertain to the acm service. label Dec 29, 2024
Copy link

Warning

This issue has been closed, meaning that any additional comments are hard for our team to see. Please assume that the maintainers will not see them.

Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.

Copy link

github-actions bot commented Jan 9, 2025

This functionality has been released in v5.83.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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Addresses a defect in current functionality. service/acm Issues and PRs that pertain to the acm service. service/apigateway Issues and PRs that pertain to the apigateway service.
Projects
None yet
2 participants