Skip to content

Commit

Permalink
add desc to schema for google_compute_instance_group_manager (#3655) (#…
Browse files Browse the repository at this point in the history
…6646)

Co-authored-by: Edward Sun <[email protected]>
Signed-off-by: Modular Magician <[email protected]>

Co-authored-by: Edward Sun <[email protected]>
  • Loading branch information
modular-magician and Edward Sun authored Jun 19, 2020
1 parent 886055b commit ab9dab7
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 56 deletions.
3 changes: 3 additions & 0 deletions .changelog/3655.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:none

```
144 changes: 88 additions & 56 deletions google/resource_compute_instance_group_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,49 +32,57 @@ func resourceComputeInstanceGroupManager() *schema.Resource {

Schema: map[string]*schema.Schema{
"base_instance_name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
Type: schema.TypeString,
Required: true,
ForceNew: true,
Description: `The base instance name to use for instances in this group. The value must be a valid RFC1035 name. Supported characters are lowercase letters, numbers, and hyphens (-). Instances are named by appending a hyphen and a random four-character string to the base instance name.`,
},

"instance_template": {
Type: schema.TypeString,
Optional: true,
Computed: true,
Removed: "This field has been replaced by `version.instance_template`",
Type: schema.TypeString,
Optional: true,
Computed: true,
Removed: "This field has been replaced by `version.instance_template`",
Description: `The full URL to an instance template from which all new instances of this version will be created.`,
},

"version": {
Type: schema.TypeList,
Required: true,
Type: schema.TypeList,
Required: true,
Description: `Application versions managed by this instance group. Each version deals with a specific instance template, allowing canary release scenarios.`,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Optional: true,
Type: schema.TypeString,
Optional: true,
Description: `Version name.`,
},

"instance_template": {
Type: schema.TypeString,
Required: true,
DiffSuppressFunc: compareSelfLinkRelativePaths,
Description: `The full URL to an instance template from which all new instances of this version will be created.`,
},

"target_size": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Description: `The number of instances calculated as a fixed number or a percentage depending on the settings.`,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"fixed": {
Type: schema.TypeInt,
Optional: true,
Type: schema.TypeInt,
Optional: true,
Description: `The number of instances which are managed for this version. Conflicts with percent.`,
},

"percent": {
Type: schema.TypeInt,
Optional: true,
ValidateFunc: validation.IntBetween(0, 100),
Description: `The number of instances (calculated as percentage) which are managed for this version. Conflicts with fixed. Note that when using percent, rounding will be in favor of explicitly set target_size values; a managed instance group with 2 instances and 2 versions, one of which has a target_size.percent of 60 will create 2 instances of that version.`,
},
},
},
Expand All @@ -84,62 +92,72 @@ func resourceComputeInstanceGroupManager() *schema.Resource {
},

"name": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
Type: schema.TypeString,
Required: true,
ForceNew: true,
Description: `The name of the instance group manager. Must be 1-63 characters long and comply with RFC1035. Supported characters include lowercase letters, numbers, and hyphens.`,
},

"zone": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
Description: `The zone that instances in this group should be created in.`,
},

"description": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Description: `An optional textual description of the instance group manager.`,
},

"fingerprint": {
Type: schema.TypeString,
Computed: true,
Type: schema.TypeString,
Computed: true,
Description: `The fingerprint of the instance group manager.`,
},

"instance_group": {
Type: schema.TypeString,
Computed: true,
Type: schema.TypeString,
Computed: true,
Description: `The full URL of the instance group created by the manager.`,
},

"named_port": {
Type: schema.TypeSet,
Optional: true,
Type: schema.TypeSet,
Optional: true,
Description: `The named port configuration.`,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
Type: schema.TypeString,
Required: true,
Description: `The name of the port.`,
},

"port": {
Type: schema.TypeInt,
Required: true,
Type: schema.TypeInt,
Required: true,
Description: `The port number.`,
},
},
},
},

"project": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Computed: true,
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Computed: true,
Description: `The ID of the project in which the resource belongs. If it is not provided, the provider project is used.`,
},

"self_link": {
Type: schema.TypeString,
Computed: true,
Type: schema.TypeString,
Computed: true,
Description: `The URL of the created resource.`,
},

"update_strategy": {
Expand All @@ -154,96 +172,110 @@ func resourceComputeInstanceGroupManager() *schema.Resource {
Elem: &schema.Schema{
Type: schema.TypeString,
},
Set: selfLinkRelativePathHash,
Set: selfLinkRelativePathHash,
Description: `The full URL of all target pools to which new instances in the group are added. Updating the target pools attribute does not affect existing instances.`,
},

"target_size": {
Type: schema.TypeInt,
Computed: true,
Optional: true,
Type: schema.TypeInt,
Computed: true,
Optional: true,
Description: `The target number of running instances for this managed instance group. This value should always be explicitly set unless this resource is attached to an autoscaler, in which case it should never be set. Defaults to 0.`,
},

"auto_healing_policies": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Description: `The autohealing policies for this managed instance group. You can specify only one value.`,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"health_check": {
Type: schema.TypeString,
Required: true,
DiffSuppressFunc: compareSelfLinkRelativePaths,
Description: `The health check resource that signals autohealing.`,
},

"initial_delay_sec": {
Type: schema.TypeInt,
Required: true,
ValidateFunc: validation.IntBetween(0, 3600),
Description: `The number of seconds that the managed instance group waits before it applies autohealing policies to new instances or recently recreated instances. Between 0 and 3600.`,
},
},
},
},

"update_policy": {
Computed: true,
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Computed: true,
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Description: `The update policy for this managed instance group.`,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"minimal_action": {
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice([]string{"RESTART", "REPLACE"}, false),
Description: `Minimal action to be taken on an instance. You can specify either RESTART to restart existing instances or REPLACE to delete and create new instances from the target template. If you specify a RESTART, the Updater will attempt to perform that action only. However, if the Updater determines that the minimal action you specify is not enough to perform the update, it might perform a more disruptive action.`,
},

"type": {
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.StringInSlice([]string{"OPPORTUNISTIC", "PROACTIVE"}, false),
Description: `The type of update process. You can specify either PROACTIVE so that the instance group manager proactively executes actions in order to bring instances to their target versions or OPPORTUNISTIC so that no action is proactively executed but the update will be performed as part of other actions (for example, resizes or recreateInstances calls).`,
},

"max_surge_fixed": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
ConflictsWith: []string{"update_policy.0.max_surge_percent"},
Description: `The maximum number of instances that can be created above the specified targetSize during the update process. Conflicts with max_surge_percent. If neither is set, defaults to 1`,
},

"max_surge_percent": {
Type: schema.TypeInt,
Optional: true,
ConflictsWith: []string{"update_policy.0.max_surge_fixed"},
ValidateFunc: validation.IntBetween(0, 100),
Description: `The maximum number of instances(calculated as percentage) that can be created above the specified targetSize during the update process. Conflicts with max_surge_fixed.`,
},

"max_unavailable_fixed": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
ConflictsWith: []string{"update_policy.0.max_unavailable_percent"},
Description: `The maximum number of instances that can be unavailable during the update process. Conflicts with max_unavailable_percent. If neither is set, defaults to 1.`,
},

"max_unavailable_percent": {
Type: schema.TypeInt,
Optional: true,
ConflictsWith: []string{"update_policy.0.max_unavailable_fixed"},
ValidateFunc: validation.IntBetween(0, 100),
Description: `The maximum number of instances(calculated as percentage) that can be unavailable during the update process. Conflicts with max_unavailable_fixed.`,
},

"min_ready_sec": {
Type: schema.TypeInt,
Optional: true,
ValidateFunc: validation.IntBetween(0, 3600),
Description: `Minimum number of seconds to wait for after a newly created instance becomes available. This value must be from range [0, 3600].`,
},
},
},
},

"wait_for_instances": {
Type: schema.TypeBool,
Optional: true,
Default: false,
Type: schema.TypeBool,
Optional: true,
Default: false,
Description: `Whether to wait for all instances to be created/updated before returning. Note that if this is set to true and the operation does not succeed, Terraform will continue trying until it times out.`,
},
},
}
Expand Down

0 comments on commit ab9dab7

Please sign in to comment.