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

Remove default validation for enums in tpgtools #10071

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/5198.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:none

```
19 changes: 8 additions & 11 deletions google/resource_assured_workloads_workload.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"time"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"

dcl "github.com/GoogleCloudPlatform/declarative-resource-client-library/dcl"
assuredworkloads "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/assuredworkloads"
Expand Down Expand Up @@ -55,11 +54,10 @@ func resourceAssuredWorkloadsWorkload() *schema.Resource {
},

"compliance_regime": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
Description: "Required. Immutable. Compliance Regime associated with this workload. Possible values: COMPLIANCE_REGIME_UNSPECIFIED, IL4, CJIS, FEDRAMP_HIGH, FEDRAMP_MODERATE, US_REGIONAL_ACCESS",
ValidateFunc: validation.StringInSlice([]string{"COMPLIANCE_REGIME_UNSPECIFIED", "IL4", "CJIS", "FEDRAMP_HIGH", "FEDRAMP_MODERATE", "US_REGIONAL_ACCESS", ""}, false),
Type: schema.TypeString,
Required: true,
ForceNew: true,
Description: "Required. Immutable. Compliance Regime associated with this workload. Possible values: COMPLIANCE_REGIME_UNSPECIFIED, IL4, CJIS, FEDRAMP_HIGH, FEDRAMP_MODERATE, US_REGIONAL_ACCESS",
},

"display_name": {
Expand Down Expand Up @@ -167,11 +165,10 @@ func AssuredWorkloadsWorkloadResourceSettingsSchema() *schema.Resource {
},

"resource_type": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Description: "Indicates the type of resource. This field should be specified to correspond the id to the right project type (CONSUMER_PROJECT or ENCRYPTION_KEYS_PROJECT) Possible values: RESOURCE_TYPE_UNSPECIFIED, CONSUMER_PROJECT, ENCRYPTION_KEYS_PROJECT, KEYRING, CONSUMER_FOLDER",
ValidateFunc: validation.StringInSlice([]string{"RESOURCE_TYPE_UNSPECIFIED", "CONSUMER_PROJECT", "ENCRYPTION_KEYS_PROJECT", "KEYRING", "CONSUMER_FOLDER", ""}, false),
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Description: "Indicates the type of resource. This field should be specified to correspond the id to the right project type (CONSUMER_PROJECT or ENCRYPTION_KEYS_PROJECT) Possible values: RESOURCE_TYPE_UNSPECIFIED, CONSUMER_PROJECT, ENCRYPTION_KEYS_PROJECT, KEYRING, CONSUMER_FOLDER",
},
},
}
Expand Down
2 changes: 1 addition & 1 deletion google/resource_composer_environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/hashicorp/go-version"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
"google.golang.org/api/composer/v1beta1"
composer "google.golang.org/api/composer/v1beta1"
)

const (
Expand Down
8 changes: 3 additions & 5 deletions google/resource_compute_firewall_policy_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"time"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"

dcl "github.com/GoogleCloudPlatform/declarative-resource-client-library/dcl"
compute "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/compute"
Expand Down Expand Up @@ -53,10 +52,9 @@ func resourceComputeFirewallPolicyRule() *schema.Resource {
},

"direction": {
Type: schema.TypeString,
Required: true,
Description: "The direction in which this rule applies. Possible values: INGRESS, EGRESS",
ValidateFunc: validation.StringInSlice([]string{"INGRESS", "EGRESS", ""}, false),
Type: schema.TypeString,
Required: true,
Description: "The direction in which this rule applies. Possible values: INGRESS, EGRESS",
},

"firewall_policy": {
Expand Down
24 changes: 10 additions & 14 deletions google/resource_compute_forwarding_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"time"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"

dcl "github.com/GoogleCloudPlatform/declarative-resource-client-library/dcl"
compute "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/compute"
Expand Down Expand Up @@ -97,7 +96,6 @@ func resourceComputeForwardingRule() *schema.Resource {
ForceNew: true,
DiffSuppressFunc: caseDiffSuppress,
Description: "The IP protocol to which this rule applies. For protocol forwarding, valid options are `TCP`, `UDP`, `ESP`, `AH`, `SCTP` or `ICMP`. For Internal TCP/UDP Load Balancing, the load balancing scheme is `INTERNAL`, and one of `TCP` or `UDP` are valid. For Traffic Director, the load balancing scheme is `INTERNAL_SELF_MANAGED`, and only `TCP`is valid. For Internal HTTP(S) Load Balancing, the load balancing scheme is `INTERNAL_MANAGED`, and only `TCP` is valid. For HTTP(S), SSL Proxy, and TCP Proxy Load Balancing, the load balancing scheme is `EXTERNAL` and only `TCP` is valid. For Network TCP/UDP Load Balancing, the load balancing scheme is `EXTERNAL`, and one of `TCP` or `UDP` is valid.",
ValidateFunc: validation.StringInSlice([]string{"TCP", "UDP", "ESP", "AH", "SCTP", "ICMP", "L3_DEFAULT", ""}, false),
},

"is_mirroring_collector": {
Expand All @@ -115,12 +113,11 @@ func resourceComputeForwardingRule() *schema.Resource {
},

"load_balancing_scheme": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Description: "Specifies the forwarding rule type.\n\n* `EXTERNAL` is used for:\n * Classic Cloud VPN gateways\n * Protocol forwarding to VMs from an external IP address\n * The following load balancers: HTTP(S), SSL Proxy, TCP Proxy, and Network TCP/UDP\n* `INTERNAL` is used for:\n * Protocol forwarding to VMs from an internal IP address\n * Internal TCP/UDP load balancers\n* `INTERNAL_MANAGED` is used for:\n * Internal HTTP(S) load balancers\n* `INTERNAL_SELF_MANAGED` is used for:\n * Traffic Director\n\nFor more information about forwarding rules, refer to [Forwarding rule concepts](/load-balancing/docs/forwarding-rule-concepts). Possible values: INVALID, INTERNAL, INTERNAL_MANAGED, INTERNAL_SELF_MANAGED, EXTERNAL",
Default: "EXTERNAL",
ValidateFunc: validation.StringInSlice([]string{"INVALID", "INTERNAL", "INTERNAL_MANAGED", "INTERNAL_SELF_MANAGED", "EXTERNAL", ""}, false),
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Description: "Specifies the forwarding rule type.\n\n* `EXTERNAL` is used for:\n * Classic Cloud VPN gateways\n * Protocol forwarding to VMs from an external IP address\n * The following load balancers: HTTP(S), SSL Proxy, TCP Proxy, and Network TCP/UDP\n* `INTERNAL` is used for:\n * Protocol forwarding to VMs from an internal IP address\n * Internal TCP/UDP load balancers\n* `INTERNAL_MANAGED` is used for:\n * Internal HTTP(S) load balancers\n* `INTERNAL_SELF_MANAGED` is used for:\n * Traffic Director\n\nFor more information about forwarding rules, refer to [Forwarding rule concepts](/load-balancing/docs/forwarding-rule-concepts). Possible values: INVALID, INTERNAL, INTERNAL_MANAGED, INTERNAL_SELF_MANAGED, EXTERNAL",
Default: "EXTERNAL",
},

"network": {
Expand All @@ -133,12 +130,11 @@ func resourceComputeForwardingRule() *schema.Resource {
},

"network_tier": {
Type: schema.TypeString,
Computed: true,
Optional: true,
ForceNew: true,
Description: "This signifies the networking tier used for configuring this load balancer and can only take the following values: `PREMIUM`, `STANDARD`. For regional ForwardingRule, the valid values are `PREMIUM` and `STANDARD`. For GlobalForwardingRule, the valid value is `PREMIUM`. If this field is not specified, it is assumed to be `PREMIUM`. If `IPAddress` is specified, this value must be equal to the networkTier of the Address.",
ValidateFunc: validation.StringInSlice([]string{"PREMIUM", "STANDARD", ""}, false),
Type: schema.TypeString,
Computed: true,
Optional: true,
ForceNew: true,
Description: "This signifies the networking tier used for configuring this load balancer and can only take the following values: `PREMIUM`, `STANDARD`. For regional ForwardingRule, the valid values are `PREMIUM` and `STANDARD`. For GlobalForwardingRule, the valid value is `PREMIUM`. If this field is not specified, it is assumed to be `PREMIUM`. If `IPAddress` is specified, this value must be equal to the networkTier of the Address.",
},

"port_range": {
Expand Down
31 changes: 13 additions & 18 deletions google/resource_compute_global_forwarding_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"time"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"

dcl "github.com/GoogleCloudPlatform/declarative-resource-client-library/dcl"
compute "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/compute"
Expand Down Expand Up @@ -83,15 +82,13 @@ func resourceComputeGlobalForwardingRule() *schema.Resource {
ForceNew: true,
DiffSuppressFunc: caseDiffSuppress,
Description: "The IP protocol to which this rule applies. For protocol forwarding, valid options are `TCP`, `UDP`, `ESP`, `AH`, `SCTP` or `ICMP`. For Internal TCP/UDP Load Balancing, the load balancing scheme is `INTERNAL`, and one of `TCP` or `UDP` are valid. For Traffic Director, the load balancing scheme is `INTERNAL_SELF_MANAGED`, and only `TCP`is valid. For Internal HTTP(S) Load Balancing, the load balancing scheme is `INTERNAL_MANAGED`, and only `TCP` is valid. For HTTP(S), SSL Proxy, and TCP Proxy Load Balancing, the load balancing scheme is `EXTERNAL` and only `TCP` is valid. For Network TCP/UDP Load Balancing, the load balancing scheme is `EXTERNAL`, and one of `TCP` or `UDP` is valid.",
ValidateFunc: validation.StringInSlice([]string{"TCP", "UDP", "ESP", "AH", "SCTP", "ICMP", "L3_DEFAULT", ""}, false),
},

"ip_version": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Description: "The IP Version that will be used by this forwarding rule. Valid options are `IPV4` or `IPV6`. This can only be specified for an external global forwarding rule. Possible values: UNSPECIFIED_VERSION, IPV4, IPV6",
ValidateFunc: validation.StringInSlice([]string{"UNSPECIFIED_VERSION", "IPV4", "IPV6", ""}, false),
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Description: "The IP Version that will be used by this forwarding rule. Valid options are `IPV4` or `IPV6`. This can only be specified for an external global forwarding rule. Possible values: UNSPECIFIED_VERSION, IPV4, IPV6",
},

"labels": {
Expand All @@ -102,12 +99,11 @@ func resourceComputeGlobalForwardingRule() *schema.Resource {
},

"load_balancing_scheme": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Description: "Specifies the forwarding rule type.\n\n* `EXTERNAL` is used for:\n * Classic Cloud VPN gateways\n * Protocol forwarding to VMs from an external IP address\n * The following load balancers: HTTP(S), SSL Proxy, TCP Proxy, and Network TCP/UDP\n* `INTERNAL` is used for:\n * Protocol forwarding to VMs from an internal IP address\n * Internal TCP/UDP load balancers\n* `INTERNAL_MANAGED` is used for:\n * Internal HTTP(S) load balancers\n* `INTERNAL_SELF_MANAGED` is used for:\n * Traffic Director\n\nFor more information about forwarding rules, refer to [Forwarding rule concepts](/load-balancing/docs/forwarding-rule-concepts). Possible values: INVALID, INTERNAL, INTERNAL_MANAGED, INTERNAL_SELF_MANAGED, EXTERNAL",
Default: "EXTERNAL",
ValidateFunc: validation.StringInSlice([]string{"INVALID", "INTERNAL", "INTERNAL_MANAGED", "INTERNAL_SELF_MANAGED", "EXTERNAL", ""}, false),
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Description: "Specifies the forwarding rule type.\n\n* `EXTERNAL` is used for:\n * Classic Cloud VPN gateways\n * Protocol forwarding to VMs from an external IP address\n * The following load balancers: HTTP(S), SSL Proxy, TCP Proxy, and Network TCP/UDP\n* `INTERNAL` is used for:\n * Protocol forwarding to VMs from an internal IP address\n * Internal TCP/UDP load balancers\n* `INTERNAL_MANAGED` is used for:\n * Internal HTTP(S) load balancers\n* `INTERNAL_SELF_MANAGED` is used for:\n * Traffic Director\n\nFor more information about forwarding rules, refer to [Forwarding rule concepts](/load-balancing/docs/forwarding-rule-concepts). Possible values: INVALID, INTERNAL, INTERNAL_MANAGED, INTERNAL_SELF_MANAGED, EXTERNAL",
Default: "EXTERNAL",
},

"metadata_filters": {
Expand Down Expand Up @@ -173,11 +169,10 @@ func ComputeGlobalForwardingRuleMetadataFilterSchema() *schema.Resource {
},

"filter_match_criteria": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
Description: "Specifies how individual `filterLabel` matches within the list of `filterLabel`s contribute towards the overall `metadataFilter` match.\n\nSupported values are:\n\n* MATCH_ANY: At least one of the `filterLabels` must have a matching label in the provided metadata.\n* MATCH_ALL: All `filterLabels` must have matching labels in the provided metadata. Possible values: NOT_SET, MATCH_ALL, MATCH_ANY",
ValidateFunc: validation.StringInSlice([]string{"NOT_SET", "MATCH_ALL", "MATCH_ANY", ""}, false),
Type: schema.TypeString,
Required: true,
ForceNew: true,
Description: "Specifies how individual `filterLabel` matches within the list of `filterLabel`s contribute towards the overall `metadataFilter` match.\n\nSupported values are:\n\n* MATCH_ANY: At least one of the `filterLabels` must have a matching label in the provided metadata.\n* MATCH_ALL: All `filterLabels` must have matching labels in the provided metadata. Possible values: NOT_SET, MATCH_ALL, MATCH_ANY",
},
},
}
Expand Down
28 changes: 12 additions & 16 deletions google/resource_dataproc_workflow_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"time"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"

dcl "github.com/GoogleCloudPlatform/declarative-resource-client-library/dcl"
dataproc "github.com/GoogleCloudPlatform/declarative-resource-client-library/services/google/dataproc"
Expand Down Expand Up @@ -1115,11 +1114,10 @@ func DataprocWorkflowTemplateClusterInstanceGroupConfigSchema() *schema.Resource
},

"preemptibility": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Description: "Optional. Specifies the preemptibility of the instance group. The default value for master and worker groups is `NON_PREEMPTIBLE`. This default cannot be changed. The default value for secondary instances is `PREEMPTIBLE`. Possible values: PREEMPTIBILITY_UNSPECIFIED, NON_PREEMPTIBLE, PREEMPTIBLE",
ValidateFunc: validation.StringInSlice([]string{"PREEMPTIBILITY_UNSPECIFIED", "NON_PREEMPTIBLE", "PREEMPTIBLE", ""}, false),
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Description: "Optional. Specifies the preemptibility of the instance group. The default value for master and worker groups is `NON_PREEMPTIBLE`. This default cannot be changed. The default value for secondary instances is `PREEMPTIBLE`. Possible values: PREEMPTIBILITY_UNSPECIFIED, NON_PREEMPTIBLE, PREEMPTIBLE",
},

"instance_names": {
Expand Down Expand Up @@ -1416,11 +1414,10 @@ func DataprocWorkflowTemplateClusterClusterConfigGceClusterConfigSchema() *schem
},

"private_ipv6_google_access": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Description: "Optional. The type of IPv6 access for a cluster. Possible values: PRIVATE_IPV6_GOOGLE_ACCESS_UNSPECIFIED, INHERIT_FROM_SUBNETWORK, OUTBOUND, BIDIRECTIONAL",
ValidateFunc: validation.StringInSlice([]string{"PRIVATE_IPV6_GOOGLE_ACCESS_UNSPECIFIED", "INHERIT_FROM_SUBNETWORK", "OUTBOUND", "BIDIRECTIONAL", ""}, false),
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Description: "Optional. The type of IPv6 access for a cluster. Possible values: PRIVATE_IPV6_GOOGLE_ACCESS_UNSPECIFIED, INHERIT_FROM_SUBNETWORK, OUTBOUND, BIDIRECTIONAL",
},

"reservation_affinity": {
Expand Down Expand Up @@ -1493,11 +1490,10 @@ func DataprocWorkflowTemplateClusterClusterConfigGceClusterConfigReservationAffi
return &schema.Resource{
Schema: map[string]*schema.Schema{
"consume_reservation_type": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Description: "Optional. Type of reservation to consume Possible values: TYPE_UNSPECIFIED, NO_RESERVATION, ANY_RESERVATION, SPECIFIC_RESERVATION",
ValidateFunc: validation.StringInSlice([]string{"TYPE_UNSPECIFIED", "NO_RESERVATION", "ANY_RESERVATION", "SPECIFIC_RESERVATION", ""}, false),
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Description: "Optional. Type of reservation to consume Possible values: TYPE_UNSPECIFIED, NO_RESERVATION, ANY_RESERVATION, SPECIFIC_RESERVATION",
},

"key": {
Expand Down