forked from hashicorp/terraform-provider-google
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support node config for GKE node pool (hashicorp#184)
* Add support node config for GKE node pool * Review fixes: - Set max items in node config schema - Fill missing node config fields - Put test helpers above than test vars * Update checks in node pool tests * Fix node pool check match
- Loading branch information
1 parent
bc20268
commit a9626a8
Showing
5 changed files
with
396 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
package google | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/hashicorp/terraform/helper/schema" | ||
) | ||
|
||
var schemaNodeConfig = &schema.Schema{ | ||
Type: schema.TypeList, | ||
Optional: true, | ||
Computed: true, | ||
ForceNew: true, | ||
MaxItems: 1, | ||
Elem: &schema.Resource{ | ||
Schema: map[string]*schema.Schema{ | ||
"machine_type": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Computed: true, | ||
ForceNew: true, | ||
}, | ||
|
||
"disk_size_gb": { | ||
Type: schema.TypeInt, | ||
Optional: true, | ||
Computed: true, | ||
ForceNew: true, | ||
ValidateFunc: func(v interface{}, k string) (ws []string, errors []error) { | ||
value := v.(int) | ||
|
||
if value < 10 { | ||
errors = append(errors, fmt.Errorf( | ||
"%q cannot be less than 10", k)) | ||
} | ||
return | ||
}, | ||
}, | ||
|
||
"local_ssd_count": { | ||
Type: schema.TypeInt, | ||
Optional: true, | ||
Computed: true, | ||
ForceNew: true, | ||
ValidateFunc: func(v interface{}, k string) (ws []string, errors []error) { | ||
value := v.(int) | ||
|
||
if value < 0 { | ||
errors = append(errors, fmt.Errorf( | ||
"%q cannot be negative", k)) | ||
} | ||
return | ||
}, | ||
}, | ||
|
||
"oauth_scopes": { | ||
Type: schema.TypeList, | ||
Optional: true, | ||
Computed: true, | ||
ForceNew: true, | ||
Elem: &schema.Schema{ | ||
Type: schema.TypeString, | ||
StateFunc: func(v interface{}) string { | ||
return canonicalizeServiceScope(v.(string)) | ||
}, | ||
}, | ||
}, | ||
|
||
"service_account": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Computed: true, | ||
ForceNew: true, | ||
}, | ||
|
||
"metadata": { | ||
Type: schema.TypeMap, | ||
Optional: true, | ||
ForceNew: true, | ||
Elem: schema.TypeString, | ||
}, | ||
|
||
"image_type": { | ||
Type: schema.TypeString, | ||
Optional: true, | ||
Computed: true, | ||
ForceNew: true, | ||
}, | ||
|
||
"labels": { | ||
Type: schema.TypeMap, | ||
Optional: true, | ||
ForceNew: true, | ||
Elem: schema.TypeString, | ||
}, | ||
|
||
"tags": { | ||
Type: schema.TypeList, | ||
Optional: true, | ||
ForceNew: true, | ||
Elem: &schema.Schema{Type: schema.TypeString}, | ||
}, | ||
}, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.