Skip to content

Commit 59054d1

Browse files
committed
[ignore] Update to SDKv2. Fix no value bool in mso_tenant_policies_dhcp_relay_policy
1 parent 93ac4e5 commit 59054d1

3 files changed

Lines changed: 7 additions & 3 deletions

File tree

mso/provider_test.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,10 @@ func CustomTestCheckTypeSetElemAttrs(resourceName, setName string, attrsToCheck
245245
match = false
246246
break
247247
}
248-
} else {
248+
} else if expectedVal != "" {
249+
// SDKv2 omits zero-value Optional fields (empty string, false) from
250+
// TypeSet element flat state. Treat an absent key as matching only
251+
// when the expected value is also the zero value ("").
249252
match = false
250253
break
251254
}
@@ -255,7 +258,7 @@ func CustomTestCheckTypeSetElemAttrs(resourceName, setName string, attrsToCheck
255258
return nil
256259
}
257260
}
258-
return fmt.Errorf("No element in set '%s' found with the following attributes: %v", setName, attrsToCheck)
261+
return fmt.Errorf("No element in set '%s' found with the following attributes: %v\nResolved to: %v\nState attributes for resource: %v", setName, attrsToCheck, resolvedAttrs, rs.Primary.Attributes)
259262
}
260263
}
261264

mso/resource_mso_tenant_policies_dhcp_relay_policy.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ func resourceMSOTenantPoliciesDHCPRelayPolicy() *schema.Resource {
6262
"dhcp_server_vrf_preference": {
6363
Type: schema.TypeBool,
6464
Optional: true,
65+
Computed: true,
6566
},
6667
},
6768
},

mso/resource_mso_tenant_policies_dhcp_relay_policy_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func TestAccMSOTenantPoliciesDHCPRelayPolicyResource(t *testing.T) {
1818
{
1919
PreConfig: func() { fmt.Println("Test: Create DHCP Relay Policy without dhcp_relay_providers") },
2020
Config: testAccMSOTenantPoliciesDHCPRelayPolicyConfigCreateErrorWithoutProviders(name),
21-
ExpectError: regexp.MustCompile(`config is invalid: "dhcp_relay_providers": required field is not set`),
21+
ExpectError: regexp.MustCompile(`Insufficient dhcp_relay_providers blocks`),
2222
},
2323
{
2424
PreConfig: func() { fmt.Println("Test: Create DHCP Relay Policy with invalid dhcp_relay_providers") },

0 commit comments

Comments
 (0)