vultr.FirewallRule
Explore with Pulumi AI
Provides a Vultr Firewall Rule resource. This can be used to create, read, modify, and delete Firewall rules.
Example Usage
Create a Firewall Rule
import * as pulumi from "@pulumi/pulumi";
import * as vultr from "@ediri/vultr";
const myFirewallgroup = new vultr.FirewallGroup("myFirewallgroup", {description: "base firewall"});
const myFirewallrule = new vultr.FirewallRule("myFirewallrule", {
firewallGroupId: myFirewallgroup.id,
protocol: "tcp",
ipType: "v4",
subnet: "0.0.0.0",
subnetSize: 0,
port: "8090",
notes: "my firewall rule",
});
import pulumi
import ediri_vultr as vultr
my_firewallgroup = vultr.FirewallGroup("myFirewallgroup", description="base firewall")
my_firewallrule = vultr.FirewallRule("myFirewallrule",
firewall_group_id=my_firewallgroup.id,
protocol="tcp",
ip_type="v4",
subnet="0.0.0.0",
subnet_size=0,
port="8090",
notes="my firewall rule")
package main
import (
"github.com/dirien/pulumi-vultr/sdk/v2/go/vultr"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
myFirewallgroup, err := vultr.NewFirewallGroup(ctx, "myFirewallgroup", &vultr.FirewallGroupArgs{
Description: pulumi.String("base firewall"),
})
if err != nil {
return err
}
_, err = vultr.NewFirewallRule(ctx, "myFirewallrule", &vultr.FirewallRuleArgs{
FirewallGroupId: myFirewallgroup.ID(),
Protocol: pulumi.String("tcp"),
IpType: pulumi.String("v4"),
Subnet: pulumi.String("0.0.0.0"),
SubnetSize: pulumi.Int(0),
Port: pulumi.String("8090"),
Notes: pulumi.String("my firewall rule"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Vultr = ediri.Vultr;
return await Deployment.RunAsync(() =>
{
var myFirewallgroup = new Vultr.FirewallGroup("myFirewallgroup", new()
{
Description = "base firewall",
});
var myFirewallrule = new Vultr.FirewallRule("myFirewallrule", new()
{
FirewallGroupId = myFirewallgroup.Id,
Protocol = "tcp",
IpType = "v4",
Subnet = "0.0.0.0",
SubnetSize = 0,
Port = "8090",
Notes = "my firewall rule",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.vultr.FirewallGroup;
import com.pulumi.vultr.FirewallGroupArgs;
import com.pulumi.vultr.FirewallRule;
import com.pulumi.vultr.FirewallRuleArgs;
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 myFirewallgroup = new FirewallGroup("myFirewallgroup", FirewallGroupArgs.builder()
.description("base firewall")
.build());
var myFirewallrule = new FirewallRule("myFirewallrule", FirewallRuleArgs.builder()
.firewallGroupId(myFirewallgroup.id())
.protocol("tcp")
.ipType("v4")
.subnet("0.0.0.0")
.subnetSize(0)
.port("8090")
.notes("my firewall rule")
.build());
}
}
resources:
myFirewallgroup:
type: vultr:FirewallGroup
properties:
description: base firewall
myFirewallrule:
type: vultr:FirewallRule
properties:
firewallGroupId: ${myFirewallgroup.id}
protocol: tcp
ipType: v4
subnet: 0.0.0.0
subnetSize: 0
port: '8090'
notes: my firewall rule
Create FirewallRule Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new FirewallRule(name: string, args: FirewallRuleArgs, opts?: CustomResourceOptions);
@overload
def FirewallRule(resource_name: str,
args: FirewallRuleArgs,
opts: Optional[ResourceOptions] = None)
@overload
def FirewallRule(resource_name: str,
opts: Optional[ResourceOptions] = None,
firewall_group_id: Optional[str] = None,
ip_type: Optional[str] = None,
protocol: Optional[str] = None,
subnet: Optional[str] = None,
subnet_size: Optional[int] = None,
notes: Optional[str] = None,
port: Optional[str] = None,
source: Optional[str] = None)
func NewFirewallRule(ctx *Context, name string, args FirewallRuleArgs, opts ...ResourceOption) (*FirewallRule, error)
public FirewallRule(string name, FirewallRuleArgs args, CustomResourceOptions? opts = null)
public FirewallRule(String name, FirewallRuleArgs args)
public FirewallRule(String name, FirewallRuleArgs args, CustomResourceOptions options)
type: vultr:FirewallRule
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name
This property is required. string - The unique name of the resource.
- args
This property is required. FirewallRuleArgs - The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name
This property is required. str - The unique name of the resource.
- args
This property is required. FirewallRuleArgs - The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name
This property is required. string - The unique name of the resource.
- args
This property is required. FirewallRuleArgs - The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name
This property is required. string - The unique name of the resource.
- args
This property is required. FirewallRuleArgs - The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name
This property is required. String - The unique name of the resource.
- args
This property is required. FirewallRuleArgs - 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 firewallRuleResource = new Vultr.FirewallRule("firewallRuleResource", new()
{
FirewallGroupId = "string",
IpType = "string",
Protocol = "string",
Subnet = "string",
SubnetSize = 0,
Notes = "string",
Port = "string",
Source = "string",
});
example, err := vultr.NewFirewallRule(ctx, "firewallRuleResource", &vultr.FirewallRuleArgs{
FirewallGroupId: pulumi.String("string"),
IpType: pulumi.String("string"),
Protocol: pulumi.String("string"),
Subnet: pulumi.String("string"),
SubnetSize: pulumi.Int(0),
Notes: pulumi.String("string"),
Port: pulumi.String("string"),
Source: pulumi.String("string"),
})
var firewallRuleResource = new FirewallRule("firewallRuleResource", FirewallRuleArgs.builder()
.firewallGroupId("string")
.ipType("string")
.protocol("string")
.subnet("string")
.subnetSize(0)
.notes("string")
.port("string")
.source("string")
.build());
firewall_rule_resource = vultr.FirewallRule("firewallRuleResource",
firewall_group_id="string",
ip_type="string",
protocol="string",
subnet="string",
subnet_size=0,
notes="string",
port="string",
source="string")
const firewallRuleResource = new vultr.FirewallRule("firewallRuleResource", {
firewallGroupId: "string",
ipType: "string",
protocol: "string",
subnet: "string",
subnetSize: 0,
notes: "string",
port: "string",
source: "string",
});
type: vultr:FirewallRule
properties:
firewallGroupId: string
ipType: string
notes: string
port: string
protocol: string
source: string
subnet: string
subnetSize: 0
FirewallRule 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 FirewallRule resource accepts the following input properties:
- Firewall
Group Id This property is required. Changes to this property will trigger replacement.
- The firewall group that the firewall rule will belong to.
- Ip
Type This property is required. Changes to this property will trigger replacement.
- The type of ip for this firewall rule. Possible values (v4, v6) Note they must be lowercase
- Protocol
This property is required. Changes to this property will trigger replacement.
- The type of protocol for this firewall rule. Possible values (icmp, tcp, udp, gre, esp, ah) Note they must be lowercase
- Subnet
This property is required. Changes to this property will trigger replacement.
- IP address that you want to define for this firewall rule.
- Subnet
Size This property is required. Changes to this property will trigger replacement.
- The number of bits for the subnet in CIDR notation. Example: 32.
- Notes
Changes to this property will trigger replacement.
- A simple note for a given firewall rule
- Port
Changes to this property will trigger replacement.
- TCP/UDP only. This field can be a specific port or a colon separated port range.
- Source
Changes to this property will trigger replacement.
- Possible values ("", cloudflare)
- Firewall
Group Id This property is required. Changes to this property will trigger replacement.
- The firewall group that the firewall rule will belong to.
- Ip
Type This property is required. Changes to this property will trigger replacement.
- The type of ip for this firewall rule. Possible values (v4, v6) Note they must be lowercase
- Protocol
This property is required. Changes to this property will trigger replacement.
- The type of protocol for this firewall rule. Possible values (icmp, tcp, udp, gre, esp, ah) Note they must be lowercase
- Subnet
This property is required. Changes to this property will trigger replacement.
- IP address that you want to define for this firewall rule.
- Subnet
Size This property is required. Changes to this property will trigger replacement.
- The number of bits for the subnet in CIDR notation. Example: 32.
- Notes
Changes to this property will trigger replacement.
- A simple note for a given firewall rule
- Port
Changes to this property will trigger replacement.
- TCP/UDP only. This field can be a specific port or a colon separated port range.
- Source
Changes to this property will trigger replacement.
- Possible values ("", cloudflare)
- firewall
Group Id This property is required. Changes to this property will trigger replacement.
- The firewall group that the firewall rule will belong to.
- ip
Type This property is required. Changes to this property will trigger replacement.
- The type of ip for this firewall rule. Possible values (v4, v6) Note they must be lowercase
- protocol
This property is required. Changes to this property will trigger replacement.
- The type of protocol for this firewall rule. Possible values (icmp, tcp, udp, gre, esp, ah) Note they must be lowercase
- subnet
This property is required. Changes to this property will trigger replacement.
- IP address that you want to define for this firewall rule.
- subnet
Size This property is required. Changes to this property will trigger replacement.
- The number of bits for the subnet in CIDR notation. Example: 32.
- notes
Changes to this property will trigger replacement.
- A simple note for a given firewall rule
- port
Changes to this property will trigger replacement.
- TCP/UDP only. This field can be a specific port or a colon separated port range.
- source
Changes to this property will trigger replacement.
- Possible values ("", cloudflare)
- firewall
Group Id This property is required. Changes to this property will trigger replacement.
- The firewall group that the firewall rule will belong to.
- ip
Type This property is required. Changes to this property will trigger replacement.
- The type of ip for this firewall rule. Possible values (v4, v6) Note they must be lowercase
- protocol
This property is required. Changes to this property will trigger replacement.
- The type of protocol for this firewall rule. Possible values (icmp, tcp, udp, gre, esp, ah) Note they must be lowercase
- subnet
This property is required. Changes to this property will trigger replacement.
- IP address that you want to define for this firewall rule.
- subnet
Size This property is required. Changes to this property will trigger replacement.
- The number of bits for the subnet in CIDR notation. Example: 32.
- notes
Changes to this property will trigger replacement.
- A simple note for a given firewall rule
- port
Changes to this property will trigger replacement.
- TCP/UDP only. This field can be a specific port or a colon separated port range.
- source
Changes to this property will trigger replacement.
- Possible values ("", cloudflare)
- firewall_
group_ id This property is required. Changes to this property will trigger replacement.
- The firewall group that the firewall rule will belong to.
- ip_
type This property is required. Changes to this property will trigger replacement.
- The type of ip for this firewall rule. Possible values (v4, v6) Note they must be lowercase
- protocol
This property is required. Changes to this property will trigger replacement.
- The type of protocol for this firewall rule. Possible values (icmp, tcp, udp, gre, esp, ah) Note they must be lowercase
- subnet
This property is required. Changes to this property will trigger replacement.
- IP address that you want to define for this firewall rule.
- subnet_
size This property is required. Changes to this property will trigger replacement.
- The number of bits for the subnet in CIDR notation. Example: 32.
- notes
Changes to this property will trigger replacement.
- A simple note for a given firewall rule
- port
Changes to this property will trigger replacement.
- TCP/UDP only. This field can be a specific port or a colon separated port range.
- source
Changes to this property will trigger replacement.
- Possible values ("", cloudflare)
- firewall
Group Id This property is required. Changes to this property will trigger replacement.
- The firewall group that the firewall rule will belong to.
- ip
Type This property is required. Changes to this property will trigger replacement.
- The type of ip for this firewall rule. Possible values (v4, v6) Note they must be lowercase
- protocol
This property is required. Changes to this property will trigger replacement.
- The type of protocol for this firewall rule. Possible values (icmp, tcp, udp, gre, esp, ah) Note they must be lowercase
- subnet
This property is required. Changes to this property will trigger replacement.
- IP address that you want to define for this firewall rule.
- subnet
Size This property is required. Changes to this property will trigger replacement.
- The number of bits for the subnet in CIDR notation. Example: 32.
- notes
Changes to this property will trigger replacement.
- A simple note for a given firewall rule
- port
Changes to this property will trigger replacement.
- TCP/UDP only. This field can be a specific port or a colon separated port range.
- source
Changes to this property will trigger replacement.
- Possible values ("", cloudflare)
Outputs
All input properties are implicitly available as output properties. Additionally, the FirewallRule resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing FirewallRule Resource
Get an existing FirewallRule 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?: FirewallRuleState, opts?: CustomResourceOptions): FirewallRule
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
firewall_group_id: Optional[str] = None,
ip_type: Optional[str] = None,
notes: Optional[str] = None,
port: Optional[str] = None,
protocol: Optional[str] = None,
source: Optional[str] = None,
subnet: Optional[str] = None,
subnet_size: Optional[int] = None) -> FirewallRule
func GetFirewallRule(ctx *Context, name string, id IDInput, state *FirewallRuleState, opts ...ResourceOption) (*FirewallRule, error)
public static FirewallRule Get(string name, Input<string> id, FirewallRuleState? state, CustomResourceOptions? opts = null)
public static FirewallRule get(String name, Output<String> id, FirewallRuleState state, CustomResourceOptions options)
resources: _: type: vultr:FirewallRule get: id: ${id}
- name
This property is required. - The unique name of the resulting resource.
- id
This property is required. - 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
This property is required. - The unique name of the resulting resource.
- id
This property is required. - The unique provider ID of the resource to lookup.
- name
This property is required. - The unique name of the resulting resource.
- id
This property is required. - 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
This property is required. - The unique name of the resulting resource.
- id
This property is required. - 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
This property is required. - The unique name of the resulting resource.
- id
This property is required. - 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.
- Firewall
Group Id Changes to this property will trigger replacement.
- The firewall group that the firewall rule will belong to.
- Ip
Type Changes to this property will trigger replacement.
- The type of ip for this firewall rule. Possible values (v4, v6) Note they must be lowercase
- Notes
Changes to this property will trigger replacement.
- A simple note for a given firewall rule
- Port
Changes to this property will trigger replacement.
- TCP/UDP only. This field can be a specific port or a colon separated port range.
- Protocol
Changes to this property will trigger replacement.
- The type of protocol for this firewall rule. Possible values (icmp, tcp, udp, gre, esp, ah) Note they must be lowercase
- Source
Changes to this property will trigger replacement.
- Possible values ("", cloudflare)
- Subnet
Changes to this property will trigger replacement.
- IP address that you want to define for this firewall rule.
- Subnet
Size Changes to this property will trigger replacement.
- The number of bits for the subnet in CIDR notation. Example: 32.
- Firewall
Group Id Changes to this property will trigger replacement.
- The firewall group that the firewall rule will belong to.
- Ip
Type Changes to this property will trigger replacement.
- The type of ip for this firewall rule. Possible values (v4, v6) Note they must be lowercase
- Notes
Changes to this property will trigger replacement.
- A simple note for a given firewall rule
- Port
Changes to this property will trigger replacement.
- TCP/UDP only. This field can be a specific port or a colon separated port range.
- Protocol
Changes to this property will trigger replacement.
- The type of protocol for this firewall rule. Possible values (icmp, tcp, udp, gre, esp, ah) Note they must be lowercase
- Source
Changes to this property will trigger replacement.
- Possible values ("", cloudflare)
- Subnet
Changes to this property will trigger replacement.
- IP address that you want to define for this firewall rule.
- Subnet
Size Changes to this property will trigger replacement.
- The number of bits for the subnet in CIDR notation. Example: 32.
- firewall
Group Id Changes to this property will trigger replacement.
- The firewall group that the firewall rule will belong to.
- ip
Type Changes to this property will trigger replacement.
- The type of ip for this firewall rule. Possible values (v4, v6) Note they must be lowercase
- notes
Changes to this property will trigger replacement.
- A simple note for a given firewall rule
- port
Changes to this property will trigger replacement.
- TCP/UDP only. This field can be a specific port or a colon separated port range.
- protocol
Changes to this property will trigger replacement.
- The type of protocol for this firewall rule. Possible values (icmp, tcp, udp, gre, esp, ah) Note they must be lowercase
- source
Changes to this property will trigger replacement.
- Possible values ("", cloudflare)
- subnet
Changes to this property will trigger replacement.
- IP address that you want to define for this firewall rule.
- subnet
Size Changes to this property will trigger replacement.
- The number of bits for the subnet in CIDR notation. Example: 32.
- firewall
Group Id Changes to this property will trigger replacement.
- The firewall group that the firewall rule will belong to.
- ip
Type Changes to this property will trigger replacement.
- The type of ip for this firewall rule. Possible values (v4, v6) Note they must be lowercase
- notes
Changes to this property will trigger replacement.
- A simple note for a given firewall rule
- port
Changes to this property will trigger replacement.
- TCP/UDP only. This field can be a specific port or a colon separated port range.
- protocol
Changes to this property will trigger replacement.
- The type of protocol for this firewall rule. Possible values (icmp, tcp, udp, gre, esp, ah) Note they must be lowercase
- source
Changes to this property will trigger replacement.
- Possible values ("", cloudflare)
- subnet
Changes to this property will trigger replacement.
- IP address that you want to define for this firewall rule.
- subnet
Size Changes to this property will trigger replacement.
- The number of bits for the subnet in CIDR notation. Example: 32.
- firewall_
group_ id Changes to this property will trigger replacement.
- The firewall group that the firewall rule will belong to.
- ip_
type Changes to this property will trigger replacement.
- The type of ip for this firewall rule. Possible values (v4, v6) Note they must be lowercase
- notes
Changes to this property will trigger replacement.
- A simple note for a given firewall rule
- port
Changes to this property will trigger replacement.
- TCP/UDP only. This field can be a specific port or a colon separated port range.
- protocol
Changes to this property will trigger replacement.
- The type of protocol for this firewall rule. Possible values (icmp, tcp, udp, gre, esp, ah) Note they must be lowercase
- source
Changes to this property will trigger replacement.
- Possible values ("", cloudflare)
- subnet
Changes to this property will trigger replacement.
- IP address that you want to define for this firewall rule.
- subnet_
size Changes to this property will trigger replacement.
- The number of bits for the subnet in CIDR notation. Example: 32.
- firewall
Group Id Changes to this property will trigger replacement.
- The firewall group that the firewall rule will belong to.
- ip
Type Changes to this property will trigger replacement.
- The type of ip for this firewall rule. Possible values (v4, v6) Note they must be lowercase
- notes
Changes to this property will trigger replacement.
- A simple note for a given firewall rule
- port
Changes to this property will trigger replacement.
- TCP/UDP only. This field can be a specific port or a colon separated port range.
- protocol
Changes to this property will trigger replacement.
- The type of protocol for this firewall rule. Possible values (icmp, tcp, udp, gre, esp, ah) Note they must be lowercase
- source
Changes to this property will trigger replacement.
- Possible values ("", cloudflare)
- subnet
Changes to this property will trigger replacement.
- IP address that you want to define for this firewall rule.
- subnet
Size Changes to this property will trigger replacement.
- The number of bits for the subnet in CIDR notation. Example: 32.
Import
Firewall Rules can be imported using the Firewall Group ID
and Firewall Rule ID
, e.g.
$ pulumi import vultr:index/firewallRule:FirewallRule my_rule b6a859c5-b299-49dd-8888-b1abbc517d08,1
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- vultr dirien/pulumi-vultr
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
vultr
Terraform Provider.