From 304da9fdece4954f619625b7823fa7ad3346125e Mon Sep 17 00:00:00 2001 From: sh0e1 Date: Tue, 25 Jul 2023 01:24:45 +0900 Subject: [PATCH 1/3] r/aws_lightsail_domain_entry: support for AAAA record type --- internal/service/lightsail/domain_entry.go | 1 + .../service/lightsail/domain_entry_test.go | 55 +++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/internal/service/lightsail/domain_entry.go b/internal/service/lightsail/domain_entry.go index f38a2dbd2db..feda09072f8 100644 --- a/internal/service/lightsail/domain_entry.go +++ b/internal/service/lightsail/domain_entry.go @@ -65,6 +65,7 @@ func ResourceDomainEntry() *schema.Resource { Required: true, ValidateFunc: validation.StringInSlice([]string{ "A", + "AAAA", "CNAME", "MX", "NS", diff --git a/internal/service/lightsail/domain_entry_test.go b/internal/service/lightsail/domain_entry_test.go index 1f66999ce8a..cb0882765b1 100644 --- a/internal/service/lightsail/domain_entry_test.go +++ b/internal/service/lightsail/domain_entry_test.go @@ -167,6 +167,46 @@ func TestAccLightsailDomainEntry_disappears(t *testing.T) { }) } +func TestAccLightsailDomainEntry_typeAAAA(t *testing.T) { + ctx := acctest.Context(t) + resourceName := "aws_lightsail_domain_entry.test" + domainName := acctest.RandomDomainName() + domainEntryName := sdkacctest.RandomWithPrefix(acctest.ResourcePrefix) + + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acctest.PreCheck(ctx, t); acctest.PreCheckRegion(t, string(types.RegionNameUsEast1)) }, + ErrorCheck: acctest.ErrorCheck(t, strings.ToLower(lightsail.ServiceID)), + ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories, + CheckDestroy: testAccCheckDomainEntryDestroy(ctx), + Steps: []resource.TestStep{ + { + Config: testAccDomainEntryConfig_typeAAAA(domainName, domainEntryName), + Check: resource.ComposeAggregateTestCheckFunc( + testAccCheckDomainEntryExists(ctx, resourceName), + resource.TestCheckResourceAttr(resourceName, "domain_name", domainName), + resource.TestCheckResourceAttr(resourceName, "name", domainEntryName), + resource.TestCheckResourceAttr(resourceName, "target", "::1"), + resource.TestCheckResourceAttr(resourceName, "type", "AAAA"), + ), + }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + // Validate that we can import an existing resource using the legacy separator + // Validate that the ID is updated to use the new common separator + { + ResourceName: resourceName, + ImportState: true, + ImportStateIdFunc: testAccDomainEntryStateLegacyIdFunc(resourceName), + ImportStateVerify: true, + Check: resource.TestCheckResourceAttr(resourceName, "id", fmt.Sprintf("%s,%s,%s,%s", domainEntryName, domainName, "AAAA", "::1")), + }, + }, + }) +} + func testAccCheckDomainEntryExists(ctx context.Context, n string) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] @@ -236,6 +276,21 @@ resource "aws_lightsail_domain_entry" "test" { `, domainName, domainEntryName) } +func testAccDomainEntryConfig_typeAAAA(domainName string, domainEntryName string) string { + return fmt.Sprintf(` +resource "aws_lightsail_domain" "test" { + domain_name = %[1]q +} + +resource "aws_lightsail_domain_entry" "test" { + domain_name = aws_lightsail_domain.test.id + name = %[2]q + type = "AAAA" + target = "::1" +} +`, domainName, domainEntryName) +} + func testAccDomainEntryStateLegacyIdFunc(resourceName string) resource.ImportStateIdFunc { return func(s *terraform.State) (string, error) { rs, ok := s.RootModule().Resources[resourceName] From 18ca0448499e7e40d9062d22f1c56faf22640e1d Mon Sep 17 00:00:00 2001 From: sh0e1 Date: Tue, 25 Jul 2023 02:05:02 +0900 Subject: [PATCH 2/3] add changelog --- .changelog/32664.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/32664.txt diff --git a/.changelog/32664.txt b/.changelog/32664.txt new file mode 100644 index 00000000000..efd7e358024 --- /dev/null +++ b/.changelog/32664.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/aws_lightsail_domain_entry: Support for AAAA record type +``` From d74b7fec47442a289dc848e0fdca9d5b63839659 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Tue, 25 Jul 2023 08:13:55 -0400 Subject: [PATCH 3/3] Update 32664.txt --- .changelog/32664.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changelog/32664.txt b/.changelog/32664.txt index efd7e358024..43a2781c69b 100644 --- a/.changelog/32664.txt +++ b/.changelog/32664.txt @@ -1,3 +1,3 @@ ```release-note:bug -resource/aws_lightsail_domain_entry: Support for AAAA record type +resource/aws_lightsail_domain_entry: Add support for `AAAA` `type` value ```