Skip to content

Commit

Permalink
remove fix & fix nits
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoineDona committed Mar 10, 2025
1 parent 3e60f87 commit 7e67bd4
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 73 deletions.
22 changes: 11 additions & 11 deletions datadog/fwprovider/resource_datadog_synthetics_private_location.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ type syntheticsPrivateLocationResource struct {
}

type syntheticsPrivateLocationModel struct {
Id types.String `tfsdk:"id"`
Config types.String `tfsdk:"config"`
Description types.String `tfsdk:"description"`
Metadata []metadataModel `tfsdk:"metadata"`
Name types.String `tfsdk:"name"`
Tags types.List `tfsdk:"tags"`
Id types.String `tfsdk:"id"`
Config types.String `tfsdk:"config"`
Description types.String `tfsdk:"description"`
Metadata []syntheticsPrivateLocationMetadataModel `tfsdk:"metadata"`
Name types.String `tfsdk:"name"`
Tags types.List `tfsdk:"tags"`
}

type metadataModel struct {
type syntheticsPrivateLocationMetadataModel struct {
RestrictedRoles types.Set `tfsdk:"restricted_roles"`
}

Expand Down Expand Up @@ -241,9 +241,9 @@ func (r *syntheticsPrivateLocationResource) updateState(ctx context.Context, sta

if metadata, ok := resp.GetMetadataOk(); ok {
if restrictedRoles, ok := metadata.GetRestrictedRolesOk(); ok {
localMetadata := metadataModel{}
localMetadata := syntheticsPrivateLocationMetadataModel{}
localMetadata.RestrictedRoles, _ = types.SetValueFrom(ctx, types.StringType, *restrictedRoles)
state.Metadata = []metadataModel{localMetadata}
state.Metadata = []syntheticsPrivateLocationMetadataModel{localMetadata}
}
}
}
Expand All @@ -258,15 +258,15 @@ func (r *syntheticsPrivateLocationResource) buildSyntheticsPrivateLocationReques
syntheticsPrivateLocation.SetDescription(state.Description.ValueString())
}

metadata := datadogV1.SyntheticsPrivateLocationMetadata{}
if state.Metadata != nil {
if len(state.Metadata) == 1 && !state.Metadata[0].RestrictedRoles.IsNull() {
metadata := datadogV1.SyntheticsPrivateLocationMetadata{}
var restrictedRoles []string
diags.Append(state.Metadata[0].RestrictedRoles.ElementsAs(ctx, &restrictedRoles, false)...)
metadata.SetRestrictedRoles(restrictedRoles)
syntheticsPrivateLocation.SetMetadata(metadata)
}
}
syntheticsPrivateLocation.SetMetadata(metadata)

tags := make([]string, 0)
if !state.Tags.IsNull() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2025-03-05T14:46:14.975494+01:00
2025-03-10T11:10:24.154949+01:00

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
2025-03-05T14:46:14.975451+01:00
2025-03-10T11:10:24.154854+01:00

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
2025-03-05T14:46:14.975351+01:00
2025-03-10T11:10:24.15482+01:00

Large diffs are not rendered by default.

0 comments on commit 7e67bd4

Please sign in to comment.