Skip to content

Commit

Permalink
Add new redirect APIs (#307)
Browse files Browse the repository at this point in the history
* Add new redirect APIs

* Update objects

* Update ns1-go

* Add changelog and new version

* Add note in doc

* Force to use the wildcard cert in test

* Fix tags update

* Enabling import

* Two more test scenarios and fixes for it

* Making cert mandatory for HTTPS and removing no-cert test scenario

* Make cert create/delete sync by active wait, and https_enabled read-only

* Add further active waits to align to remote changes

* Unit test fixes

* Move client to runtime

* Aligning create just in case

* Update release date

* Change tags into a set, make more fields in the cert read only

* Remove slices package that isn't supported on older go

* Remove processing flag from docs as we're no longer exposing it on the cert
  • Loading branch information
fformica authored Jun 18, 2024
1 parent eb8f104 commit b06bab5
Show file tree
Hide file tree
Showing 11 changed files with 1,079 additions and 25 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
## 2.3.0 (June 17, 2024)
ENHANCEMENTS
* Adds support for redirect endpoints
BUGFIX
* Lifting ordering constraint on regions in record resource

## 2.2.2 (May 21, 2024)
BUGFIX
* Lifting ordering constraint on ns1_notifylist notifications objects
* Documentation fix for `tags`

## 2.2.1 (April 3, 2024)
BUGFIX
* `ns1-go` client version bump to fix omitting tags
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/hashicorp/go-retryablehttp v0.7.2
github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.1
github.com/stretchr/testify v1.8.1
gopkg.in/ns1/ns1-go.v2 v2.9.1
gopkg.in/ns1/ns1-go.v2 v2.11.0
)

require (
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,8 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/ns1/ns1-go.v2 v2.9.1 h1:3/QYzUazRCSE49d3sh1Q+X7IrDp/I7OqR/M7dKA0Oks=
gopkg.in/ns1/ns1-go.v2 v2.9.1/go.mod h1:pfaU0vECVP7DIOr453z03HXS6dFJpXdNRwOyRzwmPSc=
gopkg.in/ns1/ns1-go.v2 v2.11.0 h1:T+rMHhQsQ58bSgGZwX8INxU0sjDO7cWieX9xPr/UEY4=
gopkg.in/ns1/ns1-go.v2 v2.11.0/go.mod h1:pfaU0vECVP7DIOr453z03HXS6dFJpXdNRwOyRzwmPSc=
gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME=
gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
Expand Down
2 changes: 1 addition & 1 deletion ns1/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
)

var (
clientVersion = "2.2.2"
clientVersion = "2.3.0"
providerUserAgent = "tf-ns1" + "/" + clientVersion
defaultRetryMax = 3
)
Expand Down
17 changes: 17 additions & 0 deletions ns1/examples/redirect.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

resource "ns1_redirect_certificate" "example" {
domain = "*.example.com"
}

resource "ns1_redirect" "example" {
certificate_id = "${ns1_redirect_certificate.example.id}"
domain = "www.example.com"
path = "/from/path"
target = "https://url.com/target/path"
forwarding_mode = "all"
forwarding_type = "permanent"
https_enabled = true
https_forced = true
query_forwarding = true
tags = []
}
34 changes: 18 additions & 16 deletions ns1/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,24 @@ func Provider() *schema.Provider {
"ns1_monitoring_regions": dataSourceMonitoringRegions(),
},
ResourcesMap: map[string]*schema.Resource{
"ns1_zone": resourceZone(),
"ns1_record": recordResource(),
"ns1_datasource": dataSourceResource(),
"ns1_datafeed": dataFeedResource(),
"ns1_monitoringjob": monitoringJobResource(),
"ns1_notifylist": notifyListResource(),
"ns1_user": userResource(),
"ns1_apikey": apikeyResource(),
"ns1_team": teamResource(),
"ns1_application": resourceApplication(),
"ns1_pulsarjob": pulsarJobResource(),
"ns1_tsigkey": tsigKeyResource(),
"ns1_subnet": resourceSubnet(),
"ns1_dnsview": dnsView(),
"ns1_account_whitelist": accountWhitelistResource(),
"ns1_dataset": datasetResource(),
"ns1_zone": resourceZone(),
"ns1_record": recordResource(),
"ns1_datasource": dataSourceResource(),
"ns1_datafeed": dataFeedResource(),
"ns1_monitoringjob": monitoringJobResource(),
"ns1_notifylist": notifyListResource(),
"ns1_user": userResource(),
"ns1_apikey": apikeyResource(),
"ns1_team": teamResource(),
"ns1_application": resourceApplication(),
"ns1_pulsarjob": pulsarJobResource(),
"ns1_tsigkey": tsigKeyResource(),
"ns1_subnet": resourceSubnet(),
"ns1_dnsview": dnsView(),
"ns1_account_whitelist": accountWhitelistResource(),
"ns1_dataset": datasetResource(),
"ns1_redirect": redirectConfigResource(),
"ns1_redirect_certificate": redirectCertificateResource(),
},
ConfigureFunc: ns1Configure,
}
Expand Down
10 changes: 5 additions & 5 deletions ns1/resource_record_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1311,17 +1311,17 @@ resource "ns1_record" "it" {
domain = "test.${ns1_zone.test.zone}"
type = "CNAME"
ttl = 60
answers {
answer = "test1.${ns1_zone.test.zone}"
region = "cal"
}
regions {
name = "cal"
}
}
resource "ns1_zone" "test" {
zone = "terraform-test-%s.io"
}
Expand Down Expand Up @@ -1365,7 +1365,7 @@ resource "ns1_record" "it" {
type = "A"
answers {
answer = "1.2.3.4"
meta = {
up = true
subdivisions = jsonencode({
Expand Down Expand Up @@ -1397,7 +1397,7 @@ resource "ns1_monitoringjob" "test" {
name = "terraform-test-%s"
active = true
regions = [
"ams"
"nrt"
]
job_type = "http"
frequency = 60
Expand Down
Loading

0 comments on commit b06bab5

Please sign in to comment.