instance

package
v3.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 16, 2026 License: MPL-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LinodeInstanceCreateTimeout = 15 * time.Minute
	LinodeInstanceUpdateTimeout = time.Hour
	LinodeInstanceDeleteTimeout = 10 * time.Minute
)

Variables

View Source
var InterfaceSchema = &schema.Resource{
	Schema: map[string]*schema.Schema{
		"purpose": {
			Type:        schema.TypeString,
			Description: "The type of interface.",
			Required:    true,
		},
		"ipam_address": {
			Type: schema.TypeString,
			Description: "This Network Interface's private IP address in " +
				"Classless Inter-Domain Routing (CIDR) notation." +
				onlyAllowedForVLANMsg,
			Optional: true,
		},
		"label": {
			Type: schema.TypeString,
			Description: "The name of the VALN. " + requiredForVLANMsg +
				" " + onlyAllowedForVLANMsg,
			Optional: true,
		},
		"id": {
			Type:        schema.TypeInt,
			Description: "The ID of the interface.",
			Computed:    true,
		},
		"subnet_id": {
			Type: schema.TypeInt,
			Description: "The ID of the subnet which the VPC interface is connected to." +
				requiredForVPCMsg + onlyAllowedForVPCMsg,
			Optional: true,
		},
		"vpc_id": {
			Type: schema.TypeInt,
			Description: "The ID of VPC of the subnet which the VPC " +
				"interface is connected to.",
			Computed: true,
		},
		"primary": {
			Type: schema.TypeBool,
			Description: "Whether the interface is the primary interface that should " +
				"have the default route for this Linode.",
			Optional: true,
			Default:  false,
		},
		"active": {
			Type:        schema.TypeBool,
			Description: "Whether this interface is currently booted and active.",
			Computed:    true,
		},
		"ip_ranges": {
			Type:        schema.TypeList,
			Description: "List of VPC IPs or IP ranges inside the VPC subnet.",
			Optional:    true,
			Elem: &schema.Schema{
				Type: schema.TypeString,
				ValidateDiagFunc: validation.AnyDiag(
					helper.SDKv2ValidateIPv4Range,
					helper.SDKv2ValidateIPv6Range,
				),
			},
		},
		"ipv4": {
			Type: schema.TypeList,
			Description: "The IPv4 configuration of the VPC interface." +
				onlyAllowedForVPCMsg,
			Computed: true,
			Optional: true,
			MaxItems: 1,
			Elem: &schema.Resource{
				Schema: map[string]*schema.Schema{
					"vpc": {
						Type:        schema.TypeString,
						Description: "The IP from the VPC subnet to use for this interface.",
						Computed:    true,
						Optional:    true,
					},
					"nat_1_1": {
						Type: schema.TypeString,
						Description: "The public IP that will be used for the " +
							"one-to-one NAT purpose.",
						Computed: true,
						Optional: true,
						DiffSuppressFunc: func(k, old, new string, d *schema.ResourceData) bool {
							if new == "any" && old != "" {
								return true
							}
							return old == new
						},
					},
				},
			},
		},
		"ipv6": {
			Type: schema.TypeList,
			Description: "The IPv6 configuration of the VPC interface. " +
				onlyAllowedForVPCMsg,
			Computed: true,
			Optional: true,
			MaxItems: 1,
			Elem: &schema.Resource{
				Schema: map[string]*schema.Schema{
					"slaac": {
						Type:        schema.TypeList,
						Description: "An array of SLAAC prefixes to use for this interface.",
						Computed:    true,
						Optional:    true,
						Elem: &schema.Resource{
							Schema: map[string]*schema.Schema{
								"range": {
									Type: schema.TypeString,
									Description: "A SLAAC prefix to add to this interface, " +
										"or `auto` for a new IPv6 prefix to be automatically allocated.",
									Optional:         true,
									DiffSuppressFunc: diffsuppressfuncs.AutoAllocRange,
								},
								"assigned_range": {
									Type: schema.TypeString,
									Description: "The value of `range` computed by the API. " +
										"This is necessary when needing to access the range " +
										"implicitly allocated using `auto`.",
									Computed: true,
								},
								"address": {
									Type:        schema.TypeString,
									Description: "The SLAAC address chosen for this interface.",
									Computed:    true,
								},
							},
						},
					},
					"range": {
						Type:        schema.TypeList,
						Description: "An array of SLAAC prefixes to use for this interface.",
						Computed:    true,
						Optional:    true,
						Elem: &schema.Resource{
							Schema: map[string]*schema.Schema{
								"range": {
									Type: schema.TypeString,
									Description: "A prefix to add to this interface, " +
										"or `auto` for a new IPv6 prefix to be automatically allocated.",
									Optional:         true,
									DiffSuppressFunc: diffsuppressfuncs.AutoAllocRange,
								},
								"assigned_range": {
									Type: schema.TypeString,
									Description: "The value of `range` computed by the API. " +
										"This is necessary when needing to access the range " +
										"implicitly allocated using `auto`.",
									Computed: true,
								},
							},
						},
					},
					"is_public": {
						Type: schema.TypeBool,
						Description: "If true, connections from the interface to IPv6 addresses outside the VPC, " +
							"and connections from IPv6 addresses outside the VPC to the interface will be permitted.",
						Optional: true,
						Computed: true,
						Default:  nil,
					},
				},
			},
		},
	},
}

Functions

func BootInstanceAfterVPCInterfaceUpdate

func BootInstanceAfterVPCInterfaceUpdate(ctx context.Context, meta *helper.ProviderMeta, instanceID, targetConfigID, deadlineSeconds int) diag.Diagnostics

func DataSource

func DataSource() *schema.Resource

func Resource

func Resource() *schema.Resource

func SafeShutdownInstance

func SafeShutdownInstance(ctx context.Context, client *linodego.Client, instanceID, deadlineSeconds int) error

func ShutdownInstanceForVPCInterfaceUpdate

func ShutdownInstanceForVPCInterfaceUpdate(ctx context.Context, client *linodego.Client, skipImplicitReboots bool, instanceID, deadlineSeconds int) error

func VPCInterfaceIncluded

func VPCInterfaceIncluded(
	interfaces1 []linodego.InstanceConfigInterface,
	interfaces2 []linodego.InstanceConfigInterfaceCreateOptions,
) bool

VPCInterfaceIncluded returns whether a VPC interface is included in either slice

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL