Equinix v0.19.0 published on Thursday, Oct 24, 2024 by Equinix
equinix.metal.getOperatingSystem
Explore with Pulumi AI
Use this data source to get Equinix Metal Operating System image.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as equinix from "@equinix-labs/pulumi-equinix";
import * as equinix from "@pulumi/equinix";
const example = equinix.metal.getOperatingSystem({
distro: "ubuntu",
version: "20.04",
provisionableOn: "c3.medium.x86",
});
const server = new equinix.metal.Device("server", {
hostname: "tf.ubuntu",
plan: equinix.metal.Plan.C3MediumX86,
metro: "ny",
operatingSystem: example.then(example => example.id).apply((x) => equinix.metal.OperatingSystem[x]),
billingCycle: equinix.metal.BillingCycle.Hourly,
projectId: local.project_id,
});
import pulumi
import pulumi_equinix as equinix
example = equinix.metal.get_operating_system(distro="ubuntu",
version="20.04",
provisionable_on="c3.medium.x86")
server = equinix.metal.Device("server",
hostname="tf.ubuntu",
plan=equinix.metal.Plan.C3_MEDIUM_X86,
metro="ny",
operating_system=example.id.apply(lambda x: equinix.metal.OperatingSystem(x)),
billing_cycle=equinix.metal.BillingCycle.HOURLY,
project_id=local["project_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 {
example, err := metal.GetOperatingSystem(ctx, &metal.GetOperatingSystemArgs{
Distro: pulumi.StringRef("ubuntu"),
Version: pulumi.StringRef("20.04"),
ProvisionableOn: pulumi.StringRef("c3.medium.x86"),
}, nil)
if err != nil {
return err
}
_, err = metal.NewDevice(ctx, "server", &metal.DeviceArgs{
Hostname: pulumi.String("tf.ubuntu"),
Plan: pulumi.String(metal.PlanC3MediumX86),
Metro: pulumi.String("ny"),
OperatingSystem: example.Id.ApplyT(func(x *string) metal.OperatingSystem { return metal.OperatingSystem(*x) }).(metal.OperatingSystemOutput),
BillingCycle: pulumi.String(metal.BillingCycleHourly),
ProjectId: pulumi.Any(local.Project_id),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Equinix = Pulumi.Equinix;
return await Deployment.RunAsync(() =>
{
var example = Equinix.Metal.GetOperatingSystem.Invoke(new()
{
Distro = "ubuntu",
Version = "20.04",
ProvisionableOn = "c3.medium.x86",
});
var server = new Equinix.Metal.Device("server", new()
{
Hostname = "tf.ubuntu",
Plan = Equinix.Metal.Plan.C3MediumX86,
Metro = "ny",
OperatingSystem = example.Apply(getOperatingSystemResult => getOperatingSystemResult.Id).Apply(System.Enum.Parse<Equinix.Metal.OperatingSystem>),
BillingCycle = Equinix.Metal.BillingCycle.Hourly,
ProjectId = local.Project_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.GetOperatingSystemArgs;
import com.pulumi.equinix.metal.Device;
import com.pulumi.equinix.metal.DeviceArgs;
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 example = MetalFunctions.getOperatingSystem(GetOperatingSystemArgs.builder()
.distro("ubuntu")
.version("20.04")
.provisionableOn("c3.medium.x86")
.build());
var server = new Device("server", DeviceArgs.builder()
.hostname("tf.ubuntu")
.plan("c3.medium.x86")
.metro("ny")
.operatingSystem(example.applyValue(getOperatingSystemResult -> getOperatingSystemResult.id()))
.billingCycle("hourly")
.projectId(local.project_id())
.build());
}
}
resources:
server:
type: equinix:metal:Device
properties:
hostname: tf.ubuntu
plan: c3.medium.x86
metro: ny
operatingSystem: ${example.id}
billingCycle: hourly
projectId: ${local.project_id}
variables:
example:
fn::invoke:
Function: equinix:metal:getOperatingSystem
Arguments:
distro: ubuntu
version: '20.04'
provisionableOn: c3.medium.x86
Using getOperatingSystem
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 getOperatingSystem(args: GetOperatingSystemArgs, opts?: InvokeOptions): Promise<GetOperatingSystemResult>
function getOperatingSystemOutput(args: GetOperatingSystemOutputArgs, opts?: InvokeOptions): Output<GetOperatingSystemResult>
def get_operating_system(distro: Optional[str] = None,
name: Optional[str] = None,
provisionable_on: Optional[str] = None,
version: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetOperatingSystemResult
def get_operating_system_output(distro: Optional[pulumi.Input[str]] = None,
name: Optional[pulumi.Input[str]] = None,
provisionable_on: Optional[pulumi.Input[str]] = None,
version: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetOperatingSystemResult]
func GetOperatingSystem(ctx *Context, args *GetOperatingSystemArgs, opts ...InvokeOption) (*GetOperatingSystemResult, error)
func GetOperatingSystemOutput(ctx *Context, args *GetOperatingSystemOutputArgs, opts ...InvokeOption) GetOperatingSystemResultOutput
> Note: This function is named GetOperatingSystem
in the Go SDK.
public static class GetOperatingSystem
{
public static Task<GetOperatingSystemResult> InvokeAsync(GetOperatingSystemArgs args, InvokeOptions? opts = null)
public static Output<GetOperatingSystemResult> Invoke(GetOperatingSystemInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetOperatingSystemResult> getOperatingSystem(GetOperatingSystemArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: equinix:metal/getOperatingSystem:getOperatingSystem
arguments:
# arguments dictionary
The following arguments are supported:
- Distro string
- Name of the OS distribution.
- Name string
- Name or part of the name of the distribution. Case insensitive.
- Provisionable
On string - Plan name.
- Version string
- Version of the distribution.
- Distro string
- Name of the OS distribution.
- Name string
- Name or part of the name of the distribution. Case insensitive.
- Provisionable
On string - Plan name.
- Version string
- Version of the distribution.
- distro String
- Name of the OS distribution.
- name String
- Name or part of the name of the distribution. Case insensitive.
- provisionable
On String - Plan name.
- version String
- Version of the distribution.
- distro string
- Name of the OS distribution.
- name string
- Name or part of the name of the distribution. Case insensitive.
- provisionable
On string - Plan name.
- version string
- Version of the distribution.
- distro str
- Name of the OS distribution.
- name str
- Name or part of the name of the distribution. Case insensitive.
- provisionable_
on str - Plan name.
- version str
- Version of the distribution.
- distro String
- Name of the OS distribution.
- name String
- Name or part of the name of the distribution. Case insensitive.
- provisionable
On String - Plan name.
- version String
- Version of the distribution.
getOperatingSystem Result
The following output properties are available:
Package Details
- Repository
- equinix equinix/pulumi-equinix
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
equinix
Terraform Provider.