Skip to content

Commit

Permalink
Shuffle schema in BackendService around to match what MM will do (#567)
Browse files Browse the repository at this point in the history
<!-- This change is generated by MagicModules. -->
/cc @rileykarson
  • Loading branch information
modular-magician authored and rileykarson committed Mar 29, 2019
1 parent 9aece50 commit 9d1ea62
Showing 1 changed file with 83 additions and 79 deletions.
162 changes: 83 additions & 79 deletions google-beta/resource_compute_backend_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,78 +38,16 @@ func resourceComputeBackendService() *schema.Resource {
MaxItems: 1,
},

"iap": {
Type: schema.TypeList,
"affinity_cookie_ttl_sec": {
Type: schema.TypeInt,
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"oauth2_client_id": {
Type: schema.TypeString,
Required: true,
},
"oauth2_client_secret": {
Type: schema.TypeString,
Required: true,
Sensitive: true,
},
"oauth2_client_secret_sha256": {
Type: schema.TypeString,
Computed: true,
Sensitive: true,
},
},
},
},

"backend": {
Type: schema.TypeSet,
Optional: true,
Set: resourceGoogleComputeBackendServiceBackendHash,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"group": {
Type: schema.TypeString,
Optional: true,
DiffSuppressFunc: compareSelfLinkRelativePaths,
},
"balancing_mode": {
Type: schema.TypeString,
Optional: true,
Default: "UTILIZATION",
},
"capacity_scaler": {
Type: schema.TypeFloat,
Optional: true,
Default: 1,
},
"description": {
Type: schema.TypeString,
Optional: true,
},
"max_rate": {
Type: schema.TypeInt,
Optional: true,
},
"max_rate_per_instance": {
Type: schema.TypeFloat,
Optional: true,
},
"max_connections": {
Type: schema.TypeInt,
Optional: true,
},
"max_connections_per_instance": {
Type: schema.TypeInt,
Optional: true,
},
"max_utilization": {
Type: schema.TypeFloat,
Optional: true,
Default: 0.8,
},
},
},
Elem: computeBackendServiceBackendSchema(),
},

"cdn_policy": {
Expand Down Expand Up @@ -156,6 +94,12 @@ func resourceComputeBackendService() *schema.Resource {
},
},

"connection_draining_timeout_sec": {
Type: schema.TypeInt,
Optional: true,
Default: 300,
},

"custom_request_headers": {
Type: schema.TypeSet,
Optional: true,
Expand All @@ -179,17 +123,34 @@ func resourceComputeBackendService() *schema.Resource {
Computed: true,
},

"port_name": {
Type: schema.TypeString,
"iap": {
Type: schema.TypeList,
Optional: true,
Computed: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"oauth2_client_id": {
Type: schema.TypeString,
Required: true,
},
"oauth2_client_secret": {
Type: schema.TypeString,
Required: true,
Sensitive: true,
},
"oauth2_client_secret_sha256": {
Type: schema.TypeString,
Computed: true,
Sensitive: true,
},
},
},
},

"project": {
"port_name": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},

"protocol": {
Expand All @@ -211,32 +172,75 @@ func resourceComputeBackendService() *schema.Resource {
DiffSuppressFunc: compareSelfLinkOrResourceName,
},

"self_link": {
"session_affinity": {
Type: schema.TypeString,
Optional: true,
Computed: true,
},

"session_affinity": {
"timeout_sec": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
},

"project": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},

"affinity_cookie_ttl_sec": {
"self_link": {
Type: schema.TypeString,
Computed: true,
},
},
}
}

func computeBackendServiceBackendSchema() *schema.Resource {
return &schema.Resource{
Schema: map[string]*schema.Schema{
"group": {
Type: schema.TypeString,
Optional: true,
DiffSuppressFunc: compareSelfLinkRelativePaths,
},
"balancing_mode": {
Type: schema.TypeString,
Optional: true,
Default: "UTILIZATION",
},
"capacity_scaler": {
Type: schema.TypeFloat,
Optional: true,
Default: 1,
},
"description": {
Type: schema.TypeString,
Optional: true,
},
"max_rate": {
Type: schema.TypeInt,
Optional: true,
},

"timeout_sec": {
"max_rate_per_instance": {
Type: schema.TypeFloat,
Optional: true,
},
"max_connections": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
},

"connection_draining_timeout_sec": {
"max_connections_per_instance": {
Type: schema.TypeInt,
Optional: true,
Default: 300,
},
"max_utilization": {
Type: schema.TypeFloat,
Optional: true,
Default: 0.8,
},
},
}
Expand Down

0 comments on commit 9d1ea62

Please sign in to comment.