Skip to content

Commit

Permalink
Bugfix st-alicloud_alidns_domain_attachment import issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
dejiar authored Jul 14, 2023
1 parent f5cd524 commit 1f5cc62
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions alicloud/resource_alidns_domain_attachment.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,15 @@ func (r *alidnsDomainAttachmentResource) Read(ctx context.Context, req resource.
return
}

readDomainRecord := func() (err error) {
dnsResp := &alicloudDnsClient.DescribeDomainInfoResponse{}
readDomainRecord := func() (err error) {
runtime := &util.RuntimeOptions{}

describeDomainInfoWithDomainRequest := &alicloudDnsClient.DescribeDomainInfoRequest{
DomainName: tea.String(state.Domain.ValueString()),
}

dnsResp, err := r.client.DescribeDomainInfoWithOptions(describeDomainInfoWithDomainRequest, runtime)
dnsResp, err = r.client.DescribeDomainInfoWithOptions(describeDomainInfoWithDomainRequest, runtime)
if err != nil {
if _t, ok := err.(*tea.SDKError); ok {
if isAbleToRetry(*_t.Code) {
Expand All @@ -140,7 +141,6 @@ func (r *alidnsDomainAttachmentResource) Read(ctx context.Context, req resource.
resp.State.RemoveResource(ctx)
return
}

return nil
}

Expand All @@ -154,6 +154,13 @@ func (r *alidnsDomainAttachmentResource) Read(ctx context.Context, req resource.
)
return
}

state.InstanceId = types.StringValue(*dnsResp.Body.InstanceId)
setStateDiags := resp.State.Set(ctx, &state)
resp.Diagnostics.Append(setStateDiags...)
if resp.Diagnostics.HasError() {
return
}
}

func (r *alidnsDomainAttachmentResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {
Expand Down
File renamed without changes.

0 comments on commit 1f5cc62

Please sign in to comment.