Skip to content

Commit 7c8a3ef

Browse files
authored
Merge pull request #305 from ns1-terraform/release-v2.0.10
release-v2.0.10
2 parents 36eaae5 + c62c256 commit 7c8a3ef

5 files changed

Lines changed: 118 additions & 11 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.0.10 (October 12, 2023)
2+
BUGFIX
3+
* `ns1-go` client version bump to fix omitting tags
4+
15
## 2.0.9 (October 11, 2023)
26
ENHANCEMENTS
37
* Added support for zone and record tags

go.mod

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ require (
77
github.com/hashicorp/go-retryablehttp v0.7.2
88
github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.1
99
github.com/stretchr/testify v1.8.1
10-
gopkg.in/ns1/ns1-go.v2 v2.7.12
11-
10+
gopkg.in/ns1/ns1-go.v2 v2.7.13
1211
)
1312

1413
require (

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,8 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8
250250
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
251251
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
252252
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
253-
gopkg.in/ns1/ns1-go.v2 v2.7.12 h1:QhpKxzYNN12DfoKwwPqR2+BslU4oFPP+bF4s0imbNoI=
254-
gopkg.in/ns1/ns1-go.v2 v2.7.12/go.mod h1:pfaU0vECVP7DIOr453z03HXS6dFJpXdNRwOyRzwmPSc=
253+
gopkg.in/ns1/ns1-go.v2 v2.7.13 h1:r07CLALg18f/L1KIK1ZJdbirBV349UtYT1rDWGjnaTk=
254+
gopkg.in/ns1/ns1-go.v2 v2.7.13/go.mod h1:pfaU0vECVP7DIOr453z03HXS6dFJpXdNRwOyRzwmPSc=
255255
gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME=
256256
gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
257257
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

ns1/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
)
2020

2121
var (
22-
clientVersion = "2.0.9"
22+
clientVersion = "2.0.10"
2323
providerUserAgent = "tf-ns1" + "/" + clientVersion
2424
defaultRetryMax = 3
2525
)

ns1/resource_record_test.go

Lines changed: 110 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,6 @@ func TestAccRecord_updated(t *testing.T) {
9090
testAccCheckRecordAnswerRdata(
9191
t, &record, 0, []string{fmt.Sprintf("test2.%s", zoneName)},
9292
),
93-
testAccCheckRecordTagData(
94-
map[string]string{"tag1": "location1", "tag2": "location2"},
95-
&record,
96-
),
9793
),
9894
},
9995
{
@@ -453,6 +449,59 @@ func TestAccRecord_WithTags(t *testing.T) {
453449
})
454450
}
455451

452+
func TestAccRecord_updatedWithTags(t *testing.T) {
453+
var record dns.Record
454+
rString := acctest.RandStringFromCharSet(15, acctest.CharSetAlphaNum)
455+
zoneName := fmt.Sprintf("terraform-test-%s.io", rString)
456+
domainName := fmt.Sprintf("test.%s", zoneName)
457+
458+
resource.Test(t, resource.TestCase{
459+
PreCheck: func() { testAccPreCheck(t) },
460+
Providers: testAccProviders,
461+
CheckDestroy: testAccCheckRecordDestroy,
462+
Steps: []resource.TestStep{
463+
{
464+
Config: testAccRecordBasic(rString),
465+
Check: resource.ComposeTestCheckFunc(
466+
testAccCheckRecordExists("ns1_record.it", &record),
467+
testAccCheckRecordDomain(&record, domainName),
468+
testAccCheckRecordTTL(&record, 60),
469+
testAccCheckRecordUseClientSubnet(&record, true),
470+
testAccCheckRecordRegionName(&record, []string{"cal"}),
471+
// testAccCheckRecordAnswerMetaWeight(&record, 10),
472+
testAccCheckRecordAnswerRdata(
473+
t, &record, 0, []string{fmt.Sprintf("test1.%s", zoneName)},
474+
),
475+
),
476+
},
477+
{
478+
Config: testAccRecordUpdatedWithTags(rString),
479+
Check: resource.ComposeTestCheckFunc(
480+
testAccCheckRecordExists("ns1_record.it", &record),
481+
testAccCheckRecordDomain(&record, domainName),
482+
testAccCheckRecordTTL(&record, 120),
483+
testAccCheckRecordUseClientSubnet(&record, false),
484+
testAccCheckRecordRegionName(&record, []string{"ny", "wa"}),
485+
// testAccCheckRecordAnswerMetaWeight(&record, 5),
486+
testAccCheckRecordAnswerRdata(
487+
t, &record, 0, []string{fmt.Sprintf("test2.%s", zoneName)},
488+
),
489+
testAccCheckRecordTagData(
490+
map[string]string{"tag1": "location1", "tag2": "location2"},
491+
&record,
492+
),
493+
),
494+
},
495+
{
496+
ResourceName: "ns1_record.it",
497+
ImportState: true,
498+
ImportStateId: fmt.Sprintf("%s/%s/CNAME", zoneName, domainName),
499+
ImportStateVerify: true,
500+
},
501+
},
502+
})
503+
}
504+
456505
func TestAccRecord_validationError(t *testing.T) {
457506
rString := acctest.RandStringFromCharSet(15, acctest.CharSetAlphaNum)
458507

@@ -1247,8 +1296,6 @@ resource "ns1_record" "it" {
12471296
filters {
12481297
filter = "geotarget_country"
12491298
}
1250-
1251-
tags = {tag1: "location1", tag2: "location2"}
12521299
}
12531300
12541301
resource "ns1_zone" "test" {
@@ -1533,6 +1580,63 @@ resource "ns1_zone" "test" {
15331580
`, rString)
15341581
}
15351582

1583+
func testAccRecordUpdatedWithTags(rString string) string {
1584+
return fmt.Sprintf(`
1585+
resource "ns1_record" "it" {
1586+
zone = "${ns1_zone.test.zone}"
1587+
domain = "test.${ns1_zone.test.zone}"
1588+
type = "CNAME"
1589+
ttl = 120
1590+
use_client_subnet = false
1591+
1592+
// meta {
1593+
// weight = 5
1594+
// connections = 3
1595+
// // up = false // Ignored by d.GetOk("meta.0.up") due to known issue
1596+
// }
1597+
1598+
answers {
1599+
answer = "test2.${ns1_zone.test.zone}"
1600+
region = "ny"
1601+
1602+
// meta {
1603+
// weight = 5
1604+
// up = true
1605+
// }
1606+
}
1607+
1608+
regions {
1609+
name = "ny"
1610+
// meta {
1611+
// us_state = ["NY"]
1612+
// }
1613+
}
1614+
1615+
regions {
1616+
name = "wa"
1617+
// meta {
1618+
// us_state = ["WA"]
1619+
// }
1620+
}
1621+
1622+
filters {
1623+
filter = "select_first_n"
1624+
config = {N=1}
1625+
}
1626+
1627+
filters {
1628+
filter = "geotarget_country"
1629+
}
1630+
1631+
tags = {tag1: "location1", tag2: "location2"}
1632+
}
1633+
1634+
resource "ns1_zone" "test" {
1635+
zone = "terraform-test-%s.io"
1636+
}
1637+
`, rString)
1638+
}
1639+
15361640
// zone and domain have leading and trailing dots and should fail validation.
15371641
func testAccRecordInvalid(rString string) string {
15381642
return fmt.Sprintf(`

0 commit comments

Comments
 (0)