Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
bflad committed Oct 12, 2021
1 parent 46c610d commit 5f6ea40
Showing 1 changed file with 49 additions and 4 deletions.
53 changes: 49 additions & 4 deletions helper/schema/resource_data_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2096,10 +2096,10 @@ func TestResourceDataHasChange(t *testing.T) {

State: &terraform.InstanceState{
Attributes: map[string]string{
"network_configuration.#": "1",
"network_configuration.0.security_groups.#": "2",
"network_configuration.0.security_groups.sg1": "sg1",
"network_configuration.0.security_groups.sg2": "sg2",
"network_configuration.#": "1",
"network_configuration.0.security_groups.#": "2",
"network_configuration.0.security_groups.1268622331": "sg2",
"network_configuration.0.security_groups.3532976705": "sg1",
},
},

Expand All @@ -2111,6 +2111,51 @@ func TestResourceDataHasChange(t *testing.T) {

Change: false,
},

{
Schema: map[string]*Schema{
"network_configuration": {
Type: TypeList,
MaxItems: 1,
Elem: &Resource{
Schema: map[string]*Schema{
"security_groups": {
Type: TypeSet,
Optional: true,
Elem: &Schema{Type: TypeString},
Set: HashString,
},
},
},
},
},

State: &terraform.InstanceState{
Attributes: map[string]string{
"network_configuration.#": "1",
"network_configuration.0.security_groups.#": "2",
"network_configuration.0.security_groups.1268622331": "sg2",
"network_configuration.0.security_groups.3532976705": "sg1",
},
},

Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{
"network_configuration.0.security_groups.1268622331": {
Old: "sg2",
New: "",
},
"network_configuration.0.security_groups.1016763245": {
Old: "",
New: "sg3",
},
},
},

Key: "network_configuration",

Change: true,
},
}

for i, tc := range cases {
Expand Down

0 comments on commit 5f6ea40

Please sign in to comment.