Class GetRegions
Inheritance
System.Object
GetRegions
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.Gcp.Compute
Assembly: Pulumi.Gcp.dll
Syntax
public static class GetRegions
Methods
View SourceInvokeAsync(GetRegionsArgs, InvokeOptions)
Provides access to available Google Compute regions for a given project. See more about regions and zones in the upstream docs.
using System.Collections.Generic;
using System.Threading.Tasks;
using Pulumi;
using Gcp = Pulumi.Gcp;
class MyStack : Stack
{
public MyStack()
{
var dict = Output.Create(Initialize());
}
private async Task<IDictionary<string, Output<string>>> Initialize()
{
var available = await Gcp.Compute.GetRegions.InvokeAsync();
var cluster = new List<Gcp.Compute.Subnetwork>();
for (var rangeIndex = 0; rangeIndex < available.Names.Length; rangeIndex++)
{
var range = new { Value = rangeIndex };
cluster.Add(new Gcp.Compute.Subnetwork($"cluster-{range.Value}", new Gcp.Compute.SubnetworkArgs
{
IpCidrRange = $"10.36.{range.Value}.0/24",
Network = "my-network",
Region = available.Names[range.Value],
}));
}
return new Dictionary<string, Output<string>>
{
};
}
}
Declaration
public static Task<GetRegionsResult> InvokeAsync(GetRegionsArgs args = null, InvokeOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| GetRegionsArgs | args | |
| InvokeOptions | options |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<GetRegionsResult> |