Skip to content

Commit

Permalink
fix(cts): add null check before using agency_name (#5219)
Browse files Browse the repository at this point in the history
  • Loading branch information
profoundwu authored Jul 17, 2024
1 parent 136abc0 commit c190170
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -402,9 +402,12 @@ func resourceCTSDataTrackerRead(_ context.Context, d *schema.ResourceData, meta
d.Set("name", ctsTracker.TrackerName),
d.Set("lts_enabled", ctsTracker.Lts.IsLtsEnabled),
d.Set("validate_file", ctsTracker.IsSupportValidate),
d.Set("agency_name", ctsTracker.AgencyName.Value()),
)

if ctsTracker.AgencyName != nil {
mErr = multierror.Append(mErr, d.Set("agency_name", ctsTracker.AgencyName.Value()))
}

if ctsTracker.DataBucket != nil {
mErr = multierror.Append(mErr, d.Set("data_bucket", ctsTracker.DataBucket.DataBucketName))

Expand Down
5 changes: 4 additions & 1 deletion huaweicloud/services/cts/resource_huaweicloud_cts_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,12 @@ func resourceCTSTrackerRead(_ context.Context, d *schema.ResourceData, meta inte
d.Set("organization_enabled", ctsTracker.IsOrganizationTracker),
d.Set("validate_file", ctsTracker.IsSupportValidate),
d.Set("kms_id", ctsTracker.KmsId),
d.Set("agency_name", ctsTracker.AgencyName.Value()),
)

if ctsTracker.AgencyName != nil {
mErr = multierror.Append(mErr, d.Set("agency_name", ctsTracker.AgencyName.Value()))
}

if ctsTracker.ObsInfo != nil {
bucketName := ctsTracker.ObsInfo.BucketName
mErr = multierror.Append(
Expand Down

0 comments on commit c190170

Please sign in to comment.