diff --git a/mmv1/products/compute/api.yaml b/mmv1/products/compute/api.yaml index d79219d60771..350f31f2b1bd 100644 --- a/mmv1/products/compute/api.yaml +++ b/mmv1/products/compute/api.yaml @@ -396,7 +396,7 @@ objects: Indicates whether predictive autoscaling based on CPU metric is enabled. Valid values are: - NONE (default). No predictive method is used. The autoscaler scales the group to meet current demand based on real-time metrics. - + - OPTIMIZE_AVAILABILITY. Predictive autoscaling improves availability by monitoring daily and weekly load patterns and scaling out ahead of anticipated demand. - !ruby/object:Api::Type::Array name: 'customMetricUtilizations' @@ -519,7 +519,7 @@ objects: - !ruby/object:Api::Type::String name: 'schedule' description: | - The start timestamps of time intervals when this scaling schedule should provide a scaling signal. This field uses the extended cron format (with an optional year field). + The start timestamps of time intervals when this scaling schedule should provide a scaling signal. This field uses the extended cron format (with an optional year field). required: true - !ruby/object:Api::Type::String name: 'timeZone' @@ -534,7 +534,7 @@ objects: - !ruby/object:Api::Type::Boolean name: 'disabled' description: | - A boolean value that specifies if a scaling schedule can influence autoscaler recommendations. If set to true, then a scaling schedule has no effect. + A boolean value that specifies if a scaling schedule can influence autoscaler recommendations. If set to true, then a scaling schedule has no effect. default_value: false - !ruby/object:Api::Type::String name: 'description' @@ -607,7 +607,7 @@ objects: name: 'defaultTtl' min_version: beta description: | - Specifies the default TTL for cached content served by this origin for responses + Specifies the default TTL for cached content served by this origin for responses that do not have an existing valid TTL (max-age or s-max-age). - !ruby/object:Api::Type::Integer name: 'maxTtl' @@ -658,7 +658,7 @@ objects: name: 'serveWhileStale' min_version: beta description: | - Serve existing content from the cache (if available) when revalidating content with the origin, or when an error is encountered when refreshing the cache. + Serve existing content from the cache (if available) when revalidating content with the origin, or when an error is encountered when refreshing the cache. - !ruby/object:Api::Type::Array name: 'customResponseHeaders' @@ -1209,7 +1209,7 @@ objects: name: 'defaultTtl' min_version: beta description: | - Specifies the default TTL for cached content served by this origin for responses + Specifies the default TTL for cached content served by this origin for responses that do not have an existing valid TTL (max-age or s-max-age). - !ruby/object:Api::Type::Integer name: 'maxTtl' @@ -1260,7 +1260,7 @@ objects: name: 'serveWhileStale' min_version: beta description: | - Serve existing content from the cache (if available) when revalidating content with the origin, or when an error is encountered when refreshing the cache. + Serve existing content from the cache (if available) when revalidating content with the origin, or when an error is encountered when refreshing the cache. - !ruby/object:Api::Type::NestedObject name: 'connectionDraining' description: | @@ -2189,7 +2189,7 @@ objects: name: 'defaultTtl' min_version: beta description: | - Specifies the default TTL for cached content served by this origin for responses + Specifies the default TTL for cached content served by this origin for responses that do not have an existing valid TTL (max-age or s-max-age). - !ruby/object:Api::Type::Integer name: 'maxTtl' @@ -2240,7 +2240,7 @@ objects: name: 'serveWhileStale' min_version: beta description: | - Serve existing content from the cache (if available) when revalidating content with the origin, or when an error is encountered when refreshing the cache. + Serve existing content from the cache (if available) when revalidating content with the origin, or when an error is encountered when refreshing the cache. - !ruby/object:Api::Type::NestedObject name: 'connectionDraining' @@ -2327,7 +2327,7 @@ objects: description: | The set of URLs to HealthCheck resources for health checking this RegionBackendService. Currently at most one health - check can be specified. + check can be specified. A health check must be specified unless the backend service uses an internet or serverless NEG as a backend. @@ -3175,7 +3175,7 @@ objects: - !ruby/object:Api::Type::String name: 'kmsKeyServiceAccount' description: | - The service account used for the encryption request for the given KMS key. + The service account used for the encryption request for the given KMS key. If absent, the Compute Engine Service Agent service account is used. input: true - !ruby/object:Api::Type::String @@ -5188,8 +5188,8 @@ objects: - grpc_health_check.0.port_specification - grpc_health_check.0.grpc_service_name description: | - The port number for the health check request. - Must be specified if portName and portSpecification are not set + The port number for the health check request. + Must be specified if portName and portSpecification are not set or if port_specification is USE_FIXED_PORT. Valid values are 1 through 65535. - !ruby/object:Api::Type::String name: 'portName' @@ -5235,7 +5235,7 @@ objects: - grpc_health_check.0.port_specification - grpc_health_check.0.grpc_service_name description: | - The gRPC service name for the health check. + The gRPC service name for the health check. The value of grpcServiceName has the following meanings by convention: - Empty serviceName means the overall status of all services at the backend. - Non-empty serviceName means the health of that gRPC service, as defined by the owner of the service. @@ -7588,7 +7588,7 @@ objects: - !ruby/object:Api::Type::String name: 'kmsKeyServiceAccount' description: | - The service account used for the encryption request for the given KMS key. + The service account used for the encryption request for the given KMS key. If absent, the Compute Engine Service Agent service account is used. - !ruby/object:Api::Resource name: 'MachineType' @@ -8264,7 +8264,7 @@ objects: properties: - !ruby/object:Api::Type::String name: 'service' - at_least_one_of: + at_least_one_of: - cloud_run.0.service - cloud_run.0.url_mask description: | @@ -8280,18 +8280,18 @@ objects: Example value: "revision-0010". - !ruby/object:Api::Type::String name: 'urlMask' - at_least_one_of: + at_least_one_of: - cloud_run.0.service - cloud_run.0.url_mask description: | - A template to parse service and tag fields from a request URL. - URL mask allows for routing to multiple Run services without having + A template to parse service and tag fields from a request URL. + URL mask allows for routing to multiple Run services without having to create multiple network endpoint groups and backend services. - For example, request URLs "foo1.domain.com/bar1" and "foo1.domain.com/bar2" - an be backed by the same Serverless Network Endpoint Group (NEG) with - URL mask ".domain.com/". The URL mask will parse them to { service="bar1", tag="foo1" } - and { service="bar2", tag="foo2" } respectively. + For example, request URLs "foo1.domain.com/bar1" and "foo1.domain.com/bar2" + an be backed by the same Serverless Network Endpoint Group (NEG) with + URL mask ".domain.com/". The URL mask will parse them to { service="bar1", tag="foo1" } + and { service="bar2", tag="foo2" } respectively. - !ruby/object:Api::Type::NestedObject name: 'appEngine' exactly_one_of: @@ -8321,7 +8321,7 @@ objects: A template to parse service and version fields from a request URL. URL mask allows for routing to multiple App Engine services without having to create multiple Network Endpoint Groups and backend services. - + For example, the request URLs "foo1-dot-appname.appspot.com/v1" and "foo1-dot-appname.appspot.com/v2" can be backed by the same Serverless NEG with URL mask "-dot-appname.appspot.com/". The URL mask will parse @@ -8338,7 +8338,7 @@ objects: properties: - !ruby/object:Api::Type::String name: 'function' - at_least_one_of: + at_least_one_of: - cloud_function.0.function - cloud_function.0.url_mask description: | @@ -8347,7 +8347,7 @@ objects: Example value: "func1". - !ruby/object:Api::Type::String name: 'urlMask' - at_least_one_of: + at_least_one_of: - cloud_function.0.function - cloud_function.0.url_mask description: | @@ -8629,7 +8629,6 @@ objects: output: true - !ruby/object:Api::Type::NestedObject name: 'serverBinding' - min_version: beta description: | The server binding policy for nodes using this template. Determines where the nodes should restart following a maintenance event. @@ -8657,7 +8656,6 @@ objects: name: 'cpuOvercommitType' description: | CPU overcommit. - min_version: beta values: - :ENABLED - :NONE @@ -8862,7 +8860,7 @@ objects: is only applicable for UDP or TCP protocol. Each entry must be either an integer or a range. If not specified, this rule applies to connections through any port. - + Example inputs include: ["22"], ["80","443"], and ["12345-12349"]. - !ruby/object:Api::Type::String @@ -9684,7 +9682,7 @@ objects: Indicates whether predictive autoscaling based on CPU metric is enabled. Valid values are: - NONE (default). No predictive method is used. The autoscaler scales the group to meet current demand based on real-time metrics. - + - OPTIMIZE_AVAILABILITY. Predictive autoscaling improves availability by monitoring daily and weekly load patterns and scaling out ahead of anticipated demand. - !ruby/object:Api::Type::Array name: 'customMetricUtilizations' @@ -9807,7 +9805,7 @@ objects: - !ruby/object:Api::Type::String name: 'schedule' description: | - The start timestamps of time intervals when this scaling schedule should provide a scaling signal. This field uses the extended cron format (with an optional year field). + The start timestamps of time intervals when this scaling schedule should provide a scaling signal. This field uses the extended cron format (with an optional year field). required: true - !ruby/object:Api::Type::String name: 'timeZone' @@ -9822,7 +9820,7 @@ objects: - !ruby/object:Api::Type::Boolean name: 'disabled' description: | - A boolean value that specifies if a scaling schedule can influence autoscaler recommendations. If set to true, then a scaling schedule has no effect. + A boolean value that specifies if a scaling schedule can influence autoscaler recommendations. If set to true, then a scaling schedule has no effect. default_value: false - !ruby/object:Api::Type::String name: 'description' @@ -10970,14 +10968,14 @@ objects: The HTTP Status code to use for this RedirectAction. Supported values are: * MOVED_PERMANENTLY_DEFAULT, which is the default value and corresponds to 301. - + * FOUND, which corresponds to 302. - + * SEE_OTHER which corresponds to 303. - + * TEMPORARY_REDIRECT, which corresponds to 307. In this case, the request method will be retained. - + * PERMANENT_REDIRECT, which corresponds to 308. In this case, the request method will be retained. skip_docs_values: true @@ -11396,14 +11394,14 @@ objects: The HTTP Status code to use for this RedirectAction. Supported values are: * MOVED_PERMANENTLY_DEFAULT, which is the default value and corresponds to 301. - + * FOUND, which corresponds to 302. - + * SEE_OTHER which corresponds to 303. - + * TEMPORARY_REDIRECT, which corresponds to 307. In this case, the request method will be retained. - + * PERMANENT_REDIRECT, which corresponds to 308. In this case, the request method will be retained. skip_docs_values: true @@ -11463,16 +11461,16 @@ objects: name: 'redirectResponseCode' description: | The HTTP Status code to use for this RedirectAction. Supported values are: - + * MOVED_PERMANENTLY_DEFAULT, which is the default value and corresponds to 301. - + * FOUND, which corresponds to 302. - + * SEE_OTHER which corresponds to 303. - + * TEMPORARY_REDIRECT, which corresponds to 307. In this case, the request method will be retained. - + * PERMANENT_REDIRECT, which corresponds to 308. In this case, the request method will be retained. skip_docs_values: true @@ -11558,16 +11556,16 @@ objects: name: 'redirectResponseCode' description: | The HTTP Status code to use for this RedirectAction. Supported values are: - + * MOVED_PERMANENTLY_DEFAULT, which is the default value and corresponds to 301. * FOUND, which corresponds to 302. * SEE_OTHER which corresponds to 303. - + * TEMPORARY_REDIRECT, which corresponds to 307. In this case, the request method will be retained. - + * PERMANENT_REDIRECT, which corresponds to 308. In this case, the request method will be retained. skip_docs_values: true @@ -12298,8 +12296,8 @@ objects: - grpc_health_check.0.port_specification - grpc_health_check.0.grpc_service_name description: | - The port number for the health check request. - Must be specified if portName and portSpecification are not set + The port number for the health check request. + Must be specified if portName and portSpecification are not set or if port_specification is USE_FIXED_PORT. Valid values are 1 through 65535. - !ruby/object:Api::Type::String name: 'portName' @@ -12345,7 +12343,7 @@ objects: - grpc_health_check.0.port_specification - grpc_health_check.0.grpc_service_name description: | - The gRPC service name for the health check. + The gRPC service name for the health check. The value of grpcServiceName has the following meanings by convention: * Empty serviceName means the overall status of all services at the backend. @@ -14273,7 +14271,7 @@ objects: name: 'privateIpv6GoogleAccess' update_verb: :PATCH update_url: projects/{{project}}/regions/{{region}}/subnetworks/{{name}} - description: The private IPv6 google access type for the VMs in this subnet. + description: The private IPv6 google access type for the VMs in this subnet. fingerprint_name: 'fingerprint' - !ruby/object:Api::Type::ResourceRef name: 'region' @@ -16797,7 +16795,7 @@ objects: * FOUND, which corresponds to 302. * SEE_OTHER which corresponds to 303. - + * TEMPORARY_REDIRECT, which corresponds to 307. In this case, the request method will be retained. * PERMANENT_REDIRECT, which corresponds to 308. In this case, the request method will be retained. @@ -16861,16 +16859,16 @@ objects: name: 'redirectResponseCode' description: | The HTTP Status code to use for this RedirectAction. Supported values are: - + * MOVED_PERMANENTLY_DEFAULT, which is the default value and corresponds to 301. - + * FOUND, which corresponds to 302. - + * SEE_OTHER which corresponds to 303. - + * TEMPORARY_REDIRECT, which corresponds to 307. In this case, the request method will be retained. - + * PERMANENT_REDIRECT, which corresponds to 308. In this case, the request method will be retained. skip_docs_values: true @@ -17274,14 +17272,14 @@ objects: The HTTP Status code to use for this RedirectAction. Supported values are: * MOVED_PERMANENTLY_DEFAULT, which is the default value and corresponds to 301. - + * FOUND, which corresponds to 302. - + * SEE_OTHER which corresponds to 303. - + * TEMPORARY_REDIRECT, which corresponds to 307. In this case, the request method will be retained. - + * PERMANENT_REDIRECT, which corresponds to 308. In this case, the request method will be retained. skip_docs_values: true diff --git a/mmv1/products/compute/terraform.yaml b/mmv1/products/compute/terraform.yaml index 3afc1ecec162..564b8c902f00 100644 --- a/mmv1/products/compute/terraform.yaml +++ b/mmv1/products/compute/terraform.yaml @@ -1137,7 +1137,7 @@ overrides: !ruby/object:Overrides::ResourceOverrides edgeAvailabilityDomain: !ruby/object:Overrides::Terraform::PropertyOverride default_from_api: true mtu: !ruby/object:Overrides::Terraform::PropertyOverride - default_from_api: true + default_from_api: true custom_code: !ruby/object:Provider::Terraform::CustomCode constants: templates/terraform/constants/interconnect_attachment.go.erb post_create: templates/terraform/post_create/interconnect_attachment.go.erb @@ -1408,7 +1408,6 @@ overrides: !ruby/object:Overrides::ResourceOverrides template_name: "soletenant-tmpl" - !ruby/object:Provider::Terraform::Examples name: "node_template_server_binding" - min_version: beta primary_resource_id: "template" vars: template_name: "soletenant-with-licenses" diff --git a/mmv1/third_party/terraform/resources/resource_compute_instance.go.erb b/mmv1/third_party/terraform/resources/resource_compute_instance.go similarity index 97% rename from mmv1/third_party/terraform/resources/resource_compute_instance.go.erb rename to mmv1/third_party/terraform/resources/resource_compute_instance.go index 330d5ec850de..9c4349241068 100644 --- a/mmv1/third_party/terraform/resources/resource_compute_instance.go.erb +++ b/mmv1/third_party/terraform/resources/resource_compute_instance.go @@ -1,5 +1,3 @@ -// <% autogen_exception -%> - package google import ( @@ -9,6 +7,7 @@ import ( "errors" "fmt" "log" + "strconv" "strings" "time" @@ -20,7 +19,6 @@ import ( "github.com/mitchellh/hashstructure" computeBeta "google.golang.org/api/compute/v0.beta" "google.golang.org/api/compute/v1" - "google.golang.org/api/googleapi" ) var ( @@ -46,9 +44,7 @@ var ( "scheduling.0.automatic_restart", "scheduling.0.preemptible", "scheduling.0.node_affinities", -<% unless version == 'ga' -%> "scheduling.0.min_node_cpus", -<% end -%> } shieldedInstanceConfigKeys = []string{ @@ -298,8 +294,8 @@ func resourceComputeInstance() *schema.Resource { Description: `The name of the interface`, }, "nic_type": { - Type: schema.TypeString, - Optional: true, + Type: schema.TypeString, + Optional: true, ForceNew: true, ValidateFunc: validation.StringInSlice([]string{"GVNIC", "VIRTIO_NET"}, false), Description: `The type of vNIC to be used on this interface. Possible values:GVNIC, VIRTIO_NET`, @@ -552,13 +548,11 @@ func resourceComputeInstance() *schema.Resource { DiffSuppressFunc: emptyOrDefaultStringSuppress(""), Description: `Specifies node affinities or anti-affinities to determine which sole-tenant nodes your instances and managed instance groups will use as host systems.`, }, -<% unless version == 'ga' -%> "min_node_cpus": { - Type: schema.TypeInt, - Optional: true, - AtLeastOneOf: schedulingKeys, + Type: schema.TypeInt, + Optional: true, + AtLeastOneOf: schedulingKeys, }, -<% end -%> }, }, }, @@ -648,18 +642,18 @@ func resourceComputeInstance() *schema.Resource { }, }, "confidential_instance_config": { - Type: schema.TypeList, - MaxItems: 1, - Optional: true, - ForceNew: true, - Computed: true, + Type: schema.TypeList, + MaxItems: 1, + Optional: true, + ForceNew: true, + Computed: true, Description: `The Confidential VM config being used by the instance. on_host_maintenance has to be set to TERMINATE or this will fail to create.`, Elem: &schema.Resource{ Schema: map[string]*schema.Schema{ "enable_confidential_compute": { - Type: schema.TypeBool, - Required: true, - Description: `Defines whether the instance should have confidential compute enabled.`, + Type: schema.TypeBool, + Required: true, + Description: `Defines whether the instance should have confidential compute enabled.`, }, }, }, @@ -863,26 +857,26 @@ func expandComputeInstance(project string, d *schema.ResourceData, config *Confi // Create the instance information return &computeBeta.Instance{ - CanIpForward: d.Get("can_ip_forward").(bool), - Description: d.Get("description").(string), - Disks: disks, - MachineType: machineTypeUrl, - Metadata: metadata, - Name: d.Get("name").(string), - NetworkInterfaces: networkInterfaces, - Tags: resourceInstanceTags(d), - Labels: expandLabels(d), - ServiceAccounts: expandServiceAccounts(d.Get("service_account").([]interface{})), - GuestAccelerators: accels, - MinCpuPlatform: d.Get("min_cpu_platform").(string), - Scheduling: scheduling, - DeletionProtection: d.Get("deletion_protection").(bool), - Hostname: d.Get("hostname").(string), - ForceSendFields: []string{"CanIpForward", "DeletionProtection"}, - ConfidentialInstanceConfig: expandConfidentialInstanceConfig(d), - ShieldedInstanceConfig: expandShieldedVmConfigs(d), - DisplayDevice: expandDisplayDevice(d), - ResourcePolicies: convertStringArr(d.Get("resource_policies").([]interface{})), + CanIpForward: d.Get("can_ip_forward").(bool), + Description: d.Get("description").(string), + Disks: disks, + MachineType: machineTypeUrl, + Metadata: metadata, + Name: d.Get("name").(string), + NetworkInterfaces: networkInterfaces, + Tags: resourceInstanceTags(d), + Labels: expandLabels(d), + ServiceAccounts: expandServiceAccounts(d.Get("service_account").([]interface{})), + GuestAccelerators: accels, + MinCpuPlatform: d.Get("min_cpu_platform").(string), + Scheduling: scheduling, + DeletionProtection: d.Get("deletion_protection").(bool), + Hostname: d.Get("hostname").(string), + ForceSendFields: []string{"CanIpForward", "DeletionProtection"}, + ConfidentialInstanceConfig: expandConfidentialInstanceConfig(d), + ShieldedInstanceConfig: expandShieldedVmConfigs(d), + DisplayDevice: expandDisplayDevice(d), + ResourcePolicies: convertStringArr(d.Get("resource_policies").([]interface{})), }, nil } @@ -1380,7 +1374,6 @@ func resourceComputeInstanceUpdate(d *schema.ResourceData, meta interface{}) err return fmt.Errorf("Instance had unexpected number of network interfaces: %d", len(instance.NetworkInterfaces)) } - var updatesToNIWhileStopped []func(inst *computeBeta.Instance) error for i := 0; i < len(networkInterfaces); i++ { prefix := fmt.Sprintf("network_interface.%d", i) @@ -1475,7 +1468,7 @@ func resourceComputeInstanceUpdate(d *schema.ResourceData, meta interface{}) err networkInterfacePatchObj := &computeBeta.NetworkInterface{ AliasIpRanges: networkInterface.AliasIpRanges, - Fingerprint: instNetworkInterface.Fingerprint, + Fingerprint: instNetworkInterface.Fingerprint, } updateCall := config.NewComputeBetaClient(userAgent).Instances.UpdateNetworkInterface(project, zone, instance.Name, networkName, networkInterfacePatchObj).Do op, err := updateCall() diff --git a/mmv1/third_party/terraform/tests/resource_compute_instance_test.go.erb b/mmv1/third_party/terraform/tests/resource_compute_instance_test.go similarity index 99% rename from mmv1/third_party/terraform/tests/resource_compute_instance_test.go.erb rename to mmv1/third_party/terraform/tests/resource_compute_instance_test.go index 7744994fa37a..eabd28347cc8 100644 --- a/mmv1/third_party/terraform/tests/resource_compute_instance_test.go.erb +++ b/mmv1/third_party/terraform/tests/resource_compute_instance_test.go @@ -1,5 +1,3 @@ -// <% autogen_exception -%> - package google import ( @@ -1518,6 +1516,7 @@ func TestAccComputeInstance_updateRunning_desiredStatusRunning_allowStoppingForU } const errorAllowStoppingMsg = "Changing the machine_type, min_cpu_platform, service_account, enable_display, shielded_instance_config, or network_interface.\\[#d\\].\\(network/subnetwork/subnetwork_project\\) on a started instance requires stopping it. To acknowledge this, please set allow_stopping_for_update = true in your config. You can also stop it by setting desired_status = \"TERMINATED\", but the instance will not be restarted after the update." + func TestAccComputeInstance_updateRunning_desiredStatusNotSet_notAllowStoppingForUpdate(t *testing.T) { t.Parallel() @@ -4586,9 +4585,7 @@ resource "google_compute_instance" "foobar" { values = [google_compute_node_group.nodes.name] } -<% unless version == 'ga' -%> min_node_cpus = 4 -<% end -%> } } @@ -4602,9 +4599,7 @@ resource "google_compute_node_template" "nodetmpl" { node_type = "n1-node-96-624" -<% unless version == 'ga' -%> cpu_overcommit_type = "ENABLED" -<% end -%> } resource "google_compute_node_group" "nodes" { @@ -4658,9 +4653,7 @@ resource "google_compute_instance" "foobar" { values = [google_compute_node_group.nodes.name] } -<% unless version == 'ga' -%> min_node_cpus = 6 -<% end -%> } } @@ -4674,9 +4667,7 @@ resource "google_compute_node_template" "nodetmpl" { node_type = "n1-node-96-624" -<% unless version == 'ga' -%> cpu_overcommit_type = "ENABLED" -<% end -%> } resource "google_compute_node_group" "nodes" { diff --git a/mmv1/third_party/terraform/website/docs/r/compute_instance.html.markdown b/mmv1/third_party/terraform/website/docs/r/compute_instance.html.markdown index 40b2905e96df..83985fdd6420 100644 --- a/mmv1/third_party/terraform/website/docs/r/compute_instance.html.markdown +++ b/mmv1/third_party/terraform/website/docs/r/compute_instance.html.markdown @@ -334,6 +334,8 @@ The `scheduling` block supports: [here](https://cloud.google.com/compute/docs/nodes/create-nodes). Structure documented below. +* `minNodeCpus` - (Optional) The minimum number of virtual CPUs this instance will consume when running on a sole-tenant node. + The `guest_accelerator` block supports: * `type` (Required) - The accelerator type resource to expose to this instance. E.g. `nvidia-tesla-k80`.