Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change affected AtLeastOneOfs back to ExactlyOneOf #6165

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/3394.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:none

```
14 changes: 6 additions & 8 deletions google/resource_compute_firewall.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,20 +99,18 @@ character, which cannot be a dash.`,
Description: `The list of ALLOW rules specified by this firewall. Each rule
specifies a protocol and port-range tuple that describes a permitted
connection.`,
Elem: computeFirewallAllowSchema(),
Set: resourceComputeFirewallRuleHash,
ConflictsWith: []string{"deny"},
AtLeastOneOf: []string{"allow", "deny"},
Elem: computeFirewallAllowSchema(),
Set: resourceComputeFirewallRuleHash,
ExactlyOneOf: []string{"allow", "deny"},
},
"deny": {
Type: schema.TypeSet,
Optional: true,
Description: `The list of DENY rules specified by this firewall. Each rule specifies
a protocol and port-range tuple that describes a denied connection.`,
Elem: computeFirewallDenySchema(),
Set: resourceComputeFirewallRuleHash,
ConflictsWith: []string{"allow"},
AtLeastOneOf: []string{"allow", "deny"},
Elem: computeFirewallDenySchema(),
Set: resourceComputeFirewallRuleHash,
ExactlyOneOf: []string{"allow", "deny"},
},
"description": {
Type: schema.TypeString,
Expand Down
15 changes: 5 additions & 10 deletions google/resource_compute_health_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,7 @@ can only be ASCII.`,
},
},
},
ConflictsWith: []string{"http_health_check", "https_health_check", "tcp_health_check", "ssl_health_check"},
AtLeastOneOf: []string{"http_health_check", "https_health_check", "http2_health_check", "tcp_health_check", "ssl_health_check"},
ExactlyOneOf: []string{"http_health_check", "https_health_check", "http2_health_check", "tcp_health_check", "ssl_health_check"},
},
"http_health_check": {
Type: schema.TypeList,
Expand Down Expand Up @@ -318,8 +317,7 @@ can only be ASCII.`,
},
},
},
ConflictsWith: []string{"https_health_check", "tcp_health_check", "ssl_health_check", "http2_health_check"},
AtLeastOneOf: []string{"http_health_check", "https_health_check", "http2_health_check", "tcp_health_check", "ssl_health_check"},
ExactlyOneOf: []string{"http_health_check", "https_health_check", "http2_health_check", "tcp_health_check", "ssl_health_check"},
},
"https_health_check": {
Type: schema.TypeList,
Expand Down Expand Up @@ -398,8 +396,7 @@ can only be ASCII.`,
},
},
},
ConflictsWith: []string{"http_health_check", "tcp_health_check", "ssl_health_check", "http2_health_check"},
AtLeastOneOf: []string{"http_health_check", "https_health_check", "http2_health_check", "tcp_health_check", "ssl_health_check"},
ExactlyOneOf: []string{"http_health_check", "https_health_check", "http2_health_check", "tcp_health_check", "ssl_health_check"},
},
"ssl_health_check": {
Type: schema.TypeList,
Expand Down Expand Up @@ -471,8 +468,7 @@ can only be ASCII.`,
},
},
},
ConflictsWith: []string{"http_health_check", "https_health_check", "tcp_health_check", "http2_health_check"},
AtLeastOneOf: []string{"http_health_check", "https_health_check", "http2_health_check", "tcp_health_check", "ssl_health_check"},
ExactlyOneOf: []string{"http_health_check", "https_health_check", "http2_health_check", "tcp_health_check", "ssl_health_check"},
},
"tcp_health_check": {
Type: schema.TypeList,
Expand Down Expand Up @@ -544,8 +540,7 @@ can only be ASCII.`,
},
},
},
ConflictsWith: []string{"http_health_check", "https_health_check", "ssl_health_check", "http2_health_check"},
AtLeastOneOf: []string{"http_health_check", "https_health_check", "http2_health_check", "tcp_health_check", "ssl_health_check"},
ExactlyOneOf: []string{"http_health_check", "https_health_check", "http2_health_check", "tcp_health_check", "ssl_health_check"},
},
"timeout_sec": {
Type: schema.TypeInt,
Expand Down
2 changes: 1 addition & 1 deletion google/resource_compute_health_check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func TestAccComputeHealthCheck_tcpAndSsl_shouldFail(t *testing.T) {
Steps: []resource.TestStep{
{
Config: testAccComputeHealthCheck_tcpAndSsl_shouldFail(hckName),
ExpectError: regexp.MustCompile("conflicts with tcp_health_check"),
ExpectError: regexp.MustCompile("only one of `http2_health_check,http_health_check,https_health_check,ssl_health_check,tcp_health_check` can be specified"),
},
},
})
Expand Down
15 changes: 5 additions & 10 deletions google/resource_compute_region_health_check.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,7 @@ can only be ASCII.`,
},
},
},
ConflictsWith: []string{"http_health_check", "https_health_check", "tcp_health_check", "ssl_health_check"},
AtLeastOneOf: []string{"http_health_check", "https_health_check", "http2_health_check", "tcp_health_check", "ssl_health_check"},
ExactlyOneOf: []string{"http_health_check", "https_health_check", "http2_health_check", "tcp_health_check", "ssl_health_check"},
},
"http_health_check": {
Type: schema.TypeList,
Expand Down Expand Up @@ -234,8 +233,7 @@ can only be ASCII.`,
},
},
},
ConflictsWith: []string{"https_health_check", "tcp_health_check", "ssl_health_check", "http2_health_check"},
AtLeastOneOf: []string{"http_health_check", "https_health_check", "http2_health_check", "tcp_health_check", "ssl_health_check"},
ExactlyOneOf: []string{"http_health_check", "https_health_check", "http2_health_check", "tcp_health_check", "ssl_health_check"},
},
"https_health_check": {
Type: schema.TypeList,
Expand Down Expand Up @@ -314,8 +312,7 @@ can only be ASCII.`,
},
},
},
ConflictsWith: []string{"http_health_check", "tcp_health_check", "ssl_health_check", "http2_health_check"},
AtLeastOneOf: []string{"http_health_check", "https_health_check", "http2_health_check", "tcp_health_check", "ssl_health_check"},
ExactlyOneOf: []string{"http_health_check", "https_health_check", "http2_health_check", "tcp_health_check", "ssl_health_check"},
},
"region": {
Type: schema.TypeString,
Expand Down Expand Up @@ -396,8 +393,7 @@ can only be ASCII.`,
},
},
},
ConflictsWith: []string{"http_health_check", "https_health_check", "tcp_health_check", "http2_health_check"},
AtLeastOneOf: []string{"http_health_check", "https_health_check", "http2_health_check", "tcp_health_check", "ssl_health_check"},
ExactlyOneOf: []string{"http_health_check", "https_health_check", "http2_health_check", "tcp_health_check", "ssl_health_check"},
},
"tcp_health_check": {
Type: schema.TypeList,
Expand Down Expand Up @@ -469,8 +465,7 @@ can only be ASCII.`,
},
},
},
ConflictsWith: []string{"http_health_check", "https_health_check", "ssl_health_check", "http2_health_check"},
AtLeastOneOf: []string{"http_health_check", "https_health_check", "http2_health_check", "tcp_health_check", "ssl_health_check"},
ExactlyOneOf: []string{"http_health_check", "https_health_check", "http2_health_check", "tcp_health_check", "ssl_health_check"},
},
"timeout_sec": {
Type: schema.TypeInt,
Expand Down
2 changes: 1 addition & 1 deletion google/resource_compute_region_health_check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ func TestAccComputeRegionHealthCheck_tcpAndSsl_shouldFail(t *testing.T) {
Steps: []resource.TestStep{
{
Config: testAccComputeRegionHealthCheck_tcpAndSsl_shouldFail(hckName),
ExpectError: regexp.MustCompile("conflicts with tcp_health_check"),
ExpectError: regexp.MustCompile("only one of `http2_health_check,http_health_check,https_health_check,ssl_health_check,tcp_health_check` can be specified"),
},
},
})
Expand Down
22 changes: 8 additions & 14 deletions google/resource_google_organization_policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,10 @@ var schemaOrganizationPolicy = map[string]*schema.Schema{
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"allow": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
// TODO(terraform-providers/terraform-provider-google#5193): Change back to exactly_one_of
// once hashicorp/terraform-plugin-sdk#280 is fixed
AtLeastOneOf: []string{"list_policy.0.allow", "list_policy.0.deny"},
ConflictsWith: []string{"list_policy.0.deny"},
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
ExactlyOneOf: []string{"list_policy.0.allow", "list_policy.0.deny"},
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"all": {
Expand All @@ -66,13 +63,10 @@ var schemaOrganizationPolicy = map[string]*schema.Schema{
},
},
"deny": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
// TODO(terraform-providers/terraform-provider-google#5193): Change back to exactly_one_of
// once hashicorp/terraform-plugin-sdk#280 is fixed
AtLeastOneOf: []string{"list_policy.0.allow", "list_policy.0.deny"},
ConflictsWith: []string{"list_policy.0.allow"},
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
ExactlyOneOf: []string{"list_policy.0.allow", "list_policy.0.deny"},
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"all": {
Expand Down