Equinix v0.11.2 published on Wednesday, Jun 26, 2024 by Equinix
equinix.metal.getMetro
Explore with Pulumi AI
Provides an Equinix Metal metro datasource.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as equinix from "@pulumi/equinix";
const sv = equinix.metal.getMetro({
    code: "sv",
});
export const id = sv.then(sv => sv.id);
import pulumi
import pulumi_equinix as equinix
sv = equinix.metal.get_metro(code="sv")
pulumi.export("id", sv.id)
package main
import (
	"github.com/equinix/pulumi-equinix/sdk/go/equinix/metal"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		sv, err := metal.GetMetro(ctx, &metal.GetMetroArgs{
			Code: "sv",
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("id", sv.Id)
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Equinix = Pulumi.Equinix;
return await Deployment.RunAsync(() => 
{
    var sv = Equinix.Metal.GetMetro.Invoke(new()
    {
        Code = "sv",
    });
    return new Dictionary<string, object?>
    {
        ["id"] = sv.Apply(getMetroResult => getMetroResult.Id),
    };
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.equinix.metal.MetalFunctions;
import com.pulumi.equinix.metal.inputs.GetMetroArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }
    public static void stack(Context ctx) {
        final var sv = MetalFunctions.getMetro(GetMetroArgs.builder()
            .code("sv")
            .build());
        ctx.export("id", sv.applyValue(getMetroResult -> getMetroResult.id()));
    }
}
variables:
  sv:
    fn::invoke:
      Function: equinix:metal:getMetro
      Arguments:
        code: sv
outputs:
  id: ${sv.id}
Using getMetro
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getMetro(args: GetMetroArgs, opts?: InvokeOptions): Promise<GetMetroResult>
function getMetroOutput(args: GetMetroOutputArgs, opts?: InvokeOptions): Output<GetMetroResult>def get_metro(capacities: Optional[Sequence[GetMetroCapacity]] = None,
              code: Optional[str] = None,
              opts: Optional[InvokeOptions] = None) -> GetMetroResult
def get_metro_output(capacities: Optional[pulumi.Input[Sequence[pulumi.Input[GetMetroCapacityArgs]]]] = None,
              code: Optional[pulumi.Input[str]] = None,
              opts: Optional[InvokeOptions] = None) -> Output[GetMetroResult]func GetMetro(ctx *Context, args *GetMetroArgs, opts ...InvokeOption) (*GetMetroResult, error)
func GetMetroOutput(ctx *Context, args *GetMetroOutputArgs, opts ...InvokeOption) GetMetroResultOutput> Note: This function is named GetMetro in the Go SDK.
public static class GetMetro 
{
    public static Task<GetMetroResult> InvokeAsync(GetMetroArgs args, InvokeOptions? opts = null)
    public static Output<GetMetroResult> Invoke(GetMetroInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetMetroResult> getMetro(GetMetroArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: equinix:metal/getMetro:getMetro
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Code string
 - The metro code to search for.
 - Capacities
List<Get
Metro Capacity>  - One or more device plans for which the metro must have capacity.
 
- Code string
 - The metro code to search for.
 - Capacities
[]Get
Metro Capacity  - One or more device plans for which the metro must have capacity.
 
- code String
 - The metro code to search for.
 - capacities
List<Get
Metro Capacity>  - One or more device plans for which the metro must have capacity.
 
- code string
 - The metro code to search for.
 - capacities
Get
Metro Capacity[]  - One or more device plans for which the metro must have capacity.
 
- code str
 - The metro code to search for.
 - capacities
Sequence[Get
Metro Capacity]  - One or more device plans for which the metro must have capacity.
 
- code String
 - The metro code to search for.
 - capacities List<Property Map>
 - One or more device plans for which the metro must have capacity.
 
getMetro Result
The following output properties are available:
- Code string
 - Country string
 - The country of the metro.
 - Id string
 - The ID of the metro.
 - Name string
 - The name of the metro.
 - Capacities
List<Get
Metro Capacity>  
- Code string
 - Country string
 - The country of the metro.
 - Id string
 - The ID of the metro.
 - Name string
 - The name of the metro.
 - Capacities
[]Get
Metro Capacity  
- code String
 - country String
 - The country of the metro.
 - id String
 - The ID of the metro.
 - name String
 - The name of the metro.
 - capacities
List<Get
Metro Capacity>  
- code string
 - country string
 - The country of the metro.
 - id string
 - The ID of the metro.
 - name string
 - The name of the metro.
 - capacities
Get
Metro Capacity[]  
- code str
 - country str
 - The country of the metro.
 - id str
 - The ID of the metro.
 - name str
 - The name of the metro.
 - capacities
Sequence[Get
Metro Capacity]  
- code String
 - country String
 - The country of the metro.
 - id String
 - The ID of the metro.
 - name String
 - The name of the metro.
 - capacities List<Property Map>
 
Supporting Types
GetMetroCapacity  
Package Details
- Repository
 - equinix equinix/pulumi-equinix
 - License
 - Apache-2.0
 - Notes
 - This Pulumi package is based on the 
equinixTerraform Provider.