googleComputeRegions
Provides access to available Google Compute regions 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 dataGoogleComputeRegionsAvailable =
new google.dataGoogleComputeRegions.DataGoogleComputeRegions(
this,
"available",
{}
);
const googleComputeSubnetworkCluster =
new google.computeSubnetwork.ComputeSubnetwork(this, "cluster", {
ip_cidr_range: "10.36.${count.index}.0/24",
name: "my-network",
network: "my-network",
region: `\${${dataGoogleComputeRegionsAvailable.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.*/
googleComputeSubnetworkCluster.addOverride(
"count",
`\${length(${dataGoogleComputeRegionsAvailable.names})}`
);
Argument Reference
The following arguments are supported:
project
(Optional) - Project from which to list available regions. Defaults to project declared in the provider.status
(Optional) - Allows to filter list of regions based on their current status. Status can be eitherup
ordown
. Defaults to no filtering (all available regions - bothup
anddown
).
Attributes Reference
The following attribute is exported:
names
- A list of regions available in the given project