-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
resource_aws_route53_zone should force a new record when switching from public to private #7614
Comments
Hi @blckct 👋 Thanks for reporting this. We will plan on fixing this with the removal of the deprecated argument in the next major version update of the Terraform AWS Provider and I have marked this for tracking with that release. |
Prerequisite: Issue #7693 / PR #7695 I was hoping to address this at the same time as above, but Terraform 0.11 is having some unexpected behavior with Attempted implementation: // aws/resource_aws_route53_zone.go schema
CustomizeDiff: customdiff.All(
customdiff.ForceNewIfChange("vpc", func(old, new, meta interface{}) bool {
// "vpc" can only be in-place updated if already specified
return len(old.(*schema.Set).List()) == 0 || len(new.(*schema.Set).List()) == 0
}),
),
// aws/resource_aws_route53_zone_test.go
// Reference: https://github.com/terraform-providers/terraform-provider-aws/issues/7614
func TestAccAWSRoute53Zone_VPC_ForceNewIfChange(t *testing.T) {
var zone1, zone2, zone3 route53.GetHostedZoneOutput
rName := acctest.RandomWithPrefix("tf-acc-test")
resourceName := "aws_route53_zone.test"
vpcResourceName := "aws_vpc.test1"
zoneName := fmt.Sprintf("%s.terraformtest.com", rName)
resource.ParallelTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckRoute53ZoneDestroy,
Steps: []resource.TestStep{
{
Config: testAccRoute53ZoneConfig(zoneName),
Check: resource.ComposeTestCheckFunc(
testAccCheckRoute53ZoneExists(resourceName, &zone1),
resource.TestCheckResourceAttr(resourceName, "vpc.#", "0"),
),
},
{
Config: testAccRoute53ZoneConfigVPCSingle(rName, zoneName),
Check: resource.ComposeTestCheckFunc(
testAccCheckRoute53ZoneExists(resourceName, &zone2),
resource.TestCheckResourceAttr(resourceName, "vpc.#", "1"),
testAccCheckRoute53ZoneAssociatesWithVpc(vpcResourceName, &zone2),
),
},
{
Config: testAccRoute53ZoneConfig(zoneName),
Check: resource.ComposeTestCheckFunc(
testAccCheckRoute53ZoneExists(resourceName, &zone3),
resource.TestCheckResourceAttr(resourceName, "vpc.#", "0"),
),
},
},
})
} Acceptance testing error:
The replacement for the Terraform 0.11 The maintainers are trying to remain focused on shipping Terraform AWS Provider version 2.0.0 the next few days and unfortunately this type of bug would not be considered a blocker for the major version release, but we will intend to investigate this afterwards as time permits. |
Unfortunately, the Terraform 0.12 Provider SDK still does not handle this specific
It may be that setting |
I described possible workaround in https://github.com/hashicorp/terraform/issues/21072#issuecomment-494549431, maybe you could try it? |
I experiencing the same issue. I started working with Terraform when first creating the R53 zones for moving my domain, then creating subnets to connect Redis with the EC2 instance. Now I cannot assign the new VPC from the default VPC the custom VPC. Might it has something to do with the exposed NS servers that I remember can be configured also on the VPC level? |
Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label. If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you! |
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. |
Community Note
Terraform Version
Terraform v0.11.8
Affected Resource(s)
Steps to Reproduce
terraform apply
Add vpc
resource "aws_route53_zone" "local" {
name = "example.local"
vpc {
vpc_id = "${var.vpc_id}"
}
}
terraform apply
status code: 400, request id: xxxx
Expected output
Terraform should force a new resource when switching from public to private. It used to do that with vpc_id parameter but that got depraciated.
The text was updated successfully, but these errors were encountered: