1. Packages
  2. Linode Provider
  3. API Docs
  4. FirewallDevice
Linode v4.30.0 published on Friday, Nov 8, 2024 by Pulumi

linode.FirewallDevice

Explore with Pulumi AI

linode logo
Linode v4.30.0 published on Friday, Nov 8, 2024 by Pulumi

    Manages a Linode Firewall Device. For more information, see the Linode APIv4 docs.

    NOTICE: Attaching a Linode Firewall Device to a linode.Firewall resource with user-defined linodes may cause device conflicts.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as linode from "@pulumi/linode";
    
    const myFirewall = new linode.Firewall("my_firewall", {
        label: "my_firewall",
        inbounds: [{
            label: "http",
            action: "ACCEPT",
            protocol: "TCP",
            ports: "80",
            ipv4s: ["0.0.0.0/0"],
            ipv6s: ["::/0"],
        }],
        inboundPolicy: "DROP",
        outboundPolicy: "ACCEPT",
    });
    const myInstance = new linode.Instance("my_instance", {
        label: "my_instance",
        region: "us-southeast",
        type: "g6-standard-1",
    });
    const myDevice = new linode.FirewallDevice("my_device", {
        firewallId: myFirewall.id,
        entityId: myInstance.id,
    });
    
    import pulumi
    import pulumi_linode as linode
    
    my_firewall = linode.Firewall("my_firewall",
        label="my_firewall",
        inbounds=[{
            "label": "http",
            "action": "ACCEPT",
            "protocol": "TCP",
            "ports": "80",
            "ipv4s": ["0.0.0.0/0"],
            "ipv6s": ["::/0"],
        }],
        inbound_policy="DROP",
        outbound_policy="ACCEPT")
    my_instance = linode.Instance("my_instance",
        label="my_instance",
        region="us-southeast",
        type="g6-standard-1")
    my_device = linode.FirewallDevice("my_device",
        firewall_id=my_firewall.id,
        entity_id=my_instance.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-linode/sdk/v4/go/linode"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		myFirewall, err := linode.NewFirewall(ctx, "my_firewall", &linode.FirewallArgs{
    			Label: pulumi.String("my_firewall"),
    			Inbounds: linode.FirewallInboundArray{
    				&linode.FirewallInboundArgs{
    					Label:    pulumi.String("http"),
    					Action:   pulumi.String("ACCEPT"),
    					Protocol: pulumi.String("TCP"),
    					Ports:    pulumi.String("80"),
    					Ipv4s: pulumi.StringArray{
    						pulumi.String("0.0.0.0/0"),
    					},
    					Ipv6s: pulumi.StringArray{
    						pulumi.String("::/0"),
    					},
    				},
    			},
    			InboundPolicy:  pulumi.String("DROP"),
    			OutboundPolicy: pulumi.String("ACCEPT"),
    		})
    		if err != nil {
    			return err
    		}
    		myInstance, err := linode.NewInstance(ctx, "my_instance", &linode.InstanceArgs{
    			Label:  pulumi.String("my_instance"),
    			Region: pulumi.String("us-southeast"),
    			Type:   pulumi.String("g6-standard-1"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = linode.NewFirewallDevice(ctx, "my_device", &linode.FirewallDeviceArgs{
    			FirewallId: myFirewall.ID(),
    			EntityId:   myInstance.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Linode = Pulumi.Linode;
    
    return await Deployment.RunAsync(() => 
    {
        var myFirewall = new Linode.Firewall("my_firewall", new()
        {
            Label = "my_firewall",
            Inbounds = new[]
            {
                new Linode.Inputs.FirewallInboundArgs
                {
                    Label = "http",
                    Action = "ACCEPT",
                    Protocol = "TCP",
                    Ports = "80",
                    Ipv4s = new[]
                    {
                        "0.0.0.0/0",
                    },
                    Ipv6s = new[]
                    {
                        "::/0",
                    },
                },
            },
            InboundPolicy = "DROP",
            OutboundPolicy = "ACCEPT",
        });
    
        var myInstance = new Linode.Instance("my_instance", new()
        {
            Label = "my_instance",
            Region = "us-southeast",
            Type = "g6-standard-1",
        });
    
        var myDevice = new Linode.FirewallDevice("my_device", new()
        {
            FirewallId = myFirewall.Id,
            EntityId = myInstance.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.linode.Firewall;
    import com.pulumi.linode.FirewallArgs;
    import com.pulumi.linode.inputs.FirewallInboundArgs;
    import com.pulumi.linode.Instance;
    import com.pulumi.linode.InstanceArgs;
    import com.pulumi.linode.FirewallDevice;
    import com.pulumi.linode.FirewallDeviceArgs;
    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 myFirewall = new Firewall("myFirewall", FirewallArgs.builder()
                .label("my_firewall")
                .inbounds(FirewallInboundArgs.builder()
                    .label("http")
                    .action("ACCEPT")
                    .protocol("TCP")
                    .ports("80")
                    .ipv4s("0.0.0.0/0")
                    .ipv6s("::/0")
                    .build())
                .inboundPolicy("DROP")
                .outboundPolicy("ACCEPT")
                .build());
    
            var myInstance = new Instance("myInstance", InstanceArgs.builder()
                .label("my_instance")
                .region("us-southeast")
                .type("g6-standard-1")
                .build());
    
            var myDevice = new FirewallDevice("myDevice", FirewallDeviceArgs.builder()
                .firewallId(myFirewall.id())
                .entityId(myInstance.id())
                .build());
    
        }
    }
    
    resources:
      myDevice:
        type: linode:FirewallDevice
        name: my_device
        properties:
          firewallId: ${myFirewall.id}
          entityId: ${myInstance.id}
      myFirewall:
        type: linode:Firewall
        name: my_firewall
        properties:
          label: my_firewall
          inbounds:
            - label: http
              action: ACCEPT
              protocol: TCP
              ports: '80'
              ipv4s:
                - 0.0.0.0/0
              ipv6s:
                - ::/0
          inboundPolicy: DROP
          outboundPolicy: ACCEPT
      myInstance:
        type: linode:Instance
        name: my_instance
        properties:
          label: my_instance
          region: us-southeast
          type: g6-standard-1
    

    Create FirewallDevice Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new FirewallDevice(name: string, args: FirewallDeviceArgs, opts?: CustomResourceOptions);
    @overload
    def FirewallDevice(resource_name: str,
                       args: FirewallDeviceInitArgs,
                       opts: Optional[ResourceOptions] = None)
    
    @overload
    def FirewallDevice(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       entity_id: Optional[int] = None,
                       firewall_id: Optional[int] = None,
                       entity_type: Optional[str] = None)
    func NewFirewallDevice(ctx *Context, name string, args FirewallDeviceArgs, opts ...ResourceOption) (*FirewallDevice, error)
    public FirewallDevice(string name, FirewallDeviceArgs args, CustomResourceOptions? opts = null)
    public FirewallDevice(String name, FirewallDeviceArgs args)
    public FirewallDevice(String name, FirewallDeviceArgs args, CustomResourceOptions options)
    
    type: linode:FirewallDevice
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    

    Parameters

    name string
    The unique name of the resource.
    args FirewallDeviceArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args FirewallDeviceInitArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args FirewallDeviceArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args FirewallDeviceArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args FirewallDeviceArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var firewallDeviceResource = new Linode.FirewallDevice("firewallDeviceResource", new()
    {
        EntityId = 0,
        FirewallId = 0,
        EntityType = "string",
    });
    
    example, err := linode.NewFirewallDevice(ctx, "firewallDeviceResource", &linode.FirewallDeviceArgs{
    	EntityId:   pulumi.Int(0),
    	FirewallId: pulumi.Int(0),
    	EntityType: pulumi.String("string"),
    })
    
    var firewallDeviceResource = new FirewallDevice("firewallDeviceResource", FirewallDeviceArgs.builder()
        .entityId(0)
        .firewallId(0)
        .entityType("string")
        .build());
    
    firewall_device_resource = linode.FirewallDevice("firewallDeviceResource",
        entity_id=0,
        firewall_id=0,
        entity_type="string")
    
    const firewallDeviceResource = new linode.FirewallDevice("firewallDeviceResource", {
        entityId: 0,
        firewallId: 0,
        entityType: "string",
    });
    
    type: linode:FirewallDevice
    properties:
        entityId: 0
        entityType: string
        firewallId: 0
    

    FirewallDevice Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The FirewallDevice resource accepts the following input properties:

    EntityId int
    The unique ID of the entity to attach.
    FirewallId int
    The unique ID of the target Firewall.
    EntityType string
    The type of the entity to attach. (default: linode)
    EntityId int
    The unique ID of the entity to attach.
    FirewallId int
    The unique ID of the target Firewall.
    EntityType string
    The type of the entity to attach. (default: linode)
    entityId Integer
    The unique ID of the entity to attach.
    firewallId Integer
    The unique ID of the target Firewall.
    entityType String
    The type of the entity to attach. (default: linode)
    entityId number
    The unique ID of the entity to attach.
    firewallId number
    The unique ID of the target Firewall.
    entityType string
    The type of the entity to attach. (default: linode)
    entity_id int
    The unique ID of the entity to attach.
    firewall_id int
    The unique ID of the target Firewall.
    entity_type str
    The type of the entity to attach. (default: linode)
    entityId Number
    The unique ID of the entity to attach.
    firewallId Number
    The unique ID of the target Firewall.
    entityType String
    The type of the entity to attach. (default: linode)

    Outputs

    All input properties are implicitly available as output properties. Additionally, the FirewallDevice resource produces the following output properties:

    Created string
    When the Firewall Device was last created.
    Id string
    The provider-assigned unique ID for this managed resource.
    Updated string
    When the Firewall Device was last updated.
    Created string
    When the Firewall Device was last created.
    Id string
    The provider-assigned unique ID for this managed resource.
    Updated string
    When the Firewall Device was last updated.
    created String
    When the Firewall Device was last created.
    id String
    The provider-assigned unique ID for this managed resource.
    updated String
    When the Firewall Device was last updated.
    created string
    When the Firewall Device was last created.
    id string
    The provider-assigned unique ID for this managed resource.
    updated string
    When the Firewall Device was last updated.
    created str
    When the Firewall Device was last created.
    id str
    The provider-assigned unique ID for this managed resource.
    updated str
    When the Firewall Device was last updated.
    created String
    When the Firewall Device was last created.
    id String
    The provider-assigned unique ID for this managed resource.
    updated String
    When the Firewall Device was last updated.

    Look up Existing FirewallDevice Resource

    Get an existing FirewallDevice resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: FirewallDeviceState, opts?: CustomResourceOptions): FirewallDevice
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            created: Optional[str] = None,
            entity_id: Optional[int] = None,
            entity_type: Optional[str] = None,
            firewall_id: Optional[int] = None,
            updated: Optional[str] = None) -> FirewallDevice
    func GetFirewallDevice(ctx *Context, name string, id IDInput, state *FirewallDeviceState, opts ...ResourceOption) (*FirewallDevice, error)
    public static FirewallDevice Get(string name, Input<string> id, FirewallDeviceState? state, CustomResourceOptions? opts = null)
    public static FirewallDevice get(String name, Output<String> id, FirewallDeviceState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    Created string
    When the Firewall Device was last created.
    EntityId int
    The unique ID of the entity to attach.
    EntityType string
    The type of the entity to attach. (default: linode)
    FirewallId int
    The unique ID of the target Firewall.
    Updated string
    When the Firewall Device was last updated.
    Created string
    When the Firewall Device was last created.
    EntityId int
    The unique ID of the entity to attach.
    EntityType string
    The type of the entity to attach. (default: linode)
    FirewallId int
    The unique ID of the target Firewall.
    Updated string
    When the Firewall Device was last updated.
    created String
    When the Firewall Device was last created.
    entityId Integer
    The unique ID of the entity to attach.
    entityType String
    The type of the entity to attach. (default: linode)
    firewallId Integer
    The unique ID of the target Firewall.
    updated String
    When the Firewall Device was last updated.
    created string
    When the Firewall Device was last created.
    entityId number
    The unique ID of the entity to attach.
    entityType string
    The type of the entity to attach. (default: linode)
    firewallId number
    The unique ID of the target Firewall.
    updated string
    When the Firewall Device was last updated.
    created str
    When the Firewall Device was last created.
    entity_id int
    The unique ID of the entity to attach.
    entity_type str
    The type of the entity to attach. (default: linode)
    firewall_id int
    The unique ID of the target Firewall.
    updated str
    When the Firewall Device was last updated.
    created String
    When the Firewall Device was last created.
    entityId Number
    The unique ID of the entity to attach.
    entityType String
    The type of the entity to attach. (default: linode)
    firewallId Number
    The unique ID of the target Firewall.
    updated String
    When the Firewall Device was last updated.

    Import

    Firewall Device can be imported using the firewall_id followed by the Firewall Device id separated by a comma, e.g.

    $ pulumi import linode:index/firewallDevice:FirewallDevice my_device_duplicated 1234567,7654321
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Linode pulumi/pulumi-linode
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the linode Terraform Provider.
    linode logo
    Linode v4.30.0 published on Friday, Nov 8, 2024 by Pulumi