Skip to content

Commit

Permalink
CDPCP-10617 - Errors when specifying tags in CDP provider resources
Browse files Browse the repository at this point in the history
  • Loading branch information
gregito committed Jan 24, 2024
1 parent 002445b commit 2497fcd
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 15 deletions.
6 changes: 1 addition & 5 deletions resources/environments/converter_gcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,8 @@ func toGcpEnvironmentResource(ctx context.Context, env *environmentsmodels.Envir
model.StatusReason = types.StringValue(env.StatusReason)
tflog.Info(ctx, "about to convert tags.")
if env.Tags != nil {
merged := env.Tags.Defaults
for k, v := range env.Tags.UserDefined {
merged[k] = v
}
var tagDiags diag.Diagnostics
tagMap, tagDiags := types.MapValueFrom(ctx, types.StringType, merged)
tagMap, tagDiags := types.MapValueFrom(ctx, types.StringType, env.Tags.UserDefined)
diags.Append(tagDiags...)
model.Tags = tagMap
}
Expand Down
6 changes: 1 addition & 5 deletions resources/environments/resource_aws_environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,12 +203,8 @@ func toAwsEnvironmentResource(ctx context.Context, env *environmentsmodels.Envir
model.Status = types.StringPointerValue(env.Status)
model.StatusReason = types.StringValue(env.StatusReason)
if env.Tags != nil {
merged := env.Tags.Defaults
for k, v := range env.Tags.UserDefined {
merged[k] = v
}
var tagDiags diag.Diagnostics
tagMap, tagDiags := types.MapValueFrom(ctx, types.StringType, merged)
tagMap, tagDiags := types.MapValueFrom(ctx, types.StringType, env.Tags.UserDefined)
diags.Append(tagDiags...)
model.Tags = tagMap
}
Expand Down
6 changes: 1 addition & 5 deletions resources/environments/resource_azure_environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,7 @@ func toAzureEnvironmentResource(ctx context.Context, env *environmentsmodels.Env
model.Status = types.StringPointerValue(env.Status)
model.StatusReason = types.StringValue(env.StatusReason)
if env.Tags != nil {
merged := env.Tags.Defaults
for k, v := range env.Tags.UserDefined {
merged[k] = v
}
tagMap, tagDiags := types.MapValueFrom(ctx, types.StringType, merged)
tagMap, tagDiags := types.MapValueFrom(ctx, types.StringType, env.Tags.UserDefined)
diags.Append(tagDiags...)
model.Tags = tagMap
}
Expand Down

0 comments on commit 2497fcd

Please sign in to comment.