@@ -192,6 +192,52 @@ func TestAccOvhDomainZoneRecord_Updated(t *testing.T) {
192
192
})
193
193
}
194
194
195
+ func TestAccOvhDomainZoneRecord_updateType (t * testing.T ) {
196
+ record := OvhDomainZoneRecord {}
197
+ zone := os .Getenv ("OVH_ZONE" )
198
+ subdomain := acctest .RandomWithPrefix (test_prefix )
199
+
200
+ resource .Test (t , resource.TestCase {
201
+ PreCheck : func () { testAccPreCheck (t ) },
202
+ Providers : testAccProviders ,
203
+ CheckDestroy : testAccCheckOvhDomainZoneRecordDestroy ,
204
+ Steps : []resource.TestStep {
205
+ {
206
+ Config : testAccCheckOvhDomainZoneRecordConfig_A (zone , subdomain , "192.168.0.1" , 3600 ),
207
+ Check : resource .ComposeTestCheckFunc (
208
+ testAccCheckOvhDomainZoneRecordExists ("ovh_domain_zone_record.foobar" , & record ),
209
+ resource .TestCheckResourceAttr (
210
+ "ovh_domain_zone_record.foobar" , "subdomain" , subdomain ),
211
+ resource .TestCheckResourceAttr (
212
+ "ovh_domain_zone_record.foobar" , "zone" , zone ),
213
+ resource .TestCheckResourceAttr (
214
+ "ovh_domain_zone_record.foobar" , "target" , "192.168.0.1" ),
215
+ resource .TestCheckResourceAttr (
216
+ "ovh_domain_zone_record.foobar" , "fieldtype" , "A" ),
217
+ resource .TestCheckResourceAttr (
218
+ "ovh_domain_zone_record.foobar" , "ttl" , "3600" ),
219
+ ),
220
+ },
221
+ {
222
+ Config : testAccCheckOvhDomainZoneRecordConfig_CNAME (zone , subdomain , "google.com." , 3600 ),
223
+ Check : resource .ComposeTestCheckFunc (
224
+ testAccCheckOvhDomainZoneRecordExists ("ovh_domain_zone_record.foobar" , & record ),
225
+ resource .TestCheckResourceAttr (
226
+ "ovh_domain_zone_record.foobar" , "subdomain" , subdomain ),
227
+ resource .TestCheckResourceAttr (
228
+ "ovh_domain_zone_record.foobar" , "zone" , zone ),
229
+ resource .TestCheckResourceAttr (
230
+ "ovh_domain_zone_record.foobar" , "target" , "google.com." ),
231
+ resource .TestCheckResourceAttr (
232
+ "ovh_domain_zone_record.foobar" , "fieldtype" , "CNAME" ),
233
+ resource .TestCheckResourceAttr (
234
+ "ovh_domain_zone_record.foobar" , "ttl" , "3600" ),
235
+ ),
236
+ },
237
+ },
238
+ })
239
+ }
240
+
195
241
func testAccCheckOvhDomainZoneRecordDestroy (s * terraform.State ) error {
196
242
provider := testAccProvider .Meta ().(* Config )
197
243
zone := os .Getenv ("OVH_ZONE" )
@@ -257,3 +303,14 @@ resource "ovh_domain_zone_record" "foobar" {
257
303
ttl = %d
258
304
}` , zone , subdomain , target , ttl )
259
305
}
306
+
307
+ func testAccCheckOvhDomainZoneRecordConfig_CNAME (zone , subdomain , target string , ttl int ) string {
308
+ return fmt .Sprintf (`
309
+ resource "ovh_domain_zone_record" "foobar" {
310
+ zone = "%s"
311
+ subdomain = "%s"
312
+ target = "%s"
313
+ fieldtype = "CNAME"
314
+ ttl = %d
315
+ }` , zone , subdomain , target , ttl )
316
+ }
0 commit comments