Skip to content

Commit

Permalink
fix: registered domain import & bump go client
Browse files Browse the repository at this point in the history
  • Loading branch information
DXTimer committed Aug 30, 2023
1 parent 441e9fe commit 5e239dd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module github.com/terraform-providers/terraform-provider-dnsimple

require (
github.com/dnsimple/dnsimple-go v1.2.2-0.20230824051107-a0bab607f157
github.com/dnsimple/dnsimple-go v1.3.0
github.com/hashicorp/terraform-plugin-docs v0.14.1
github.com/hashicorp/terraform-plugin-framework v1.2.0
github.com/hashicorp/terraform-plugin-go v0.15.0
Expand Down
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dnsimple/dnsimple-go v1.2.2-0.20230823141904-43e6f15ef5d7 h1:S/F27dBsRFHux0uMr6x+yUKQhkeq0BbG7qGZ67dmBIE=
github.com/dnsimple/dnsimple-go v1.2.2-0.20230823141904-43e6f15ef5d7/go.mod h1:G7a16dj2TULTldjxg1EAcSxonEqx0gkTOP8PESBai+4=
github.com/dnsimple/dnsimple-go v1.2.2-0.20230824051107-a0bab607f157 h1:dhNQbRM9L/fwPM3SjymBJX3zXPf/Aah8HCXiuSLI984=
github.com/dnsimple/dnsimple-go v1.2.2-0.20230824051107-a0bab607f157/go.mod h1:G7a16dj2TULTldjxg1EAcSxonEqx0gkTOP8PESBai+4=
github.com/dnsimple/dnsimple-go v1.3.0 h1:8hv9JZdfMLGUp5QIX1VndDWsMd3kY/9H3TRA7Zyyo/E=
github.com/dnsimple/dnsimple-go v1.3.0/go.mod h1:G7a16dj2TULTldjxg1EAcSxonEqx0gkTOP8PESBai+4=
github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg=
github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o=
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
Expand Down
7 changes: 7 additions & 0 deletions internal/framework/resources/registered_domain/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ func (r *RegisteredDomainResource) updateModelFromAPIResponse(ctx context.Contex
data.UnicodeName = types.StringValue(domain.UnicodeName)
data.AccountId = types.Int64Value(domain.AccountID)

// If the contact_id is null, we need to set it to the registrant_id from the domain
// this can happen when the contact_id is not set in the config, and the domain is imported
if data.ContactId.IsNull() {
data.ContactId = types.Int64Value(domain.RegistrantID)
}

if data.ContactId.ValueInt64() != domain.RegistrantID {
diags.AddWarning(
fmt.Sprintf(`The contact_id does not match your local state and what you have at DNSimple for: domain=%s config_contact_id=%d remote_contact_id=%d.
Expand All @@ -134,6 +140,7 @@ Until the change has completed successfully you will continue to receive this wa
"update plan's resource contact_id to match remote state",
)
}

data.ExpiresAt = types.StringValue(domain.ExpiresAt)
data.Name = types.StringValue(domain.Name)
}
Expand Down

0 comments on commit 5e239dd

Please sign in to comment.