Closed atorrescogollo closed 3 months ago
FYI: I implemented a fix for the same issue here: https://github.com/terraform-aws-modules/terraform-aws-apigateway-v2/pull/119 π
Hey @tonnenpinguin sorry , my fault, I was debugging the issue at first and I didn't realize your PR (I thought it was for just allowing var.hosted_zone_name
).
However, your PR doesn't fix the issue I described here. It only allows you to set the var.hosted_zone_name
ad-hoc. I can't successfully run a plan against this:
module "api_gateway" {
source = "git@github.com:tonnenpinguin/terraform-aws-apigateway-v2.git?ref=fix/hosted_zone_name"
name = "demo"
description = "API Gateway"
protocol_type = "HTTP"
# Custom domain
domain_name = "demo.example.com" # Having an example.com zone already created
}
β Error: no matching Route 53 Hosted Zone found
β
β with module.api_gateway.data.aws_route53_zone.this[0],
β on .terraform/modules/api_gateway/main.tf line 134, in data "aws_route53_zone" "this":
β 134: data "aws_route53_zone" "this" {
β
I have to explicitly say this to make it work (which should behave in the same way AFAIK):
module "api_gateway" {
...
hosted_zone_name = "example.com"
}
If you implement that fix, tell me and I'll close this one. Since you had reviews already, I think it makes more sense to keep yours instead.
On the other hand, I would prefer to forward the zone_id
instead of the zone_name
.
I have a personal reference about trying to send IDs and ARNs when possible and against doing data lookups inside modules. The plan is usually faster at scale, and you might see more "known after apply" references when using data lookups.
In my change, I was suggesting forwarding the zone_id
so that you don't have to do the data lookup since you don't need it. But it's just an opinion.
This issue has been resolved in version 5.2.0 :tada:
I'm going to lock this pull request 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 related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Description
Records registration seems to be partially broken
Motivation and Context
Given this code:
It fails to get the zone_id since it tries
demo.example.com
instead of justexample.com
.This PR was made to fix that. Also, it includes a way to avoid doing that data lookup and using a variable instead.
Now there are three ways to register the domain records:
Breaking Changes
How Has This Been Tested?
examples/*
to demonstrate and validate my change(s)examples/*
projectspre-commit run -a
on my pull request