Skip to content

Commit

Permalink
fix permadiff by reading empty docker_config field (#10113) (#17484)
Browse files Browse the repository at this point in the history
[upstream:c4d1efa32fa9aec82c1951a596f115b2ac443d88]

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Mar 4, 2024
1 parent b05aedf commit 9a5e3a0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .changelog/10113.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
artifactregistry: fixed docker_config permadiff
```
Original file line number Diff line number Diff line change
Expand Up @@ -1079,9 +1079,6 @@ func flattenArtifactRegistryRepositoryDockerConfig(v interface{}, d *schema.Reso
return nil
}
original := v.(map[string]interface{})
if len(original) == 0 {
return nil
}
transformed := make(map[string]interface{})
transformed["immutable_tags"] =
flattenArtifactRegistryRepositoryDockerConfigImmutableTags(original["immutableTags"], d, config)
Expand Down Expand Up @@ -1525,9 +1522,14 @@ func expandArtifactRegistryRepositoryKmsKeyName(v interface{}, d tpgresource.Ter

func expandArtifactRegistryRepositoryDockerConfig(v interface{}, d tpgresource.TerraformResourceData, config *transport_tpg.Config) (interface{}, error) {
l := v.([]interface{})
if len(l) == 0 || l[0] == nil {
if len(l) == 0 {
return nil, nil
}

if l[0] == nil {
transformed := make(map[string]interface{})
return transformed, nil
}
raw := l[0]
original := raw.(map[string]interface{})
transformed := make(map[string]interface{})
Expand Down

0 comments on commit 9a5e3a0

Please sign in to comment.