diff --git a/autogen/variables.tf.tmpl b/autogen/variables.tf.tmpl index 324cb280..c5f470b8 100644 --- a/autogen/variables.tf.tmpl +++ b/autogen/variables.tf.tmpl @@ -18,7 +18,7 @@ variable "project_id" { type = string - description = "The GCP project ID" + description = "The Google Cloud project ID" default = null } @@ -35,7 +35,7 @@ variable "mig_name" { } variable "region" { - description = "The GCP region where the managed instance group resides." + description = "The Google Cloud region where the managed instance group resides." type = string } diff --git a/examples/confidential_computing/main.tf b/examples/confidential_computing/main.tf index 3a30c72a..8f8a64d3 100644 --- a/examples/confidential_computing/main.tf +++ b/examples/confidential_computing/main.tf @@ -65,7 +65,8 @@ resource "google_kms_crypto_key_iam_binding" "crypto_key" { } module "instance_template" { - source = "../../modules/instance_template" + source = "terraform-google-modules/vm/google//modules/instance_template" + version = "~> 12.0" region = var.region project_id = var.project_id diff --git a/examples/instance_template/confidential_computing/main.tf b/examples/instance_template/confidential_computing/main.tf index 9dba4505..77476a54 100644 --- a/examples/instance_template/confidential_computing/main.tf +++ b/examples/instance_template/confidential_computing/main.tf @@ -15,7 +15,8 @@ */ module "instance_template" { - source = "../../../modules/instance_template" + source = "terraform-google-modules/vm/google//modules/instance_template" + version = "~> 12.0" region = var.region project_id = var.project_id diff --git a/examples/umig/named_ports/main.tf b/examples/umig/named_ports/main.tf index f531ee42..04674aaf 100644 --- a/examples/umig/named_ports/main.tf +++ b/examples/umig/named_ports/main.tf @@ -33,12 +33,12 @@ module "umig" { source = "terraform-google-modules/vm/google//modules/umig" version = "~> 12.0" - project_id = var.project_id - subnetwork = var.subnetwork + project_id = var.project_id + subnetwork = var.subnetwork subnetwork_project = var.project_id - num_instances = var.num_instances - hostname = "umig-named-ports" - instance_template = module.instance_template.self_link - named_ports = var.named_ports - region = var.region + num_instances = var.num_instances + hostname = "umig-named-ports" + instance_template = module.instance_template.self_link + named_ports = var.named_ports + region = var.region } diff --git a/examples/umig/simple/main.tf b/examples/umig/simple/main.tf index 8a4bb871..ae491cfc 100644 --- a/examples/umig/simple/main.tf +++ b/examples/umig/simple/main.tf @@ -34,11 +34,11 @@ module "umig" { source = "terraform-google-modules/vm/google//modules/umig" version = "~> 12.0" - project_id = var.project_id - subnetwork = var.subnetwork + project_id = var.project_id + subnetwork = var.subnetwork subnetwork_project = var.project_id - num_instances = var.num_instances - hostname = "umig-simple" - instance_template = module.instance_template.self_link - region = var.region + num_instances = var.num_instances + hostname = "umig-simple" + instance_template = module.instance_template.self_link + region = var.region } diff --git a/examples/umig/static_ips/main.tf b/examples/umig/static_ips/main.tf index 13c33a0a..7d494c6b 100644 --- a/examples/umig/static_ips/main.tf +++ b/examples/umig/static_ips/main.tf @@ -34,12 +34,12 @@ module "umig" { source = "terraform-google-modules/vm/google//modules/umig" version = "~> 12.0" - project_id = var.project_id - subnetwork = var.subnetwork + project_id = var.project_id + subnetwork = var.subnetwork subnetwork_project = var.project_id - num_instances = var.num_instances - hostname = "umig-static-ips" - instance_template = module.instance_template.self_link - static_ips = var.static_ips - region = var.region + num_instances = var.num_instances + hostname = "umig-static-ips" + instance_template = module.instance_template.self_link + static_ips = var.static_ips + region = var.region } diff --git a/modules/compute_disk_snapshot/metadata.yaml b/modules/compute_disk_snapshot/metadata.yaml index 9e384df7..d81e7450 100644 --- a/modules/compute_disk_snapshot/metadata.yaml +++ b/modules/compute_disk_snapshot/metadata.yaml @@ -80,14 +80,6 @@ spec: location: examples/compute_instance/tags interfaces: variables: - - name: disks - description: List of self_links persistent disks to attach the snapshot policy to (ie. projects/project_id/disks/diskname/zones/zone_name) - varType: list(string) - defaultValue: [] - - name: module_depends_on - description: List of modules or resources this module depends on - varType: list(any) - defaultValue: [] - name: name description: Name of the resource policy to create varType: string @@ -100,16 +92,6 @@ spec: description: Region where resource policy resides varType: string required: true - - name: snapshot_properties - description: The properties of the schedule policy. For more details see https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_resource_policy#snapshot_properties - varType: |- - object( - { - guest_flush = bool - labels = map(string) - storage_locations = list(string) - } - ) - name: snapshot_retention_policy description: The retention policy to be applied to the schedule policy. For more details see https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_resource_policy#retention_policy varType: |- @@ -150,6 +132,24 @@ spec: } ) required: true + - name: snapshot_properties + description: The properties of the schedule policy. For more details see https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_resource_policy#snapshot_properties + varType: |- + object( + { + guest_flush = bool + labels = map(string) + storage_locations = list(string) + } + ) + - name: disks + description: List of self_links persistent disks to attach the snapshot policy to (ie. projects/project_id/disks/diskname/zones/zone_name) + varType: list(string) + defaultValue: [] + - name: module_depends_on + description: List of modules or resources this module depends on + varType: list(any) + defaultValue: [] outputs: - name: attachments description: Disk attachments to the resource policy. @@ -170,3 +170,8 @@ spec: - serviceusage.googleapis.com - compute.googleapis.com - iam.googleapis.com + providerVersions: + - source: hashicorp/google + version: ">= 3.71, < 7" + - source: hashicorp/null + version: ">= 2.1" diff --git a/modules/compute_instance/metadata.yaml b/modules/compute_instance/metadata.yaml index e7f38d95..4adac2bf 100644 --- a/modules/compute_instance/metadata.yaml +++ b/modules/compute_instance/metadata.yaml @@ -80,6 +80,30 @@ spec: location: examples/compute_instance/tags interfaces: variables: + - name: network + description: Network to deploy to. Only one of network or subnetwork should be specified. + varType: string + defaultValue: "" + - name: subnetwork + description: Subnet to deploy to. Only one of network or subnetwork should be specified. + varType: string + defaultValue: "" + - name: subnetwork_project + description: The project that subnetwork belongs to + varType: string + defaultValue: "" + - name: hostname + description: Hostname of instances + varType: string + defaultValue: "" + - name: add_hostname_suffix + description: Adds a suffix to the hostname + varType: bool + defaultValue: true + - name: static_ips + description: List of static IPs for VM instances + varType: list(string) + defaultValue: [] - name: access_config description: Access configurations, i.e. IPs via which the VM instance can be accessed via the Internet. varType: |- @@ -88,77 +112,53 @@ spec: network_tier = string })) defaultValue: [] - - name: add_hostname_suffix - description: Adds a suffix to the hostname - varType: bool - defaultValue: true - - name: alias_ip_ranges - description: (Optional) An array of alias IP ranges for this network interface. Can only be specified for network interfaces on subnet-mode networks. + - name: ipv6_access_config + description: IPv6 access configurations. Currently a max of 1 IPv6 access configuration is supported. If not specified, the instance will have no external IPv6 Internet access. varType: |- list(object({ - ip_cidr_range = string - subnetwork_range_name = string + network_tier = string })) defaultValue: [] - - name: deletion_protection - description: "Enable deletion protection on this instance. Note: you must disable deletion protection before removing the resource, or the instance cannot be deleted and the Terraform run will not complete successfully." - varType: bool - defaultValue: false - - name: hostname - description: Hostname of instances + - name: num_instances + description: Number of instances to create. This value is ignored if static_ips is provided. + varType: number + defaultValue: "1" + - name: instance_template + description: Instance template self_link used to create compute instances + varType: string + required: true + - name: region + description: Region where the instances should be created. + varType: string + - name: zone + description: Zone where the instances should be created. If not specified, instances will be spread across available zones in the region. varType: string - defaultValue: "" - name: hostname_suffix_separator description: Separator character to compose hostname when add_hostname_suffix is set to true. varType: string defaultValue: "-" - - name: instance_template - description: Instance template self_link used to create compute instances - varType: string - required: true - - name: ipv6_access_config - description: IPv6 access configurations. Currently a max of 1 IPv6 access configuration is supported. If not specified, the instance will have no external IPv6 Internet access. + - name: deletion_protection + description: "Enable deletion protection on this instance. Note: you must disable deletion protection before removing the resource, or the instance cannot be deleted and the Terraform run will not complete successfully." + varType: bool + defaultValue: false + - name: alias_ip_ranges + description: (Optional) An array of alias IP ranges for this network interface. Can only be specified for network interfaces on subnet-mode networks. varType: |- list(object({ - network_tier = string + ip_cidr_range = string + subnetwork_range_name = string })) defaultValue: [] + - name: resource_policies + description: (Optional) A list of short names or self_links of resource policies to attach to the instance. Modifying this list will cause the instance to recreate. Currently a max of 1 resource policy is supported. + varType: list(string) + defaultValue: [] - name: labels description: (Optional) Labels to override those from the template, provided as a map varType: map(string) - - name: network - description: Network to deploy to. Only one of network or subnetwork should be specified. - varType: string - defaultValue: "" - - name: num_instances - description: Number of instances to create. This value is ignored if static_ips is provided. - varType: number - defaultValue: "1" - - name: region - description: Region where the instances should be created. - varType: string - name: resource_manager_tags description: (Optional) A tag is a key-value pair that can be attached to a Google Cloud resource. You can use tags to conditionally allow or deny policies based on whether a resource has a specific tag. This value is not returned by the API. In Terraform, this value cannot be updated and changing it will recreate the resource. varType: map(string) - - name: resource_policies - description: (Optional) A list of short names or self_links of resource policies to attach to the instance. Modifying this list will cause the instance to recreate. Currently a max of 1 resource policy is supported. - varType: list(string) - defaultValue: [] - - name: static_ips - description: List of static IPs for VM instances - varType: list(string) - defaultValue: [] - - name: subnetwork - description: Subnet to deploy to. Only one of network or subnetwork should be specified. - varType: string - defaultValue: "" - - name: subnetwork_project - description: The project that subnetwork belongs to - varType: string - defaultValue: "" - - name: zone - description: Zone where the instances should be created. If not specified, instances will be spread across available zones in the region. - varType: string outputs: - name: available_zones description: List of available zones in region @@ -181,3 +181,6 @@ spec: - serviceusage.googleapis.com - compute.googleapis.com - iam.googleapis.com + providerVersions: + - source: hashicorp/google + version: ">= 3.88, < 7" diff --git a/modules/instance_template/metadata.yaml b/modules/instance_template/metadata.yaml index 6a4f74cd..c5bb6436 100644 --- a/modules/instance_template/metadata.yaml +++ b/modules/instance_template/metadata.yaml @@ -80,14 +80,108 @@ spec: location: examples/compute_instance/tags interfaces: variables: - - name: access_config - description: Access configurations, i.e. IPs via which the VM instance can be accessed via the Internet. - varType: |- - list(object({ - nat_ip = string - network_tier = string - })) + - name: project_id + description: The GCP project ID + varType: string + - name: name_prefix + description: Name prefix for the instance template + varType: string + defaultValue: default-instance-template + - name: description + description: The template's description + varType: string + defaultValue: "" + - name: instance_description + description: Description of the generated instances + varType: string + defaultValue: "" + - name: machine_type + description: Machine type to create, e.g. n1-standard-1 + varType: string + defaultValue: n1-standard-1 + - name: min_cpu_platform + description: "Specifies a minimum CPU platform. Applicable values are the friendly names of CPU platforms, such as Intel Haswell or Intel Skylake. See the complete list: https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform" + varType: string + - name: can_ip_forward + description: Enable IP forwarding, for NAT instances for example + varType: string + defaultValue: "false" + - name: tags + description: Network tags, provided as a list + varType: list(string) + defaultValue: [] + - name: labels + description: Labels, provided as a map + varType: map(string) + defaultValue: {} + - name: preemptible + description: Allow the instance to be preempted + varType: bool + defaultValue: false + - name: spot + description: Provision a SPOT instance + varType: bool + defaultValue: false + - name: automatic_restart + description: (Optional) Specifies whether the instance should be automatically restarted if it is terminated by Compute Engine (not terminated by a user). + varType: bool + defaultValue: true + - name: maintenance_interval + description: Specifies the frequency of planned maintenance events + varType: string + - name: on_host_maintenance + description: Instance availability Policy + varType: string + defaultValue: MIGRATE + - name: spot_instance_termination_action + description: Action to take when Compute Engine preempts a Spot VM. + varType: string + defaultValue: STOP + - name: region + description: Region where the instance template should be created. + varType: string + - name: enable_nested_virtualization + description: Defines whether the instance should have nested virtualization enabled. + varType: bool + defaultValue: false + - name: threads_per_core + description: The number of threads per physical core. To disable simultaneous multithreading (SMT) set this to 1. + varType: number + - name: resource_policies + description: A list of self_links of resource policies to attach to the instance. Modifying this list will cause the instance to recreate. Currently a max of 1 resource policy is supported. + varType: list(string) defaultValue: [] + - name: source_image + description: Source disk image. If neither source_image nor source_image_family is specified, defaults to the latest public Rocky Linux 9 optimized for GCP image. + varType: string + defaultValue: "" + - name: source_image_family + description: Source image family. If neither source_image nor source_image_family is specified, defaults to the latest public Rocky Linux 9 optimized for GCP image. + varType: string + defaultValue: rocky-linux-9-optimized-gcp + - name: source_image_project + description: Project where the source image comes from. The default project contains Rocky Linux images. + varType: string + defaultValue: rocky-linux-cloud + - name: disk_size_gb + description: Boot disk size in GB + varType: string + defaultValue: "100" + - name: disk_type + description: Boot disk type, can be either pd-ssd, local-ssd, or pd-standard + varType: string + defaultValue: pd-standard + - name: disk_labels + description: Labels to be assigned to boot disk, provided as a map + varType: map(string) + defaultValue: {} + - name: disk_encryption_key + description: The id of the encryption key that is stored in Google Cloud KMS to use to encrypt all the disks on this instance + varType: string + - name: auto_delete + description: Whether or not the boot disk should be auto-deleted + varType: string + defaultValue: "true" - name: additional_disks description: List of maps of additional disks. See https://www.terraform.io/docs/providers/google/r/compute_instance_template#disk_name varType: |- @@ -106,6 +200,32 @@ spec: source_snapshot = optional(string) })) defaultValue: [] + - name: disk_resource_policies + description: A list (short name or id) of resource policies to attach to this disk for automatic snapshot creations + varType: list(string) + defaultValue: [] + - name: network + description: The name or self_link of the network to attach this interface to. Use network attribute for Legacy or Auto subnetted networks and subnetwork for custom subnetted networks. + varType: string + defaultValue: "" + - name: subnetwork + description: The name of the subnetwork to attach this interface to. The subnetwork must exist in the same region this instance will be created in. Either network or subnetwork must be provided. + varType: string + defaultValue: "" + - name: subnetwork_project + description: The ID of the project in which the subnetwork belongs. If it is not provided, the provider project is used. + varType: string + defaultValue: "" + - name: network_ip + description: Private IP address to assign to the instance if desired. + varType: string + defaultValue: "" + - name: nic_type + description: Valid values are "VIRTIO_NET", "GVNIC" or set to null to accept API default behavior. + varType: string + - name: stack_type + description: The stack type for this network interface to identify whether the IPv6 feature is enabled or not. Values are `IPV4_IPV6` or `IPV4_ONLY`. Default behavior is equivalent to IPV4_ONLY. + varType: string - name: additional_networks description: Additional network interface details for GCE, if any. varType: |- @@ -130,95 +250,14 @@ spec: })) })) defaultValue: [] - - name: alias_ip_range - description: | - An array of alias IP ranges for this network interface. Can only be specified for network interfaces on subnet-mode networks. - ip_cidr_range: The IP CIDR range represented by this alias IP range. This IP CIDR range must belong to the specified subnetwork and cannot contain IP addresses reserved by system or used by other network interfaces. At the time of writing only a netmask (e.g. /24) may be supplied, with a CIDR format resulting in an API error. - subnetwork_range_name: The subnetwork secondary range name specifying the secondary range from which to allocate the IP CIDR range for this alias IP range. If left unspecified, the primary range of the subnetwork will be used. - varType: |- - object({ - ip_cidr_range = string - subnetwork_range_name = string - }) - - name: auto_delete - description: Whether or not the boot disk should be auto-deleted - varType: string - defaultValue: "true" - - name: automatic_restart - description: (Optional) Specifies whether the instance should be automatically restarted if it is terminated by Compute Engine (not terminated by a user). - varType: bool - defaultValue: true - - name: can_ip_forward - description: Enable IP forwarding, for NAT instances for example - varType: string - defaultValue: "false" - - name: confidential_instance_type - description: Defines the confidential computing technology the instance uses. If this is set to "SEV_SNP", var.min_cpu_platform will be automatically set to "AMD Milan". See https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_instance#confidential_instance_type. - varType: string - - name: description - description: The template's description - varType: string - defaultValue: "" - - name: disk_encryption_key - description: The id of the encryption key that is stored in Google Cloud KMS to use to encrypt all the disks on this instance - varType: string - - name: disk_labels - description: Labels to be assigned to boot disk, provided as a map - varType: map(string) - defaultValue: {} - - name: disk_resource_policies - description: A list (short name or id) of resource policies to attach to this disk for automatic snapshot creations - varType: list(string) - defaultValue: [] - - name: disk_size_gb - description: Boot disk size in GB - varType: string - defaultValue: "100" - - name: disk_type - description: Boot disk type, can be either pd-ssd, local-ssd, or pd-standard + - name: total_egress_bandwidth_tier + description: Egress bandwidth tier setting for supported VM families varType: string - defaultValue: pd-standard - - name: enable_confidential_vm - description: Whether to enable the Confidential VM configuration on the instance. Note that the instance image must support Confidential VMs. See https://cloud.google.com/compute/docs/images - varType: bool - defaultValue: false - - name: enable_nested_virtualization - description: Defines whether the instance should have nested virtualization enabled. - varType: bool - defaultValue: false - - name: enable_shielded_vm - description: Whether to enable the Shielded VM configuration on the instance. Note that the instance image must support Shielded VMs. See https://cloud.google.com/compute/docs/images - varType: bool - defaultValue: false - - name: gpu - description: GPU information. Type and count of GPU to attach to the instance template. See https://cloud.google.com/compute/docs/gpus more details - varType: |- - object({ - type = string - count = number - }) - - name: instance_description - description: Description of the generated instances + defaultValue: DEFAULT + - name: startup_script + description: User startup script to run when instances spin up varType: string defaultValue: "" - - name: ipv6_access_config - description: IPv6 access configurations. Currently a max of 1 IPv6 access configuration is supported. If not specified, the instance will have no external IPv6 Internet access. - varType: |- - list(object({ - network_tier = string - })) - defaultValue: [] - - name: labels - description: Labels, provided as a map - varType: map(string) - defaultValue: {} - - name: machine_type - description: Machine type to create, e.g. n1-standard-1 - varType: string - defaultValue: n1-standard-1 - - name: maintenance_interval - description: Specifies the frequency of planned maintenance events - varType: string - name: metadata description: Metadata, provided as a map varType: map(string) @@ -244,42 +283,6 @@ spec: version: ~> 4.3 spec: outputExpr: env_vars - - name: min_cpu_platform - description: "Specifies a minimum CPU platform. Applicable values are the friendly names of CPU platforms, such as Intel Haswell or Intel Skylake. See the complete list: https://cloud.google.com/compute/docs/instances/specify-min-cpu-platform" - varType: string - - name: name_prefix - description: Name prefix for the instance template - varType: string - defaultValue: default-instance-template - - name: network - description: The name or self_link of the network to attach this interface to. Use network attribute for Legacy or Auto subnetted networks and subnetwork for custom subnetted networks. - varType: string - defaultValue: "" - - name: network_ip - description: Private IP address to assign to the instance if desired. - varType: string - defaultValue: "" - - name: nic_type - description: Valid values are "VIRTIO_NET", "GVNIC" or set to null to accept API default behavior. - varType: string - - name: on_host_maintenance - description: Instance availability Policy - varType: string - defaultValue: MIGRATE - - name: preemptible - description: Allow the instance to be preempted - varType: bool - defaultValue: false - - name: project_id - description: The GCP project ID - varType: string - - name: region - description: Region where the instance template should be created. - varType: string - - name: resource_policies - description: A list of self_links of resource policies to attach to the instance. Modifying this list will cause the instance to recreate. Currently a max of 1 resource policy is supported. - varType: list(string) - defaultValue: [] - name: service_account description: Service account to attach to the instance. See https://www.terraform.io/docs/providers/google/r/compute_instance_template#service_account. varType: |- @@ -295,6 +298,10 @@ spec: spec: outputExpr: email inputPath: email + - name: enable_shielded_vm + description: Whether to enable the Shielded VM configuration on the instance. Note that the instance image must support Shielded VMs. See https://cloud.google.com/compute/docs/images + varType: bool + defaultValue: false - name: shielded_instance_config description: Not used unless enable_shielded_vm is true. Shielded VM configuration for the instance. varType: |- @@ -307,52 +314,45 @@ spec: enable_integrity_monitoring: true enable_secure_boot: true enable_vtpm: true - - name: source_image - description: Source disk image. If neither source_image nor source_image_family is specified, defaults to the latest public Rocky Linux 9 optimized for GCP image. - varType: string - defaultValue: "" - - name: source_image_family - description: Source image family. If neither source_image nor source_image_family is specified, defaults to the latest public Rocky Linux 9 optimized for GCP image. - varType: string - defaultValue: rocky-linux-9-optimized-gcp - - name: source_image_project - description: Project where the source image comes from. The default project contains Rocky Linux images. - varType: string - defaultValue: rocky-linux-cloud - - name: spot - description: Provision a SPOT instance + - name: enable_confidential_vm + description: Whether to enable the Confidential VM configuration on the instance. Note that the instance image must support Confidential VMs. See https://cloud.google.com/compute/docs/images varType: bool defaultValue: false - - name: spot_instance_termination_action - description: Action to take when Compute Engine preempts a Spot VM. - varType: string - defaultValue: STOP - - name: stack_type - description: The stack type for this network interface to identify whether the IPv6 feature is enabled or not. Values are `IPV4_IPV6` or `IPV4_ONLY`. Default behavior is equivalent to IPV4_ONLY. - varType: string - - name: startup_script - description: User startup script to run when instances spin up - varType: string - defaultValue: "" - - name: subnetwork - description: The name of the subnetwork to attach this interface to. The subnetwork must exist in the same region this instance will be created in. Either network or subnetwork must be provided. - varType: string - defaultValue: "" - - name: subnetwork_project - description: The ID of the project in which the subnetwork belongs. If it is not provided, the provider project is used. + - name: confidential_instance_type + description: Defines the confidential computing technology the instance uses. If this is set to "SEV_SNP", var.min_cpu_platform will be automatically set to "AMD Milan". See https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_instance#confidential_instance_type. varType: string - defaultValue: "" - - name: tags - description: Network tags, provided as a list - varType: list(string) + - name: access_config + description: Access configurations, i.e. IPs via which the VM instance can be accessed via the Internet. + varType: |- + list(object({ + nat_ip = string + network_tier = string + })) defaultValue: [] - - name: threads_per_core - description: The number of threads per physical core. To disable simultaneous multithreading (SMT) set this to 1. - varType: number - - name: total_egress_bandwidth_tier - description: Egress bandwidth tier setting for supported VM families - varType: string - defaultValue: DEFAULT + - name: ipv6_access_config + description: IPv6 access configurations. Currently a max of 1 IPv6 access configuration is supported. If not specified, the instance will have no external IPv6 Internet access. + varType: |- + list(object({ + network_tier = string + })) + defaultValue: [] + - name: gpu + description: GPU information. Type and count of GPU to attach to the instance template. See https://cloud.google.com/compute/docs/gpus more details + varType: |- + object({ + type = string + count = number + }) + - name: alias_ip_range + description: | + An array of alias IP ranges for this network interface. Can only be specified for network interfaces on subnet-mode networks. + ip_cidr_range: The IP CIDR range represented by this alias IP range. This IP CIDR range must belong to the specified subnetwork and cannot contain IP addresses reserved by system or used by other network interfaces. At the time of writing only a netmask (e.g. /24) may be supplied, with a CIDR format resulting in an API error. + subnetwork_range_name: The subnetwork secondary range name specifying the secondary range from which to allocate the IP CIDR range for this alias IP range. If left unspecified, the primary range of the subnetwork will be used. + varType: |- + object({ + ip_cidr_range = string + subnetwork_range_name = string + }) outputs: - name: name description: Name of instance template @@ -383,3 +383,6 @@ spec: - serviceusage.googleapis.com - compute.googleapis.com - iam.googleapis.com + providerVersions: + - source: hashicorp/google-beta + version: ">= 5.36, < 7" diff --git a/modules/mig/README.md b/modules/mig/README.md index baace6dc..b8d59c4a 100644 --- a/modules/mig/README.md +++ b/modules/mig/README.md @@ -38,8 +38,8 @@ The current version is 2.X. The following guides are available to assist with up | mig\_timeouts | Times for creation, deleting and updating the MIG resources. Can be helpful when using wait\_for\_instances to allow a longer VM startup time. |
object({
create = string
update = string
delete = string
})
|
{
"create": "5m",
"delete": "15m",
"update": "5m"
}
| no | | min\_replicas | The minimum number of replicas that the autoscaler can scale down to. This cannot be less than 0. | `number` | `2` | no | | named\_ports | Named name and named port. https://cloud.google.com/load-balancing/docs/backend-service#named_ports |
list(object({
name = string
port = number
}))
| `[]` | no | -| project\_id | The GCP project ID | `string` | `null` | no | -| region | The GCP region where the managed instance group resides. | `string` | n/a | yes | +| project\_id | The Google Cloud project ID | `string` | `null` | no | +| region | The Google Cloud region where the managed instance group resides. | `string` | n/a | yes | | scaling\_schedules | Autoscaling, scaling schedule block. https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_autoscaler#scaling_schedules |
list(object({
disabled = bool
duration_sec = number
min_required_replicas = number
name = string
schedule = string
time_zone = string
}))
| `[]` | no | | stateful\_disks | Disks created on the instances that will be preserved on instance delete. https://cloud.google.com/compute/docs/instance-groups/configuring-stateful-disks-in-migs |
list(object({
device_name = string
delete_rule = string
}))
| `[]` | no | | stateful\_ips | Statful IPs created on the instances that will be preserved on instance delete. https://cloud.google.com/compute/docs/instance-groups/configuring-stateful-ip-addresses-in-migs |
list(object({
interface_name = string
delete_rule = string
is_external = bool
}))
| `[]` | no | diff --git a/modules/mig/metadata.yaml b/modules/mig/metadata.yaml index f7b48051..0982991b 100644 --- a/modules/mig/metadata.yaml +++ b/modules/mig/metadata.yaml @@ -80,54 +80,39 @@ spec: location: examples/compute_instance/tags interfaces: variables: - - name: autoscaler_name - description: Autoscaler name. When variable is empty, name will be derived from var.hostname. + - name: project_id + description: The Google Cloud project ID + varType: string + - name: hostname + description: Hostname prefix for instances + varType: string + defaultValue: default + - name: mig_name + description: Managed instance group name. When variable is empty, name will be derived from var.hostname. varType: string defaultValue: "" - - name: autoscaling_cpu - description: Autoscaling, cpu utilization policy block as single element array. https://www.terraform.io/docs/providers/google/r/compute_autoscaler#cpu_utilization - varType: |- - list(object({ - target = number - predictive_method = string - })) - defaultValue: [] - - name: autoscaling_enabled - description: Creates an autoscaler for the managed instance group + - name: region + description: The Google Cloud region where the managed instance group resides. varType: string - defaultValue: "false" - - name: autoscaling_lb - description: Autoscaling, load balancing utilization policy block as single element array. https://www.terraform.io/docs/providers/google/r/compute_autoscaler#load_balancing_utilization - varType: list(map(number)) - defaultValue: [] - - name: autoscaling_metric - description: Autoscaling, metric policy block as single element array. https://www.terraform.io/docs/providers/google/r/compute_autoscaler#metric - varType: |- - list(object({ - name = string - target = number - type = string - })) - defaultValue: [] - - name: autoscaling_mode - description: Operating mode of the autoscaling policy. If omitted, the default value is ON. https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_autoscaler#mode + required: true + - name: instance_template + description: Instance template self_link used to create compute instances varType: string - - name: autoscaling_scale_in_control - description: Autoscaling, scale-in control block. https://www.terraform.io/docs/providers/google/r/compute_autoscaler#scale_in_control - varType: |- - object({ - fixed_replicas = number - percent_replicas = number - time_window_sec = number - }) - defaultValue: - fixed_replicas: null - percent_replicas: null - time_window_sec: null - - name: cooldown_period - description: The number of seconds that the autoscaler should wait before it starts collecting information from a new instance. + required: true + connections: + - source: + source: github.com/terraform-google-modules/terraform-google-vm//modules/instance_template + version: ~> 12.0 + spec: + outputExpr: self_link + - name: target_size + 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. varType: number - defaultValue: 60 + defaultValue: 1 + - name: target_pools + description: The target load balancing pools to assign this group to. + varType: list(string) + defaultValue: [] - name: distribution_policy_target_shape description: MIG target distribution shape (EVEN, BALANCED, ANY, ANY_SINGLE_ZONE) varType: string @@ -135,6 +120,43 @@ spec: description: The distribution policy, i.e. which zone(s) should instances be create in. Default is all zones in given region. varType: list(string) defaultValue: [] + - name: stateful_disks + description: Disks created on the instances that will be preserved on instance delete. https://cloud.google.com/compute/docs/instance-groups/configuring-stateful-disks-in-migs + varType: |- + list(object({ + device_name = string + delete_rule = string + })) + defaultValue: [] + - name: stateful_ips + description: Statful IPs created on the instances that will be preserved on instance delete. https://cloud.google.com/compute/docs/instance-groups/configuring-stateful-ip-addresses-in-migs + varType: |- + list(object({ + interface_name = string + delete_rule = string + is_external = bool + })) + defaultValue: [] + - name: update_policy + description: The rolling update policy. https://www.terraform.io/docs/providers/google/r/compute_region_instance_group_manager#rolling_update_policy + varType: |- + list(object({ + max_surge_fixed = optional(number) + instance_redistribution_type = optional(string) + max_surge_percent = optional(number) + max_unavailable_fixed = optional(number) + max_unavailable_percent = optional(number) + min_ready_sec = optional(number) + replacement_method = optional(string) + minimal_action = string + type = string + most_disruptive_allowed_action = optional(string) + })) + defaultValue: [] + - name: health_check_name + description: Health check name. When variable is empty, name will be derived from var.hostname. + varType: string + defaultValue: "" - name: health_check description: Health check to determine whether instances are responsive and able to do work varType: |- @@ -167,67 +189,50 @@ spec: timeout_sec: 10 type: "" unhealthy_threshold: 5 - - name: health_check_name - description: Health check name. When variable is empty, name will be derived from var.hostname. + - name: autoscaler_name + description: Autoscaler name. When variable is empty, name will be derived from var.hostname. varType: string defaultValue: "" - - name: hostname - description: Hostname prefix for instances - varType: string - defaultValue: default - - name: instance_template - description: Instance template self_link used to create compute instances + - name: autoscaling_enabled + description: Creates an autoscaler for the managed instance group varType: string - required: true - connections: - - source: - source: github.com/terraform-google-modules/terraform-google-vm//modules/instance_template - version: ~> 12.0 - spec: - outputExpr: self_link - - name: labels - description: Labels, provided as a map - varType: map(string) - defaultValue: {} + defaultValue: "false" - name: max_replicas description: The maximum number of instances that the autoscaler can scale up to. This is required when creating or updating an autoscaler. The maximum number of replicas should not be lower than minimal number of replicas. varType: number defaultValue: 10 - - name: mig_name - description: Managed instance group name. When variable is empty, name will be derived from var.hostname. - varType: string - defaultValue: "" - - name: mig_timeouts - description: "Times for creation, deleting and updating the MIG resources. Can be helpful when using wait_for_instances to allow a longer VM startup time. " - varType: |- - object({ - create = string - update = string - delete = string - }) - defaultValue: - create: 5m - delete: 15m - update: 5m - name: min_replicas description: The minimum number of replicas that the autoscaler can scale down to. This cannot be less than 0. varType: number defaultValue: 2 - - name: named_ports - description: Named name and named port. https://cloud.google.com/load-balancing/docs/backend-service#named_ports + - name: cooldown_period + description: The number of seconds that the autoscaler should wait before it starts collecting information from a new instance. + varType: number + defaultValue: 60 + - name: autoscaling_mode + description: Operating mode of the autoscaling policy. If omitted, the default value is ON. https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_autoscaler#mode + varType: string + - name: autoscaling_cpu + description: Autoscaling, cpu utilization policy block as single element array. https://www.terraform.io/docs/providers/google/r/compute_autoscaler#cpu_utilization varType: |- list(object({ - name = string - port = number + target = number + predictive_method = string })) defaultValue: [] - - name: project_id - description: The GCP project ID - varType: string - - name: region - description: The GCP region where the managed instance group resides. - varType: string - required: true + - name: autoscaling_metric + description: Autoscaling, metric policy block as single element array. https://www.terraform.io/docs/providers/google/r/compute_autoscaler#metric + varType: |- + list(object({ + name = string + target = number + type = string + })) + defaultValue: [] + - name: autoscaling_lb + description: Autoscaling, load balancing utilization policy block as single element array. https://www.terraform.io/docs/providers/google/r/compute_autoscaler#load_balancing_utilization + varType: list(map(number)) + defaultValue: [] - name: scaling_schedules description: Autoscaling, scaling schedule block. https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_autoscaler#scaling_schedules varType: |- @@ -240,51 +245,46 @@ spec: time_zone = string })) defaultValue: [] - - name: stateful_disks - description: Disks created on the instances that will be preserved on instance delete. https://cloud.google.com/compute/docs/instance-groups/configuring-stateful-disks-in-migs - varType: |- - list(object({ - device_name = string - delete_rule = string - })) - defaultValue: [] - - name: stateful_ips - description: Statful IPs created on the instances that will be preserved on instance delete. https://cloud.google.com/compute/docs/instance-groups/configuring-stateful-ip-addresses-in-migs + - name: autoscaling_scale_in_control + description: Autoscaling, scale-in control block. https://www.terraform.io/docs/providers/google/r/compute_autoscaler#scale_in_control varType: |- - list(object({ - interface_name = string - delete_rule = string - is_external = bool - })) - defaultValue: [] - - name: target_pools - description: The target load balancing pools to assign this group to. - varType: list(string) - defaultValue: [] - - name: target_size - 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. - varType: number - defaultValue: 1 - - name: update_policy - description: The rolling update policy. https://www.terraform.io/docs/providers/google/r/compute_region_instance_group_manager#rolling_update_policy + object({ + fixed_replicas = number + percent_replicas = number + time_window_sec = number + }) + defaultValue: + fixed_replicas: null + percent_replicas: null + time_window_sec: null + - name: named_ports + description: Named name and named port. https://cloud.google.com/load-balancing/docs/backend-service#named_ports varType: |- list(object({ - max_surge_fixed = optional(number) - instance_redistribution_type = optional(string) - max_surge_percent = optional(number) - max_unavailable_fixed = optional(number) - max_unavailable_percent = optional(number) - min_ready_sec = optional(number) - replacement_method = optional(string) - minimal_action = string - type = string - most_disruptive_allowed_action = optional(string) + name = string + port = number })) defaultValue: [] - name: wait_for_instances 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. varType: string defaultValue: "false" + - name: mig_timeouts + description: "Times for creation, deleting and updating the MIG resources. Can be helpful when using wait_for_instances to allow a longer VM startup time. " + varType: |- + object({ + create = string + update = string + delete = string + }) + defaultValue: + create: 5m + delete: 15m + update: 5m + - name: labels + description: Labels, provided as a map + varType: map(string) + defaultValue: {} outputs: - name: health_check_self_links description: All self_links of healthchecks created for the instance group. @@ -314,3 +314,8 @@ spec: - serviceusage.googleapis.com - compute.googleapis.com - iam.googleapis.com + providerVersions: + - source: hashicorp/google + version: ">= 4.48, < 7" + - source: hashicorp/google-beta + version: ">= 4.48, < 7" diff --git a/modules/mig/variables.tf b/modules/mig/variables.tf index 42fd903f..a4de8132 100644 --- a/modules/mig/variables.tf +++ b/modules/mig/variables.tf @@ -18,7 +18,7 @@ variable "project_id" { type = string - description = "The GCP project ID" + description = "The Google Cloud project ID" default = null } @@ -35,7 +35,7 @@ variable "mig_name" { } variable "region" { - description = "The GCP region where the managed instance group resides." + description = "The Google Cloud region where the managed instance group resides." type = string } diff --git a/modules/mig_with_percent/README.md b/modules/mig_with_percent/README.md index 4f03d687..af5c24a0 100644 --- a/modules/mig_with_percent/README.md +++ b/modules/mig_with_percent/README.md @@ -39,8 +39,8 @@ The current version is 2.X. The following guides are available to assist with up | min\_replicas | The minimum number of replicas that the autoscaler can scale down to. This cannot be less than 0. | `number` | `2` | no | | named\_ports | Named name and named port. https://cloud.google.com/load-balancing/docs/backend-service#named_ports |
list(object({
name = string
port = number
}))
| `[]` | no | | next\_version\_percent | Percentage of instances defined in the second version | `number` | n/a | yes | -| project\_id | The GCP project ID | `string` | `null` | no | -| region | The GCP region where the managed instance group resides. | `string` | n/a | yes | +| project\_id | The Google Cloud project ID | `string` | `null` | no | +| region | The Google Cloud region where the managed instance group resides. | `string` | n/a | yes | | scaling\_schedules | Autoscaling, scaling schedule block. https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_autoscaler#scaling_schedules |
list(object({
disabled = bool
duration_sec = number
min_required_replicas = number
name = string
schedule = string
time_zone = string
}))
| `[]` | no | | stateful\_disks | Disks created on the instances that will be preserved on instance delete. https://cloud.google.com/compute/docs/instance-groups/configuring-stateful-disks-in-migs |
list(object({
device_name = string
delete_rule = string
}))
| `[]` | no | | stateful\_ips | Statful IPs created on the instances that will be preserved on instance delete. https://cloud.google.com/compute/docs/instance-groups/configuring-stateful-ip-addresses-in-migs |
list(object({
interface_name = string
delete_rule = string
is_external = bool
}))
| `[]` | no | diff --git a/modules/mig_with_percent/metadata.yaml b/modules/mig_with_percent/metadata.yaml index 40a0bf4c..439a05c1 100644 --- a/modules/mig_with_percent/metadata.yaml +++ b/modules/mig_with_percent/metadata.yaml @@ -80,54 +80,41 @@ spec: location: examples/compute_instance/tags interfaces: variables: - - name: autoscaler_name - description: Autoscaler name. When variable is empty, name will be derived from var.hostname. + - name: project_id + description: The Google Cloud project ID + varType: string + - name: hostname + description: Hostname prefix for instances + varType: string + defaultValue: default + - name: mig_name + description: Managed instance group name. When variable is empty, name will be derived from var.hostname. varType: string defaultValue: "" - - name: autoscaling_cpu - description: Autoscaling, cpu utilization policy block as single element array. https://www.terraform.io/docs/providers/google/r/compute_autoscaler#cpu_utilization - varType: |- - list(object({ - target = number - predictive_method = string - })) - defaultValue: [] - - name: autoscaling_enabled - description: Creates an autoscaler for the managed instance group + - name: region + description: The Google Cloud region where the managed instance group resides. varType: string - defaultValue: "false" - - name: autoscaling_lb - description: Autoscaling, load balancing utilization policy block as single element array. https://www.terraform.io/docs/providers/google/r/compute_autoscaler#load_balancing_utilization - varType: list(map(number)) - defaultValue: [] - - name: autoscaling_metric - description: Autoscaling, metric policy block as single element array. https://www.terraform.io/docs/providers/google/r/compute_autoscaler#metric - varType: |- - list(object({ - name = string - target = number - type = string - })) - defaultValue: [] - - name: autoscaling_mode - description: Operating mode of the autoscaling policy. If omitted, the default value is ON. https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_autoscaler#mode + required: true + - name: instance_template_initial_version + description: Instance template self_link used to create compute instances for the initial version varType: string - - name: autoscaling_scale_in_control - description: Autoscaling, scale-in control block. https://www.terraform.io/docs/providers/google/r/compute_autoscaler#scale_in_control - varType: |- - object({ - fixed_replicas = number - percent_replicas = number - time_window_sec = number - }) - defaultValue: - fixed_replicas: null - percent_replicas: null - time_window_sec: null - - name: cooldown_period - description: The number of seconds that the autoscaler should wait before it starts collecting information from a new instance. + required: true + - name: instance_template_next_version + description: Instance template self_link used to create compute instances for the second version + varType: string + required: true + - name: next_version_percent + description: Percentage of instances defined in the second version varType: number - defaultValue: 60 + required: true + - name: target_size + 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. + varType: number + defaultValue: 1 + - name: target_pools + description: The target load balancing pools to assign this group to. + varType: list(string) + defaultValue: [] - name: distribution_policy_target_shape description: MIG target distribution shape (EVEN, BALANCED, ANY, ANY_SINGLE_ZONE) varType: string @@ -135,6 +122,43 @@ spec: description: The distribution policy, i.e. which zone(s) should instances be create in. Default is all zones in given region. varType: list(string) defaultValue: [] + - name: stateful_disks + description: Disks created on the instances that will be preserved on instance delete. https://cloud.google.com/compute/docs/instance-groups/configuring-stateful-disks-in-migs + varType: |- + list(object({ + device_name = string + delete_rule = string + })) + defaultValue: [] + - name: stateful_ips + description: Statful IPs created on the instances that will be preserved on instance delete. https://cloud.google.com/compute/docs/instance-groups/configuring-stateful-ip-addresses-in-migs + varType: |- + list(object({ + interface_name = string + delete_rule = string + is_external = bool + })) + defaultValue: [] + - name: update_policy + description: The rolling update policy. https://www.terraform.io/docs/providers/google/r/compute_region_instance_group_manager#rolling_update_policy + varType: |- + list(object({ + max_surge_fixed = optional(number) + instance_redistribution_type = optional(string) + max_surge_percent = optional(number) + max_unavailable_fixed = optional(number) + max_unavailable_percent = optional(number) + min_ready_sec = optional(number) + replacement_method = optional(string) + minimal_action = string + type = string + most_disruptive_allowed_action = optional(string) + })) + defaultValue: [] + - name: health_check_name + description: Health check name. When variable is empty, name will be derived from var.hostname. + varType: string + defaultValue: "" - name: health_check description: Health check to determine whether instances are responsive and able to do work varType: |- @@ -167,69 +191,50 @@ spec: timeout_sec: 10 type: "" unhealthy_threshold: 5 - - name: health_check_name - description: Health check name. When variable is empty, name will be derived from var.hostname. + - name: autoscaler_name + description: Autoscaler name. When variable is empty, name will be derived from var.hostname. varType: string defaultValue: "" - - name: hostname - description: Hostname prefix for instances - varType: string - defaultValue: default - - name: instance_template_initial_version - description: Instance template self_link used to create compute instances for the initial version - varType: string - required: true - - name: instance_template_next_version - description: Instance template self_link used to create compute instances for the second version + - name: autoscaling_enabled + description: Creates an autoscaler for the managed instance group varType: string - required: true - - name: labels - description: Labels, provided as a map - varType: map(string) - defaultValue: {} + defaultValue: "false" - name: max_replicas description: The maximum number of instances that the autoscaler can scale up to. This is required when creating or updating an autoscaler. The maximum number of replicas should not be lower than minimal number of replicas. varType: number defaultValue: 10 - - name: mig_name - description: Managed instance group name. When variable is empty, name will be derived from var.hostname. - varType: string - defaultValue: "" - - name: mig_timeouts - description: "Times for creation, deleting and updating the MIG resources. Can be helpful when using wait_for_instances to allow a longer VM startup time. " - varType: |- - object({ - create = string - update = string - delete = string - }) - defaultValue: - create: 5m - delete: 15m - update: 5m - name: min_replicas description: The minimum number of replicas that the autoscaler can scale down to. This cannot be less than 0. varType: number defaultValue: 2 - - name: named_ports - description: Named name and named port. https://cloud.google.com/load-balancing/docs/backend-service#named_ports + - name: cooldown_period + description: The number of seconds that the autoscaler should wait before it starts collecting information from a new instance. + varType: number + defaultValue: 60 + - name: autoscaling_mode + description: Operating mode of the autoscaling policy. If omitted, the default value is ON. https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_autoscaler#mode + varType: string + - name: autoscaling_cpu + description: Autoscaling, cpu utilization policy block as single element array. https://www.terraform.io/docs/providers/google/r/compute_autoscaler#cpu_utilization varType: |- list(object({ - name = string - port = number + target = number + predictive_method = string })) defaultValue: [] - - name: next_version_percent - description: Percentage of instances defined in the second version - varType: number - required: true - - name: project_id - description: The GCP project ID - varType: string - - name: region - description: The GCP region where the managed instance group resides. - varType: string - required: true + - name: autoscaling_metric + description: Autoscaling, metric policy block as single element array. https://www.terraform.io/docs/providers/google/r/compute_autoscaler#metric + varType: |- + list(object({ + name = string + target = number + type = string + })) + defaultValue: [] + - name: autoscaling_lb + description: Autoscaling, load balancing utilization policy block as single element array. https://www.terraform.io/docs/providers/google/r/compute_autoscaler#load_balancing_utilization + varType: list(map(number)) + defaultValue: [] - name: scaling_schedules description: Autoscaling, scaling schedule block. https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_autoscaler#scaling_schedules varType: |- @@ -242,51 +247,46 @@ spec: time_zone = string })) defaultValue: [] - - name: stateful_disks - description: Disks created on the instances that will be preserved on instance delete. https://cloud.google.com/compute/docs/instance-groups/configuring-stateful-disks-in-migs - varType: |- - list(object({ - device_name = string - delete_rule = string - })) - defaultValue: [] - - name: stateful_ips - description: Statful IPs created on the instances that will be preserved on instance delete. https://cloud.google.com/compute/docs/instance-groups/configuring-stateful-ip-addresses-in-migs + - name: autoscaling_scale_in_control + description: Autoscaling, scale-in control block. https://www.terraform.io/docs/providers/google/r/compute_autoscaler#scale_in_control varType: |- - list(object({ - interface_name = string - delete_rule = string - is_external = bool - })) - defaultValue: [] - - name: target_pools - description: The target load balancing pools to assign this group to. - varType: list(string) - defaultValue: [] - - name: target_size - 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. - varType: number - defaultValue: 1 - - name: update_policy - description: The rolling update policy. https://www.terraform.io/docs/providers/google/r/compute_region_instance_group_manager#rolling_update_policy + object({ + fixed_replicas = number + percent_replicas = number + time_window_sec = number + }) + defaultValue: + fixed_replicas: null + percent_replicas: null + time_window_sec: null + - name: named_ports + description: Named name and named port. https://cloud.google.com/load-balancing/docs/backend-service#named_ports varType: |- list(object({ - max_surge_fixed = optional(number) - instance_redistribution_type = optional(string) - max_surge_percent = optional(number) - max_unavailable_fixed = optional(number) - max_unavailable_percent = optional(number) - min_ready_sec = optional(number) - replacement_method = optional(string) - minimal_action = string - type = string - most_disruptive_allowed_action = optional(string) + name = string + port = number })) defaultValue: [] - name: wait_for_instances 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. varType: string defaultValue: "false" + - name: mig_timeouts + description: "Times for creation, deleting and updating the MIG resources. Can be helpful when using wait_for_instances to allow a longer VM startup time. " + varType: |- + object({ + create = string + update = string + delete = string + }) + defaultValue: + create: 5m + delete: 15m + update: 5m + - name: labels + description: Labels, provided as a map + varType: map(string) + defaultValue: {} outputs: - name: health_check_self_links description: All self_links of healthchecks created for the instance group. @@ -311,3 +311,8 @@ spec: - serviceusage.googleapis.com - compute.googleapis.com - iam.googleapis.com + providerVersions: + - source: hashicorp/google + version: ">= 4.48, < 7" + - source: hashicorp/google-beta + version: ">= 4.48, < 7" diff --git a/modules/mig_with_percent/variables.tf b/modules/mig_with_percent/variables.tf index 40af6859..c73e514b 100644 --- a/modules/mig_with_percent/variables.tf +++ b/modules/mig_with_percent/variables.tf @@ -18,7 +18,7 @@ variable "project_id" { type = string - description = "The GCP project ID" + description = "The Google Cloud project ID" default = null } @@ -35,7 +35,7 @@ variable "mig_name" { } variable "region" { - description = "The GCP region where the managed instance group resides." + description = "The Google Cloud region where the managed instance group resides." type = string } diff --git a/modules/preemptible_and_regular_instance_templates/metadata.yaml b/modules/preemptible_and_regular_instance_templates/metadata.yaml index f63ce997..e2266149 100644 --- a/modules/preemptible_and_regular_instance_templates/metadata.yaml +++ b/modules/preemptible_and_regular_instance_templates/metadata.yaml @@ -80,81 +80,29 @@ spec: location: examples/compute_instance/tags interfaces: variables: - - name: access_config - description: Access configurations, i.e. IPs via which the VM instance can be accessed via the Internet. - varType: |- - list(object({ - nat_ip = string - network_tier = string - })) - defaultValue: [] - - name: additional_disks - description: List of maps of additional disks. See https://www.terraform.io/docs/providers/google/r/compute_instance_template#disk_name - varType: |- - list(object({ - disk_name = string - device_name = string - auto_delete = bool - boot = bool - disk_size_gb = number - disk_type = string - disk_labels = map(string) - })) - defaultValue: [] - - name: auto_delete - description: Whether or not the boot disk should be auto-deleted - varType: bool - defaultValue: true + - name: project_id + description: The GCP project ID + varType: string + - name: name_prefix + description: Name prefix for the instance template + varType: string + defaultValue: default-it + - name: machine_type + description: Machine type to create, e.g. n1-standard-1 + varType: string + defaultValue: n1-standard-1 - name: can_ip_forward description: Enable IP forwarding, for NAT instances for example varType: string defaultValue: "false" - - name: disk_size_gb - description: Boot disk size in GB - varType: string - defaultValue: "100" - - name: disk_type - description: Boot disk type, can be either pd-ssd, local-ssd, or pd-standard - varType: string - defaultValue: pd-standard - - name: ipv6_access_config - description: IPv6 access configurations. Currently a max of 1 IPv6 access configuration is supported. If not specified, the instance will have no external IPv6 Internet access. - varType: |- - list(object({ - network_tier = string - })) + - name: tags + description: Network tags, provided as a list + varType: list(string) defaultValue: [] - name: labels description: Labels, provided as a map varType: map(string) defaultValue: {} - - name: machine_type - description: Machine type to create, e.g. n1-standard-1 - varType: string - defaultValue: n1-standard-1 - - name: metadata - description: Metadata, provided as a map - varType: map(string) - defaultValue: {} - - name: name_prefix - description: Name prefix for the instance template - varType: string - defaultValue: default-it - - name: network - description: The name or self_link of the network to attach this interface to. Use network attribute for Legacy or Auto subnetted networks and subnetwork for custom subnetted networks. - varType: string - defaultValue: "" - - name: project_id - description: The GCP project ID - varType: string - - name: service_account - description: Service account to attach to the instance. See https://www.terraform.io/docs/providers/google/r/compute_instance_template#service_account. - varType: |- - object({ - email = string - scopes = set(string) - }) - required: true - name: source_image description: Source disk image. If neither source_image nor source_image_family is specified, defaults to the latest public Rocky Linux 9 optimized for GCP image. varType: string @@ -167,8 +115,33 @@ spec: description: Project where the source image comes from. The default project contains Rocky Linux images. varType: string defaultValue: "" - - name: startup_script - description: User startup script to run when instances spin up + - name: disk_size_gb + description: Boot disk size in GB + varType: string + defaultValue: "100" + - name: disk_type + description: Boot disk type, can be either pd-ssd, local-ssd, or pd-standard + varType: string + defaultValue: pd-standard + - name: auto_delete + description: Whether or not the boot disk should be auto-deleted + varType: bool + defaultValue: true + - name: additional_disks + description: List of maps of additional disks. See https://www.terraform.io/docs/providers/google/r/compute_instance_template#disk_name + varType: |- + list(object({ + disk_name = string + device_name = string + auto_delete = bool + boot = bool + disk_size_gb = number + disk_type = string + disk_labels = map(string) + })) + defaultValue: [] + - name: network + description: The name or self_link of the network to attach this interface to. Use network attribute for Legacy or Auto subnetted networks and subnetwork for custom subnetted networks. varType: string defaultValue: "" - name: subnetwork @@ -179,9 +152,36 @@ spec: description: The ID of the project in which the subnetwork belongs. If it is not provided, the provider project is used. varType: string defaultValue: "" - - name: tags - description: Network tags, provided as a list - varType: list(string) + - name: startup_script + description: User startup script to run when instances spin up + varType: string + defaultValue: "" + - name: metadata + description: Metadata, provided as a map + varType: map(string) + defaultValue: {} + - name: service_account + description: Service account to attach to the instance. See https://www.terraform.io/docs/providers/google/r/compute_instance_template#service_account. + varType: |- + object({ + email = string + scopes = set(string) + }) + required: true + - name: access_config + description: Access configurations, i.e. IPs via which the VM instance can be accessed via the Internet. + varType: |- + list(object({ + nat_ip = string + network_tier = string + })) + defaultValue: [] + - name: ipv6_access_config + description: IPv6 access configurations. Currently a max of 1 IPv6 access configuration is supported. If not specified, the instance will have no external IPv6 Internet access. + varType: |- + list(object({ + network_tier = string + })) defaultValue: [] outputs: - name: preemptible_name diff --git a/modules/umig/metadata.yaml b/modules/umig/metadata.yaml index c774ca26..bdc831a8 100644 --- a/modules/umig/metadata.yaml +++ b/modules/umig/metadata.yaml @@ -80,14 +80,25 @@ spec: location: examples/compute_instance/tags interfaces: variables: - - name: access_config - description: Access configurations, i.e. IPs via which the VM instance can be accessed via the Internet. - varType: |- - list(list(object({ - nat_ip = string - network_tier = string - }))) - defaultValue: [] + - name: project_id + description: The GCP project ID + varType: string + - name: network + description: Network to deploy to. Only one of network or subnetwork should be specified. + varType: string + defaultValue: "" + - name: region + description: The GCP region where the unmanaged instance group resides. + varType: string + required: true + - name: subnetwork + description: Subnet to deploy to. Only one of network or subnetwork should be specified. + varType: string + defaultValue: "" + - name: subnetwork_project + description: The project that subnetwork belongs to + varType: string + defaultValue: "" - name: additional_networks description: Additional network interface details for GCE, if any. varType: |- @@ -109,21 +120,14 @@ spec: description: Hostname of instances varType: string defaultValue: "" - - name: hostname_suffix_separator - description: Separator character to compose hostname when add_hostname_suffix is set to true. - varType: string - defaultValue: "-" - - name: instance_template - description: Instance template self_link used to create compute instances - varType: string - required: true - - name: ipv6_access_config - description: IPv6 access configurations. Currently a max of 1 IPv6 access configuration is supported. If not specified, the instance will have no external IPv6 Internet access. - varType: |- - list(list(object({ - network_tier = string - }))) + - name: static_ips + description: List of static IPs for VM instances + varType: list(string) defaultValue: [] + - name: num_instances + description: Number of instances to create. This value is ignored if static_ips is provided. + varType: string + defaultValue: "1" - name: named_ports description: Named name and named port varType: |- @@ -132,33 +136,29 @@ spec: port = number })) defaultValue: [] - - name: network - description: Network to deploy to. Only one of network or subnetwork should be specified. - varType: string - defaultValue: "" - - name: num_instances - description: Number of instances to create. This value is ignored if static_ips is provided. - varType: string - defaultValue: "1" - - name: project_id - description: The GCP project ID - varType: string - - name: region - description: The GCP region where the unmanaged instance group resides. + - name: instance_template + description: Instance template self_link used to create compute instances varType: string required: true - - name: static_ips - description: List of static IPs for VM instances - varType: list(string) + - name: access_config + description: Access configurations, i.e. IPs via which the VM instance can be accessed via the Internet. + varType: |- + list(list(object({ + nat_ip = string + network_tier = string + }))) defaultValue: [] - - name: subnetwork - description: Subnet to deploy to. Only one of network or subnetwork should be specified. - varType: string - defaultValue: "" - - name: subnetwork_project - description: The project that subnetwork belongs to + - name: ipv6_access_config + description: IPv6 access configurations. Currently a max of 1 IPv6 access configuration is supported. If not specified, the instance will have no external IPv6 Internet access. + varType: |- + list(list(object({ + network_tier = string + }))) + defaultValue: [] + - name: hostname_suffix_separator + description: Separator character to compose hostname when add_hostname_suffix is set to true. varType: string - defaultValue: "" + defaultValue: "-" - name: zones description: (Optional) List of availability zones to create VM instances in varType: list(string) @@ -189,3 +189,6 @@ spec: - serviceusage.googleapis.com - compute.googleapis.com - iam.googleapis.com + providerVersions: + - source: hashicorp/google + version: ">= 3.88, < 7"