com.equinix.pulumi.metal.PortVlanAttachment Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of equinix Show documentation
Show all versions of equinix Show documentation
A Pulumi package for creating and managing equinix cloud resources.
// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***
package com.equinix.pulumi.metal;
import com.equinix.pulumi.Utilities;
import com.equinix.pulumi.metal.PortVlanAttachmentArgs;
import com.equinix.pulumi.metal.inputs.PortVlanAttachmentState;
import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import java.lang.Boolean;
import java.lang.Integer;
import java.lang.String;
import java.util.Optional;
import javax.annotation.Nullable;
/**
* Provides a resource to attach device ports to VLANs.
*
* Device and VLAN must be in the same metro.
*
* If you need this resource to add the port back to bond on removal, set `force_bond = true`.
*
* To learn more about Layer 2 networking in Equinix Metal, refer to
*
* * https://metal.equinix.com/developers/docs/networking/layer2/
* * https://metal.equinix.com/developers/docs/networking/layer2-configs/
*
* ## Attribute Referece
*
* In addition to all arguments above, the following attributes are exported:
*
* * `id` - UUID of device port used in the assignment.
* * `vlan_id` - UUID of VLAN API resource.
* * `port_id` - UUID of device port.
*
* ## Example Usage
* ### example 1
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.equinix.metal.Vlan;
* import com.pulumi.equinix.metal.VlanArgs;
* import com.pulumi.equinix.metal.Device;
* import com.pulumi.equinix.metal.DeviceArgs;
* import com.pulumi.equinix.metal.DeviceNetworkType;
* import com.pulumi.equinix.metal.DeviceNetworkTypeArgs;
* import com.pulumi.equinix.metal.PortVlanAttachment;
* import com.pulumi.equinix.metal.PortVlanAttachmentArgs;
* 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) {
* var test = new Vlan("test", VlanArgs.builder()
* .description("VLAN in New York")
* .metro("ny")
* .projectId(projectId)
* .build());
*
* var testDevice = new Device("testDevice", DeviceArgs.builder()
* .hostname("test")
* .plan("c3.small.x86")
* .metro("ny")
* .operatingSystem("ubuntu_20_04")
* .billingCycle("hourly")
* .projectId(projectId)
* .build());
*
* var testDeviceNetworkType = new DeviceNetworkType("testDeviceNetworkType", DeviceNetworkTypeArgs.builder()
* .deviceId(testDevice.id())
* .type("hybrid")
* .build());
*
* var testPortVlanAttachment = new PortVlanAttachment("testPortVlanAttachment", PortVlanAttachmentArgs.builder()
* .deviceId(testDeviceNetworkType.id())
* .portName("eth1")
* .vlanVnid(test.vxlan())
* .build());
*
* }
* }
* }
*
* ### example 2
*
* {@code
* package generated_program;
*
* import com.pulumi.Context;
* import com.pulumi.Pulumi;
* import com.pulumi.core.Output;
* import com.pulumi.equinix.metal.Device;
* import com.pulumi.equinix.metal.DeviceArgs;
* import com.pulumi.equinix.metal.DeviceNetworkType;
* import com.pulumi.equinix.metal.DeviceNetworkTypeArgs;
* import com.pulumi.equinix.metal.Vlan;
* import com.pulumi.equinix.metal.VlanArgs;
* import com.pulumi.equinix.metal.PortVlanAttachment;
* import com.pulumi.equinix.metal.PortVlanAttachmentArgs;
* import com.pulumi.resources.CustomResourceOptions;
* 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) {
* var test = new Device("test", DeviceArgs.builder()
* .hostname("test")
* .plan("c3.small.x86")
* .metro("ny")
* .operatingSystem("ubuntu_20_04")
* .billingCycle("hourly")
* .projectId(projectId)
* .build());
*
* var testDeviceNetworkType = new DeviceNetworkType("testDeviceNetworkType", DeviceNetworkTypeArgs.builder()
* .deviceId(test.id())
* .type("layer2-individual")
* .build());
*
* var test1 = new Vlan("test1", VlanArgs.builder()
* .description("VLAN in New York")
* .metro("ny")
* .projectId(projectId)
* .build());
*
* var test2 = new Vlan("test2", VlanArgs.builder()
* .description("VLAN in New Jersey")
* .metro("ny")
* .projectId(projectId)
* .build());
*
* var test1PortVlanAttachment = new PortVlanAttachment("test1PortVlanAttachment", PortVlanAttachmentArgs.builder()
* .deviceId(testDeviceNetworkType.id())
* .vlanVnid(test1.vxlan())
* .portName("eth1")
* .build());
*
* var test2PortVlanAttachment = new PortVlanAttachment("test2PortVlanAttachment", PortVlanAttachmentArgs.builder()
* .deviceId(testDeviceNetworkType.id())
* .vlanVnid(test2.vxlan())
* .portName("eth1")
* .native_(true)
* .build(), CustomResourceOptions.builder()
* .dependsOn(test1PortVlanAttachment)
* .build());
*
* }
* }
* }
*
*
*/
@ResourceType(type="equinix:metal/portVlanAttachment:PortVlanAttachment")
public class PortVlanAttachment extends com.pulumi.resources.CustomResource {
/**
* ID of device to be assigned to the VLAN.
*
*/
@Export(name="deviceId", refs={String.class}, tree="[0]")
private Output deviceId;
/**
* @return ID of device to be assigned to the VLAN.
*
*/
public Output deviceId() {
return this.deviceId;
}
/**
* Add port back to the bond when this resource is removed. Default is `false`.
*
*/
@Export(name="forceBond", refs={Boolean.class}, tree="[0]")
private Output* @Nullable */ Boolean> forceBond;
/**
* @return Add port back to the bond when this resource is removed. Default is `false`.
*
*/
public Output> forceBond() {
return Codegen.optional(this.forceBond);
}
/**
* Mark this VLAN a native VLAN on the port. This can be used only if this assignment assigns second or further VLAN to the port. To ensure that this attachment is not first on a port, you can use `depends_on` pointing to another `equinix.metal.PortVlanAttachment`, just like in the layer2-individual example above.
*
*/
@Export(name="native", refs={Boolean.class}, tree="[0]")
private Output* @Nullable */ Boolean> native_;
/**
* @return Mark this VLAN a native VLAN on the port. This can be used only if this assignment assigns second or further VLAN to the port. To ensure that this attachment is not first on a port, you can use `depends_on` pointing to another `equinix.metal.PortVlanAttachment`, just like in the layer2-individual example above.
*
*/
public Output> native_() {
return Codegen.optional(this.native_);
}
/**
* UUID of device port
*
*/
@Export(name="portId", refs={String.class}, tree="[0]")
private Output portId;
/**
* @return UUID of device port
*
*/
public Output portId() {
return this.portId;
}
/**
* Name of network port to be assigned to the VLAN.
*
*/
@Export(name="portName", refs={String.class}, tree="[0]")
private Output portName;
/**
* @return Name of network port to be assigned to the VLAN.
*
*/
public Output portName() {
return this.portName;
}
/**
* UUID of VLAN API resource
*
*/
@Export(name="vlanId", refs={String.class}, tree="[0]")
private Output vlanId;
/**
* @return UUID of VLAN API resource
*
*/
public Output vlanId() {
return this.vlanId;
}
/**
* VXLAN Network Identifier.
*
*/
@Export(name="vlanVnid", refs={Integer.class}, tree="[0]")
private Output vlanVnid;
/**
* @return VXLAN Network Identifier.
*
*/
public Output vlanVnid() {
return this.vlanVnid;
}
/**
*
* @param name The _unique_ name of the resulting resource.
*/
public PortVlanAttachment(java.lang.String name) {
this(name, PortVlanAttachmentArgs.Empty);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
*/
public PortVlanAttachment(java.lang.String name, PortVlanAttachmentArgs args) {
this(name, args, null);
}
/**
*
* @param name The _unique_ name of the resulting resource.
* @param args The arguments to use to populate this resource's properties.
* @param options A bag of options that control this resource's behavior.
*/
public PortVlanAttachment(java.lang.String name, PortVlanAttachmentArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("equinix:metal/portVlanAttachment:PortVlanAttachment", name, makeArgs(args, options), makeResourceOptions(options, Codegen.empty()), false);
}
private PortVlanAttachment(java.lang.String name, Output id, @Nullable PortVlanAttachmentState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
super("equinix:metal/portVlanAttachment:PortVlanAttachment", name, state, makeResourceOptions(options, id), false);
}
private static PortVlanAttachmentArgs makeArgs(PortVlanAttachmentArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
if (options != null && options.getUrn().isPresent()) {
return null;
}
return args == null ? PortVlanAttachmentArgs.Empty : args;
}
private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output id) {
var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder()
.version(Utilities.getVersion())
.build();
return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id);
}
/**
* Get an existing Host resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state
* @param options Optional settings to control the behavior of the CustomResource.
*/
public static PortVlanAttachment get(java.lang.String name, Output id, @Nullable PortVlanAttachmentState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
return new PortVlanAttachment(name, id, state, options);
}
}