Skip to content

Commit 07d9bb0

Browse files
committed
providers/dnsimple: handle custom domains
1 parent 8b2c805 commit 07d9bb0

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

builtin/providers/dnsimple/resource_dnsimple_record_test.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package dnsimple
22

33
import (
44
"fmt"
5+
"os"
56
"strconv"
67
"testing"
78

@@ -12,21 +13,22 @@ import (
1213

1314
func TestAccDNSimpleRecord_Basic(t *testing.T) {
1415
var record dnsimple.Record
16+
domain := os.Getenv("DNSIMPLE_DOMAIN")
1517

1618
resource.Test(t, resource.TestCase{
1719
PreCheck: func() { testAccPreCheck(t) },
1820
Providers: testAccProviders,
1921
CheckDestroy: testAccCheckDNSimpleRecordDestroy,
2022
Steps: []resource.TestStep{
2123
resource.TestStep{
22-
Config: testAccCheckDNSimpleRecordConfig_basic,
24+
Config: fmt.Sprintf(testAccCheckDNSimpleRecordConfig_basic, domain),
2325
Check: resource.ComposeTestCheckFunc(
2426
testAccCheckDNSimpleRecordExists("dnsimple_record.foobar", &record),
2527
testAccCheckDNSimpleRecordAttributes(&record),
2628
resource.TestCheckResourceAttr(
2729
"dnsimple_record.foobar", "name", "terraform"),
2830
resource.TestCheckResourceAttr(
29-
"dnsimple_record.foobar", "domain", "jack.ly"),
31+
"dnsimple_record.foobar", "domain", domain),
3032
resource.TestCheckResourceAttr(
3133
"dnsimple_record.foobar", "value", "192.168.0.10"),
3234
),
@@ -106,7 +108,7 @@ func testAccCheckDNSimpleRecordExists(n string, record *dnsimple.Record) resourc
106108

107109
const testAccCheckDNSimpleRecordConfig_basic = `
108110
resource "dnsimple_record" "foobar" {
109-
domain = "jack.ly"
111+
domain = "%s"
110112
111113
name = "terraform"
112114
value = "192.168.0.10"

builtin/providers/dnsimple/resource_provider_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,8 @@ func testAccPreCheck(t *testing.T) {
7373
if v := os.Getenv("DNSIMPLE_TOKEN"); v == "" {
7474
t.Fatal("DNSIMPLE_TOKEN must be set for acceptance tests")
7575
}
76+
77+
if v := os.Getenv("DNSIMPLE_DOMAIN"); v == "" {
78+
t.Fatal("DNSIMPLE_DOMAIN must be set for acceptance tests. The domain is used to create and destroy record against.")
79+
}
7680
}

0 commit comments

Comments
 (0)