@@ -46,16 +46,26 @@ func TestAccScalewayVPCPublicGatewayIP_Basic(t *testing.T) {
46
46
tt := NewTestTools (t )
47
47
defer tt .Cleanup ()
48
48
49
+ testDNSZone := fmt .Sprintf ("%s.%s" , testDomainZone , testDomain )
49
50
resource .ParallelTest (t , resource.TestCase {
50
51
PreCheck : func () { testAccPreCheck (t ) },
51
52
ProviderFactories : tt .ProviderFactories ,
52
53
CheckDestroy : testAccCheckScalewayVPCPublicGatewayIPDestroy (tt ),
53
54
Steps : []resource.TestStep {
54
55
{
55
- Config : `
56
+ Config : fmt .Sprintf (`
57
+ resource "scaleway_domain_record" "tf_A" {
58
+ dns_zone = %[1]q
59
+ name = "tf"
60
+ type = "A"
61
+ data = "${scaleway_vpc_public_gateway_ip.main.address}"
62
+ ttl = 3600
63
+ priority = 1
64
+ }
65
+
56
66
resource scaleway_vpc_public_gateway_ip main {
57
67
}
58
- ` ,
68
+ ` , testDomain ),
59
69
Check : resource .ComposeTestCheckFunc (
60
70
testAccCheckScalewayVPCPublicGatewayIPExists (tt , "scaleway_vpc_public_gateway_ip.main" ),
61
71
resource .TestCheckResourceAttrSet ("scaleway_vpc_public_gateway_ip.main" , "reverse" ),
@@ -65,17 +75,26 @@ func TestAccScalewayVPCPublicGatewayIP_Basic(t *testing.T) {
65
75
),
66
76
},
67
77
{
68
- Config : `
78
+ Config : fmt .Sprintf (`
79
+ resource "scaleway_domain_record" "tf_A" {
80
+ dns_zone = %[1]q
81
+ name = "tf"
82
+ type = "A"
83
+ data = "${scaleway_vpc_public_gateway_ip.main.address}"
84
+ ttl = 3600
85
+ priority = 1
86
+ }
87
+
69
88
resource scaleway_vpc_public_gateway_ip main {
70
- reverse = "example.com"
89
+ reverse = %[2]q
71
90
tags = ["tag0", "tag1"]
72
91
}
73
- ` ,
92
+ ` , testDomain , testDNSZone ),
74
93
Check : resource .ComposeTestCheckFunc (
75
94
testAccCheckScalewayVPCPublicGatewayIPExists (tt , "scaleway_vpc_public_gateway_ip.main" ),
76
95
resource .TestCheckResourceAttr ("scaleway_vpc_public_gateway_ip.main" , "tags.0" , "tag0" ),
77
96
resource .TestCheckResourceAttr ("scaleway_vpc_public_gateway_ip.main" , "tags.1" , "tag1" ),
78
- resource .TestCheckResourceAttr ("scaleway_vpc_public_gateway_ip.main" , "reverse" , "example.com" ),
97
+ resource .TestCheckResourceAttr ("scaleway_vpc_public_gateway_ip.main" , "reverse" , testDNSZone ),
79
98
resource .TestCheckResourceAttrSet ("scaleway_vpc_public_gateway_ip.main" , "address" ),
80
99
resource .TestCheckResourceAttrSet ("scaleway_vpc_public_gateway_ip.main" , "created_at" ),
81
100
resource .TestCheckResourceAttrSet ("scaleway_vpc_public_gateway_ip.main" , "updated_at" ),
0 commit comments