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

add initial_size to google_compute_node_group #4750

Merged
merged 11 commits into from
May 5, 2021
4 changes: 4 additions & 0 deletions mmv1/products/compute/ansible.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,10 @@ overrides: !ruby/object:Overrides::ResourceOverrides
InterconnectAttachment: !ruby/object:Overrides::Ansible::ResourceOverride
tests: !ruby/object:Provider::Ansible::Tests
has_autogenerated_test: false
NodeGroup: !ruby/object:Overrides::Terraform::ResourceOverride
ScottSuarez marked this conversation as resolved.
Show resolved Hide resolved
properties:
initialSize: !ruby/object:Overrides::Inspec::PropertyOverride
ScottSuarez marked this conversation as resolved.
Show resolved Hide resolved
exclude: true
RegionDisk: !ruby/object:Overrides::Ansible::ResourceOverride
properties:
sourceSnapshotEncryptionKey: !ruby/object:Overrides::Ansible::PropertyOverride
Expand Down
15 changes: 13 additions & 2 deletions mmv1/products/compute/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8395,9 +8395,20 @@ objects:
- !ruby/object:Api::Type::Integer
name: 'size'
description: |
The total number of nodes in the node group.
required: true
ScottSuarez marked this conversation as resolved.
Show resolved Hide resolved
The total number of nodes in the node group. One of `initial_size` or `size` must be specified.
ScottSuarez marked this conversation as resolved.
Show resolved Hide resolved
input: true
exactly_one_of:
- size
- initial_size
send_empty_value: true
- !ruby/object:Api::Type::Integer
name: 'initialSize'
description: |
The initial number of nodes in the node group. One of `initial_size` or `size` must be specified.
url_param_only: true
exactly_one_of:
- size
- initial_size
- !ruby/object:Api::Type::String
name: 'maintenancePolicy'
description: |
Expand Down
5 changes: 5 additions & 0 deletions mmv1/products/compute/inspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ overrides: !ruby/object:Overrides::ResourceOverrides
exclude: true
NetworkPeeringRoutesConfig: !ruby/object:Overrides::Inspec::ResourceOverride
exclude: true
NodeGroup: !ruby/object:Overrides::Terraform::ResourceOverride
ScottSuarez marked this conversation as resolved.
Show resolved Hide resolved
properties:
initialSize: !ruby/object:Overrides::Inspec::PropertyOverride
exclude: true
OrganizationSecurityPolicy: !ruby/object:Overrides::Inspec::ResourceOverride
exclude: true
OrganizationSecurityPolicyAssociation: !ruby/object:Overrides::Inspec::ResourceOverride
Expand Down Expand Up @@ -222,3 +226,4 @@ overrides: !ruby/object:Overrides::ResourceOverrides
exclude: true
TargetGrpcProxy: !ruby/object:Overrides::Inspec::ResourceOverride
exclude: true

5 changes: 5 additions & 0 deletions mmv1/products/compute/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,7 @@ overrides: !ruby/object:Overrides::ResourceOverrides
custom_code: !ruby/object:Provider::Terraform::CustomCode
encoder: 'templates/terraform/encoders/network_peering_routes_config.go.erb'
NodeGroup: !ruby/object:Overrides::Terraform::ResourceOverride
create_url: projects/{{project}}/zones/{{zone}}/nodeGroups?initialNodeCount=PRE_CREATE_REPLACE_ME
docs: !ruby/object:Provider::Terraform::Docs
warning: |
Due to limitations of the API, Terraform cannot update the
Expand All @@ -1351,6 +1352,8 @@ overrides: !ruby/object:Overrides::ResourceOverrides
required: false
default_from_api: true
custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.erb'
size: !ruby/object:Overrides::Terraform::PropertyOverride
default_from_api: true
autoscalingPolicy: !ruby/object:Overrides::Terraform::PropertyOverride
default_from_api: true
autoscalingPolicy.mode: !ruby/object:Overrides::Terraform::PropertyOverride
Expand All @@ -1359,6 +1362,8 @@ overrides: !ruby/object:Overrides::ResourceOverrides
default_from_api: true
autoscalingPolicy.maxNodes: !ruby/object:Overrides::Terraform::PropertyOverride
default_from_api: true
custom_code: !ruby/object:Provider::Terraform::CustomCode
pre_create: templates/terraform/pre_create/compute_node_group_url_replace.go.erb
NodeTemplate: !ruby/object:Overrides::Terraform::ResourceOverride
examples:
- !ruby/object:Provider::Terraform::Examples
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ resource "google_compute_node_group" "<%= ctx[:primary_resource_id] %>" {
maintenance_window {
start_time = "08:00"
}
size = 1
initial_size = 1
node_template = google_compute_node_template.soletenant-tmpl.id
autoscaling_policy {
mode = "ONLY_SCALE_OUT"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
var sizeParam string
if v, ok := d.GetOkExists("size"); ok {
sizeParam = fmt.Sprintf("%v", v)
} else if v, ok := d.GetOkExists("initial_size"); ok {
sizeParam = fmt.Sprintf("%v", v)
}

url = regexp.MustCompile("PRE_CREATE_REPLACE_ME").ReplaceAllLiteralString(url, sizeParam)