Skip to content

Commit

Permalink
Support domain contact change (#155)
Browse files Browse the repository at this point in the history
This PR reintroduces the domain contact management with a new interface.

Users can now change a domain's contact via the dnsimple_registered_resource.contact_id attribute. Once a change of contact ID is detected for a registered domain we will attempt to change the contact.
Extended attributes for dnsimple_registered_resource can now be edited at any time after the domain has been registered. The attributes are also used for contact change requests.

This PR also re-introduces the dnsimple_registrant_change_check data source, which can be used to see what would be the consequences and requirements of changing a domain's contact.

This PR also comes with some fixes for boolean value comparisons in the dnsimple_registered_domain resource.
In addition the sweeper utility has been updated to carry out sweeps for registrant changes and also allow for registered domain cleanups.
  • Loading branch information
DXTimer authored Sep 21, 2023
1 parent b6db1bf commit a59b45f
Show file tree
Hide file tree
Showing 21 changed files with 1,184 additions and 84 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,20 @@ jobs:
include:
- terraform: '1.0.*'
domain: 'dnsimple-1-0-terraform.bio'
registrant_contact_id: 10854
registrant_change_domain: 'peoa1hvrl5s7q7os1bqadhd29uar81nnc4m0oyaloxex9kapsn20u6nr8z6l5h.eu'
- terraform: '1.1.*'
domain: 'dnsimple-1-1-terraform.bio'
registrant_contact_id: 10169
registrant_change_domain: '9qy9lpesl2f2o5ya45zyujrggori1mh8sl6k2oz37usv48lhn3ziistg3u5kgv.eu'
- terraform: '1.2.*'
domain: 'dnsimple-1-2-terraform.bio'
registrant_contact_id: 10854
registrant_change_domain: 'lqyivkga231hkiqihu0k7bjic2ixd01xs5vex8rmn2iaw0l7gxvhcbicigpfm3.eu'
- terraform: '1.4.*'
domain: 'dnsimple-1-4-terraform.bio'
registrant_contact_id: 10169
registrant_change_domain: 'z0u2w48bo5fzgdsh1g7zjpflbpt0tiyl6tmc75ltzzm6dbphghrgepbaxs6zrm.eu'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
Expand All @@ -90,8 +98,18 @@ jobs:
DNSIMPLE_TOKEN: ${{ secrets.DNSIMPLE_TOKEN }}
DNSIMPLE_DOMAIN: ${{ matrix.domain }}
DNSIMPLE_CONTACT_ID: ${{ secrets.DNSIMPLE_CONTACT_ID }}
DNSIMPLE_REGISTRANT_CHANGE_DOMAIN: ${{ matrix.registrant_change_domain }}
DNSIMPLE_REGISTRANT_CHANGE_CONTACT_ID: ${{ matrix.registrant_contact_id }}
run: go test -v -cover ./internal/... -timeout 15m
timeout-minutes: 10
- run: make sweep
if: always()
env:
DNSIMPLE_SANDBOX: true
DNSIMPLE_ACCOUNT: ${{ secrets.DNSIMPLE_ACCOUNT }}
DNSIMPLE_TOKEN: ${{ secrets.DNSIMPLE_TOKEN }}
DNSIMPLE_DOMAIN: ${{ matrix.domain }}
DNSIMPLE_REGISTRANT_CHANGE_DOMAIN: ${{ matrix.registrant_change_domain }}


slack-workflow-status:
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

## main

## 1.3.0 (Unreleased)

FEATURES:

- **New Data Source:** `dnsimple_registrant_change_check` (dnsimple/terraform-provider-dnsimple#155)
- **Updated Resource:** `dnsimple_registered_domain` now supports the change of `contact_id` which results in domain contact change at the registry (dnsimple/terraform-provider-dnsimple#155)

NOTES:

The `contact_id` attribute previously only supported configuring at resource creation. Now the attribute can be changed and it will result in registrant change being initiated at the registrar. In addition the `extended_attributes` attribute can now also be updated after a domain has been registered and the values in the extended attributes will be passed along the registrant change as some TLDs require extended attributes to be passed along the registrant change.
The registrant change can happen asynchronously for certain contact changes and TLDs. The resource supports this by attempting to sync the state of the registrant change in a similar way to how domain registration works with the `dnsimple_registered_domain` resource.

## 1.2.1

ENHANCEMENTS:
Expand Down
58 changes: 58 additions & 0 deletions docs/data-sources/registrant_change_check.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
page_title: "DNSimple: dnsimple_registrant_change_check"
---

# dnsimple\_registrant_change_check

Get information on the requirements of a registrant change.

-> **Note:** The registrant change API is currently in developer preview and is subject to change.

# Example Usage

Get registrant change requirements for the `dnsimple.com` domain and the contact with ID `1234`:

```hcl
data "dnsimple_registrant_change_check" "example" {
domain_id = "dnsimple.com"
contact_id = "1234"
}
```

# Argument Reference

The following arguments are supported:

* `domain_id` - (Required) The name or ID of the domain.
* `contact_id` - (Required) The ID of the contact you are planning to change to.

# Attributes Reference

The following additional attributes are exported:

* `contact_id` - The ID of the contact you are planning to change to.
* `domain_id` - The name or ID of the domain.
* `extended_attributes` - (List) A list of extended attributes that are required for the registrant change. (see [below for nested schema](#nestedblock--extended_attributes))
* `registry_owner_change` - (Boolean) Whether the registrant change is going to result in an owner change at the registry.

<a id="nestedblock--extended_attributes"></a>

### Nested Schema for `extended_attributes`

Attributes Reference:

- `name` (String) - The name of the extended attribute. e.g. `x-au-registrant-id-type`
- `description` (String) - The description of the extended attribute.
- `required` (Boolean) - Whether the extended attribute is required.
- `options` (List) - A list of options for the extended attribute. (see [below for nested schema](#nestedblock--options))

<a id="nestedblock--options"></a>

### Nested Schema for `extended_attributes.options`

Attributes Reference:

- `title` (String) - The human readable title of the option. e.g. `Australian Company Number (ACN)`
- `value` (String) - The value of the option.
- `description` (String) - The description of the option.

4 changes: 2 additions & 2 deletions docs/resources/registered_domain.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ resource "dnsimple_registered_domain" "appleseed_bio" {
The following argument(s) are supported:

* `name` - (Required) The domain name to be registered
* `contact_id` - (Required) The ID of the contact to be used for the domain registration
* `contact_id` - (Required) The ID of the contact to be used for the domain registration. The contact ID can be changed after the domain has been registered. The change will result in a new registrant change this may result in a [60-day lock](https://support.dnsimple.com/articles/icann-60-day-lock-registrant-change/).
* `auto_renew_enabled` - (Optional) Whether the domain should be set to auto-renew (default: `false`)
* `whois_privacy_enabled` - (Optional) Whether the domain should have WhoIs privacy enabled (default: `false`)
* `dnssec_enabled` - (Optional) Whether the domain should have DNSSEC enabled (default: `false`)
* `transfer_lock_enabled` - (Optional) Whether the domain transfer lock protection is enabled (default: `true`)
* `premium_price` - (Optional) The premium price for the domain registration. This is only required if the domain is a premium domain. You can use our [Check domain API](https://developer.dnsimple.com/v2/registrar/#checkDomain) to check if a domain is premium. And [Retrieve domain prices API](https://developer.dnsimple.com/v2/registrar/#getDomainPrices) to retrieve the premium price for a domain.
* `extended_attributes` - (Optional) A map of extended attributes to be set for the domain registration. To see if there are any required extended attributes for any TLD use our [Lists the TLD Extended Attributes API](https://developer.dnsimple.com/v2/tlds/#getTldExtendedAttributes).
* `extended_attributes` - (Optional) A map of extended attributes to be set for the domain registration. To see if there are any required extended attributes for any TLD use our [Lists the TLD Extended Attributes API](https://developer.dnsimple.com/v2/tlds/#getTldExtendedAttributes). The values provided in the `extended_attributes` will also be sent when a registrant change is initiated as part of changing the `contact_id`.
* `timeouts` - (Optional) (see [below for nested schema](#nestedblock--timeouts))

# Attributes Reference
Expand Down
38 changes: 19 additions & 19 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ module github.com/terraform-providers/terraform-provider-dnsimple
require (
github.com/dnsimple/dnsimple-go v1.4.0
github.com/hashicorp/terraform-plugin-docs v0.16.0
github.com/hashicorp/terraform-plugin-framework v1.2.0
github.com/hashicorp/terraform-plugin-go v0.15.0
github.com/hashicorp/terraform-plugin-framework v1.4.0
github.com/hashicorp/terraform-plugin-go v0.19.0
github.com/hashicorp/terraform-plugin-log v0.9.0
github.com/hashicorp/terraform-plugin-mux v0.10.0
github.com/hashicorp/terraform-plugin-testing v1.2.0
github.com/hashicorp/terraform-plugin-mux v0.12.0
github.com/hashicorp/terraform-plugin-testing v1.5.1
github.com/stretchr/testify v1.8.4
golang.org/x/oauth2 v0.12.0
)
Expand All @@ -16,9 +16,9 @@ require (
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.1.1 // indirect
github.com/Masterminds/sprig/v3 v3.2.2 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230217124315-7d5c6f04bbb8 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230717121422-5aa5874ade95 // indirect
github.com/agext/levenshtein v1.2.2 // indirect
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
github.com/armon/go-radix v1.0.0 // indirect
github.com/bgentry/speakeasy v0.1.0 // indirect
github.com/cloudflare/circl v1.3.3 // indirect
Expand All @@ -34,20 +34,20 @@ require (
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect
github.com/hashicorp/go-hclog v1.5.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-plugin v1.4.9 // indirect
github.com/hashicorp/go-plugin v1.5.1 // indirect
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
github.com/hashicorp/hc-install v0.5.2 // indirect
github.com/hashicorp/hcl/v2 v2.16.2 // indirect
github.com/hashicorp/hc-install v0.6.0 // indirect
github.com/hashicorp/hcl/v2 v2.18.0 // indirect
github.com/hashicorp/logutils v1.0.0 // indirect
github.com/hashicorp/terraform-exec v0.18.1 // indirect
github.com/hashicorp/terraform-exec v0.19.0 // indirect
github.com/hashicorp/terraform-json v0.17.1 // indirect
github.com/hashicorp/terraform-plugin-sdk/v2 v2.26.1 // indirect
github.com/hashicorp/terraform-registry-address v0.2.0 // indirect
github.com/hashicorp/terraform-svchost v0.0.1 // indirect
github.com/hashicorp/terraform-plugin-sdk/v2 v2.29.0 // indirect
github.com/hashicorp/terraform-registry-address v0.2.2 // indirect
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect
github.com/huandu/xstrings v1.3.2 // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/imdario/mergo v0.3.15 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/mitchellh/cli v1.1.5 // indirect
Expand All @@ -65,16 +65,16 @@ require (
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/zclconf/go-cty v1.13.2 // indirect
github.com/zclconf/go-cty v1.14.0 // indirect
golang.org/x/crypto v0.13.0 // indirect
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect
golang.org/x/mod v0.11.0 // indirect
golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/net v0.15.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/text v0.13.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
google.golang.org/grpc v1.54.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect
google.golang.org/grpc v1.57.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Expand Down
Loading

0 comments on commit a59b45f

Please sign in to comment.