diff --git a/pkg/resource/aws/aws_route53_record_test.go b/pkg/resource/aws/aws_route53_record_test.go new file mode 100644 index 00000000..b8f072ae --- /dev/null +++ b/pkg/resource/aws/aws_route53_record_test.go @@ -0,0 +1,26 @@ +package aws_test + +import ( + "testing" + + "github.com/cloudskiff/driftctl/test/acceptance" +) + +func TestAcc_AwsRoute53Record_WithFQDNAsId(t *testing.T) { + acceptance.Run(t, acceptance.AccTestCase{ + Path: "./testdata/acc/aws_route53_record", + Args: []string{"scan", "--filter", "Type=='aws_route53_record'"}, + Checks: []acceptance.AccCheck{ + { + Check: func(result *acceptance.ScanResult, stdout string, err error) { + if err != nil { + t.Fatal(err) + } + result.AssertDriftCountTotal(0) + result.Equal(0, result.Summary().TotalDeleted) + result.Equal(4, result.Summary().TotalManaged) + }, + }, + }, + }) +} diff --git a/pkg/resource/aws/testdata/acc/aws_route53_record/providers.tf b/pkg/resource/aws/testdata/acc/aws_route53_record/providers.tf new file mode 100644 index 00000000..8234795a --- /dev/null +++ b/pkg/resource/aws/testdata/acc/aws_route53_record/providers.tf @@ -0,0 +1,10 @@ +provider "aws" { + region = "eu-west-3" +} +terraform { + required_providers { + aws = { + version = "~> 3.19.0" + } + } +} \ No newline at end of file diff --git a/pkg/resource/aws/testdata/acc/aws_route53_record/route53.tf b/pkg/resource/aws/testdata/acc/aws_route53_record/route53.tf new file mode 100644 index 00000000..11bb9aa8 --- /dev/null +++ b/pkg/resource/aws/testdata/acc/aws_route53_record/route53.tf @@ -0,0 +1,35 @@ +resource "aws_route53_zone" "foo-zone" { + name = "foo-2.com" +} + +resource "aws_route53_record" "foo-record" { + zone_id = aws_route53_zone.foo-zone.zone_id + name = "test0" + type = "TXT" + ttl = 300 + records = ["test0"] +} + +resource "aws_route53_record" "foo-record-2" { + zone_id = aws_route53_zone.foo-zone.zone_id + name = "test1.foo-2.com" + type = "TXT" + ttl = 300 + records = ["test1.foo-2.com"] +} + +resource "aws_route53_record" "foo-record-bis-3" { + zone_id = aws_route53_zone.foo-zone.zone_id + name = "_test2.foo-2.com" + type = "TXT" + ttl = 300 + records = ["_test2.foo-2.com"] +} + +resource "aws_route53_record" "foo-record-bis-4" { + zone_id = aws_route53_zone.foo-zone.zone_id + name = "test3." + type = "TXT" + ttl = 300 + records = ["test3."] +}