Skip to content

googleComputeZones

Provides access to available Google Compute zones in a region for a given project. See more about regions and zones in the upstream docs.

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
const dataGoogleComputeZonesAvailable =
  new google.dataGoogleComputeZones.DataGoogleComputeZones(
    this,
    "available",
    {}
  );
const googleComputeInstanceGroupManagerFoo =
  new google.computeInstanceGroupManager.ComputeInstanceGroupManager(
    this,
    "foo",
    {
      base_instance_name: "foobar-${count.index}",
      instance_template: "${google_compute_instance_template.foobar.self_link}",
      name: "terraform-test-${count.index}",
      target_size: 1,
      zone: `\${${dataGoogleComputeZonesAvailable.names.fqn}[count.index]}`,
    }
  );
/*In most cases loops should be handled in the programming language context and 
not inside of the Terraform context. If you are looping over something external, e.g. a variable or a file input
you should consider using a for loop. If you are looping over something only known to Terraform, e.g. a result of a data source
you need to keep this like it is.*/
googleComputeInstanceGroupManagerFoo.addOverride(
  "count",
  `\${length(${dataGoogleComputeZonesAvailable.names})}`
);

Argument Reference

The following arguments are supported:

  • project (Optional) - Project from which to list available zones. Defaults to project declared in the provider.
  • region (Optional) - Region from which to list available zones. Defaults to region declared in the provider.
  • status (Optional) - Allows to filter list of zones based on their current status. Status can be either up or down. Defaults to no filtering (all available zones - both up and down).

Attributes Reference

The following attribute is exported:

  • names - A list of zones available in the given region