1. Packages
  2. OpenStack
  3. API Docs
  4. firewall
  5. Policy
OpenStack v3.15.1 published on Thursday, Feb 1, 2024 by Pulumi

openstack.firewall.Policy

Explore with Pulumi AI

openstack logo
OpenStack v3.15.1 published on Thursday, Feb 1, 2024 by Pulumi

    Manages a v1 firewall policy resource within OpenStack.

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using OpenStack = Pulumi.OpenStack;
    
    return await Deployment.RunAsync(() => 
    {
        var rule1 = new OpenStack.Firewall.Rule("rule1", new()
        {
            Description = "drop TELNET traffic",
            Action = "deny",
            Protocol = "tcp",
            DestinationPort = "23",
            Enabled = true,
        });
    
        var rule2 = new OpenStack.Firewall.Rule("rule2", new()
        {
            Description = "drop NTP traffic",
            Action = "deny",
            Protocol = "udp",
            DestinationPort = "123",
            Enabled = false,
        });
    
        var policy1 = new OpenStack.Firewall.Policy("policy1", new()
        {
            Rules = new[]
            {
                rule1.Id,
                rule2.Id,
            },
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-openstack/sdk/v3/go/openstack/firewall"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		rule1, err := firewall.NewRule(ctx, "rule1", &firewall.RuleArgs{
    			Description:     pulumi.String("drop TELNET traffic"),
    			Action:          pulumi.String("deny"),
    			Protocol:        pulumi.String("tcp"),
    			DestinationPort: pulumi.String("23"),
    			Enabled:         pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		rule2, err := firewall.NewRule(ctx, "rule2", &firewall.RuleArgs{
    			Description:     pulumi.String("drop NTP traffic"),
    			Action:          pulumi.String("deny"),
    			Protocol:        pulumi.String("udp"),
    			DestinationPort: pulumi.String("123"),
    			Enabled:         pulumi.Bool(false),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = firewall.NewPolicy(ctx, "policy1", &firewall.PolicyArgs{
    			Rules: pulumi.StringArray{
    				rule1.ID(),
    				rule2.ID(),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.openstack.firewall.Rule;
    import com.pulumi.openstack.firewall.RuleArgs;
    import com.pulumi.openstack.firewall.Policy;
    import com.pulumi.openstack.firewall.PolicyArgs;
    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 rule1 = new Rule("rule1", RuleArgs.builder()        
                .description("drop TELNET traffic")
                .action("deny")
                .protocol("tcp")
                .destinationPort("23")
                .enabled("true")
                .build());
    
            var rule2 = new Rule("rule2", RuleArgs.builder()        
                .description("drop NTP traffic")
                .action("deny")
                .protocol("udp")
                .destinationPort("123")
                .enabled("false")
                .build());
    
            var policy1 = new Policy("policy1", PolicyArgs.builder()        
                .rules(            
                    rule1.id(),
                    rule2.id())
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_openstack as openstack
    
    rule1 = openstack.firewall.Rule("rule1",
        description="drop TELNET traffic",
        action="deny",
        protocol="tcp",
        destination_port="23",
        enabled=True)
    rule2 = openstack.firewall.Rule("rule2",
        description="drop NTP traffic",
        action="deny",
        protocol="udp",
        destination_port="123",
        enabled=False)
    policy1 = openstack.firewall.Policy("policy1", rules=[
        rule1.id,
        rule2.id,
    ])
    
    import * as pulumi from "@pulumi/pulumi";
    import * as openstack from "@pulumi/openstack";
    
    const rule1 = new openstack.firewall.Rule("rule1", {
        description: "drop TELNET traffic",
        action: "deny",
        protocol: "tcp",
        destinationPort: "23",
        enabled: true,
    });
    const rule2 = new openstack.firewall.Rule("rule2", {
        description: "drop NTP traffic",
        action: "deny",
        protocol: "udp",
        destinationPort: "123",
        enabled: false,
    });
    const policy1 = new openstack.firewall.Policy("policy1", {rules: [
        rule1.id,
        rule2.id,
    ]});
    
    resources:
      rule1:
        type: openstack:firewall:Rule
        properties:
          description: drop TELNET traffic
          action: deny
          protocol: tcp
          destinationPort: '23'
          enabled: 'true'
      rule2:
        type: openstack:firewall:Rule
        properties:
          description: drop NTP traffic
          action: deny
          protocol: udp
          destinationPort: '123'
          enabled: 'false'
      policy1:
        type: openstack:firewall:Policy
        properties:
          rules:
            - ${rule1.id}
            - ${rule2.id}
    

    Create Policy Resource

    new Policy(name: string, args?: PolicyArgs, opts?: CustomResourceOptions);
    @overload
    def Policy(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               audited: Optional[bool] = None,
               description: Optional[str] = None,
               name: Optional[str] = None,
               region: Optional[str] = None,
               rules: Optional[Sequence[str]] = None,
               shared: Optional[bool] = None,
               tenant_id: Optional[str] = None,
               value_specs: Optional[Mapping[str, Any]] = None)
    @overload
    def Policy(resource_name: str,
               args: Optional[PolicyArgs] = None,
               opts: Optional[ResourceOptions] = None)
    func NewPolicy(ctx *Context, name string, args *PolicyArgs, opts ...ResourceOption) (*Policy, error)
    public Policy(string name, PolicyArgs? args = null, CustomResourceOptions? opts = null)
    public Policy(String name, PolicyArgs args)
    public Policy(String name, PolicyArgs args, CustomResourceOptions options)
    
    type: openstack:firewall:Policy
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args PolicyArgs
    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 PolicyArgs
    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 PolicyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args PolicyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args PolicyArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Policy Resource Properties

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

    Inputs

    The Policy resource accepts the following input properties:

    Audited bool
    Audit status of the firewall policy (must be "true" or "false" if provided - defaults to "false"). This status is set to "false" whenever the firewall policy or any of its rules are changed. Changing this updates the audited status of an existing firewall policy.
    Description string
    A description for the firewall policy. Changing this updates the description of an existing firewall policy.
    Name string
    A name for the firewall policy. Changing this updates the name of an existing firewall policy.
    Region string
    The region in which to obtain the v1 networking client. A networking client is needed to create a firewall policy. If omitted, the region argument of the provider is used. Changing this creates a new firewall policy.
    Rules List<string>
    An array of one or more firewall rules that comprise the policy. Changing this results in adding/removing rules from the existing firewall policy.
    Shared bool
    Sharing status of the firewall policy (must be "true" or "false" if provided). If this is "true" the policy is visible to, and can be used in, firewalls in other tenants. Changing this updates the shared status of an existing firewall policy. Only administrative users can specify if the policy should be shared.
    TenantId string
    ValueSpecs Dictionary<string, object>
    Map of additional options.
    Audited bool
    Audit status of the firewall policy (must be "true" or "false" if provided - defaults to "false"). This status is set to "false" whenever the firewall policy or any of its rules are changed. Changing this updates the audited status of an existing firewall policy.
    Description string
    A description for the firewall policy. Changing this updates the description of an existing firewall policy.
    Name string
    A name for the firewall policy. Changing this updates the name of an existing firewall policy.
    Region string
    The region in which to obtain the v1 networking client. A networking client is needed to create a firewall policy. If omitted, the region argument of the provider is used. Changing this creates a new firewall policy.
    Rules []string
    An array of one or more firewall rules that comprise the policy. Changing this results in adding/removing rules from the existing firewall policy.
    Shared bool
    Sharing status of the firewall policy (must be "true" or "false" if provided). If this is "true" the policy is visible to, and can be used in, firewalls in other tenants. Changing this updates the shared status of an existing firewall policy. Only administrative users can specify if the policy should be shared.
    TenantId string
    ValueSpecs map[string]interface{}
    Map of additional options.
    audited Boolean
    Audit status of the firewall policy (must be "true" or "false" if provided - defaults to "false"). This status is set to "false" whenever the firewall policy or any of its rules are changed. Changing this updates the audited status of an existing firewall policy.
    description String
    A description for the firewall policy. Changing this updates the description of an existing firewall policy.
    name String
    A name for the firewall policy. Changing this updates the name of an existing firewall policy.
    region String
    The region in which to obtain the v1 networking client. A networking client is needed to create a firewall policy. If omitted, the region argument of the provider is used. Changing this creates a new firewall policy.
    rules List<String>
    An array of one or more firewall rules that comprise the policy. Changing this results in adding/removing rules from the existing firewall policy.
    shared Boolean
    Sharing status of the firewall policy (must be "true" or "false" if provided). If this is "true" the policy is visible to, and can be used in, firewalls in other tenants. Changing this updates the shared status of an existing firewall policy. Only administrative users can specify if the policy should be shared.
    tenantId String
    valueSpecs Map<String,Object>
    Map of additional options.
    audited boolean
    Audit status of the firewall policy (must be "true" or "false" if provided - defaults to "false"). This status is set to "false" whenever the firewall policy or any of its rules are changed. Changing this updates the audited status of an existing firewall policy.
    description string
    A description for the firewall policy. Changing this updates the description of an existing firewall policy.
    name string
    A name for the firewall policy. Changing this updates the name of an existing firewall policy.
    region string
    The region in which to obtain the v1 networking client. A networking client is needed to create a firewall policy. If omitted, the region argument of the provider is used. Changing this creates a new firewall policy.
    rules string[]
    An array of one or more firewall rules that comprise the policy. Changing this results in adding/removing rules from the existing firewall policy.
    shared boolean
    Sharing status of the firewall policy (must be "true" or "false" if provided). If this is "true" the policy is visible to, and can be used in, firewalls in other tenants. Changing this updates the shared status of an existing firewall policy. Only administrative users can specify if the policy should be shared.
    tenantId string
    valueSpecs {[key: string]: any}
    Map of additional options.
    audited bool
    Audit status of the firewall policy (must be "true" or "false" if provided - defaults to "false"). This status is set to "false" whenever the firewall policy or any of its rules are changed. Changing this updates the audited status of an existing firewall policy.
    description str
    A description for the firewall policy. Changing this updates the description of an existing firewall policy.
    name str
    A name for the firewall policy. Changing this updates the name of an existing firewall policy.
    region str
    The region in which to obtain the v1 networking client. A networking client is needed to create a firewall policy. If omitted, the region argument of the provider is used. Changing this creates a new firewall policy.
    rules Sequence[str]
    An array of one or more firewall rules that comprise the policy. Changing this results in adding/removing rules from the existing firewall policy.
    shared bool
    Sharing status of the firewall policy (must be "true" or "false" if provided). If this is "true" the policy is visible to, and can be used in, firewalls in other tenants. Changing this updates the shared status of an existing firewall policy. Only administrative users can specify if the policy should be shared.
    tenant_id str
    value_specs Mapping[str, Any]
    Map of additional options.
    audited Boolean
    Audit status of the firewall policy (must be "true" or "false" if provided - defaults to "false"). This status is set to "false" whenever the firewall policy or any of its rules are changed. Changing this updates the audited status of an existing firewall policy.
    description String
    A description for the firewall policy. Changing this updates the description of an existing firewall policy.
    name String
    A name for the firewall policy. Changing this updates the name of an existing firewall policy.
    region String
    The region in which to obtain the v1 networking client. A networking client is needed to create a firewall policy. If omitted, the region argument of the provider is used. Changing this creates a new firewall policy.
    rules List<String>
    An array of one or more firewall rules that comprise the policy. Changing this results in adding/removing rules from the existing firewall policy.
    shared Boolean
    Sharing status of the firewall policy (must be "true" or "false" if provided). If this is "true" the policy is visible to, and can be used in, firewalls in other tenants. Changing this updates the shared status of an existing firewall policy. Only administrative users can specify if the policy should be shared.
    tenantId String
    valueSpecs Map<Any>
    Map of additional options.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the Policy 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 Policy Resource

    Get an existing Policy 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?: PolicyState, opts?: CustomResourceOptions): Policy
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            audited: Optional[bool] = None,
            description: Optional[str] = None,
            name: Optional[str] = None,
            region: Optional[str] = None,
            rules: Optional[Sequence[str]] = None,
            shared: Optional[bool] = None,
            tenant_id: Optional[str] = None,
            value_specs: Optional[Mapping[str, Any]] = None) -> Policy
    func GetPolicy(ctx *Context, name string, id IDInput, state *PolicyState, opts ...ResourceOption) (*Policy, error)
    public static Policy Get(string name, Input<string> id, PolicyState? state, CustomResourceOptions? opts = null)
    public static Policy get(String name, Output<String> id, PolicyState 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:
    Audited bool
    Audit status of the firewall policy (must be "true" or "false" if provided - defaults to "false"). This status is set to "false" whenever the firewall policy or any of its rules are changed. Changing this updates the audited status of an existing firewall policy.
    Description string
    A description for the firewall policy. Changing this updates the description of an existing firewall policy.
    Name string
    A name for the firewall policy. Changing this updates the name of an existing firewall policy.
    Region string
    The region in which to obtain the v1 networking client. A networking client is needed to create a firewall policy. If omitted, the region argument of the provider is used. Changing this creates a new firewall policy.
    Rules List<string>
    An array of one or more firewall rules that comprise the policy. Changing this results in adding/removing rules from the existing firewall policy.
    Shared bool
    Sharing status of the firewall policy (must be "true" or "false" if provided). If this is "true" the policy is visible to, and can be used in, firewalls in other tenants. Changing this updates the shared status of an existing firewall policy. Only administrative users can specify if the policy should be shared.
    TenantId string
    ValueSpecs Dictionary<string, object>
    Map of additional options.
    Audited bool
    Audit status of the firewall policy (must be "true" or "false" if provided - defaults to "false"). This status is set to "false" whenever the firewall policy or any of its rules are changed. Changing this updates the audited status of an existing firewall policy.
    Description string
    A description for the firewall policy. Changing this updates the description of an existing firewall policy.
    Name string
    A name for the firewall policy. Changing this updates the name of an existing firewall policy.
    Region string
    The region in which to obtain the v1 networking client. A networking client is needed to create a firewall policy. If omitted, the region argument of the provider is used. Changing this creates a new firewall policy.
    Rules []string
    An array of one or more firewall rules that comprise the policy. Changing this results in adding/removing rules from the existing firewall policy.
    Shared bool
    Sharing status of the firewall policy (must be "true" or "false" if provided). If this is "true" the policy is visible to, and can be used in, firewalls in other tenants. Changing this updates the shared status of an existing firewall policy. Only administrative users can specify if the policy should be shared.
    TenantId string
    ValueSpecs map[string]interface{}
    Map of additional options.
    audited Boolean
    Audit status of the firewall policy (must be "true" or "false" if provided - defaults to "false"). This status is set to "false" whenever the firewall policy or any of its rules are changed. Changing this updates the audited status of an existing firewall policy.
    description String
    A description for the firewall policy. Changing this updates the description of an existing firewall policy.
    name String
    A name for the firewall policy. Changing this updates the name of an existing firewall policy.
    region String
    The region in which to obtain the v1 networking client. A networking client is needed to create a firewall policy. If omitted, the region argument of the provider is used. Changing this creates a new firewall policy.
    rules List<String>
    An array of one or more firewall rules that comprise the policy. Changing this results in adding/removing rules from the existing firewall policy.
    shared Boolean
    Sharing status of the firewall policy (must be "true" or "false" if provided). If this is "true" the policy is visible to, and can be used in, firewalls in other tenants. Changing this updates the shared status of an existing firewall policy. Only administrative users can specify if the policy should be shared.
    tenantId String
    valueSpecs Map<String,Object>
    Map of additional options.
    audited boolean
    Audit status of the firewall policy (must be "true" or "false" if provided - defaults to "false"). This status is set to "false" whenever the firewall policy or any of its rules are changed. Changing this updates the audited status of an existing firewall policy.
    description string
    A description for the firewall policy. Changing this updates the description of an existing firewall policy.
    name string
    A name for the firewall policy. Changing this updates the name of an existing firewall policy.
    region string
    The region in which to obtain the v1 networking client. A networking client is needed to create a firewall policy. If omitted, the region argument of the provider is used. Changing this creates a new firewall policy.
    rules string[]
    An array of one or more firewall rules that comprise the policy. Changing this results in adding/removing rules from the existing firewall policy.
    shared boolean
    Sharing status of the firewall policy (must be "true" or "false" if provided). If this is "true" the policy is visible to, and can be used in, firewalls in other tenants. Changing this updates the shared status of an existing firewall policy. Only administrative users can specify if the policy should be shared.
    tenantId string
    valueSpecs {[key: string]: any}
    Map of additional options.
    audited bool
    Audit status of the firewall policy (must be "true" or "false" if provided - defaults to "false"). This status is set to "false" whenever the firewall policy or any of its rules are changed. Changing this updates the audited status of an existing firewall policy.
    description str
    A description for the firewall policy. Changing this updates the description of an existing firewall policy.
    name str
    A name for the firewall policy. Changing this updates the name of an existing firewall policy.
    region str
    The region in which to obtain the v1 networking client. A networking client is needed to create a firewall policy. If omitted, the region argument of the provider is used. Changing this creates a new firewall policy.
    rules Sequence[str]
    An array of one or more firewall rules that comprise the policy. Changing this results in adding/removing rules from the existing firewall policy.
    shared bool
    Sharing status of the firewall policy (must be "true" or "false" if provided). If this is "true" the policy is visible to, and can be used in, firewalls in other tenants. Changing this updates the shared status of an existing firewall policy. Only administrative users can specify if the policy should be shared.
    tenant_id str
    value_specs Mapping[str, Any]
    Map of additional options.
    audited Boolean
    Audit status of the firewall policy (must be "true" or "false" if provided - defaults to "false"). This status is set to "false" whenever the firewall policy or any of its rules are changed. Changing this updates the audited status of an existing firewall policy.
    description String
    A description for the firewall policy. Changing this updates the description of an existing firewall policy.
    name String
    A name for the firewall policy. Changing this updates the name of an existing firewall policy.
    region String
    The region in which to obtain the v1 networking client. A networking client is needed to create a firewall policy. If omitted, the region argument of the provider is used. Changing this creates a new firewall policy.
    rules List<String>
    An array of one or more firewall rules that comprise the policy. Changing this results in adding/removing rules from the existing firewall policy.
    shared Boolean
    Sharing status of the firewall policy (must be "true" or "false" if provided). If this is "true" the policy is visible to, and can be used in, firewalls in other tenants. Changing this updates the shared status of an existing firewall policy. Only administrative users can specify if the policy should be shared.
    tenantId String
    valueSpecs Map<Any>
    Map of additional options.

    Import

    Firewall Policies can be imported using the id, e.g.

     $ pulumi import openstack:firewall/policy:Policy policy_1 07f422e6-c596-474b-8b94-fe2c12506ce0
    

    Package Details

    Repository
    OpenStack pulumi/pulumi-openstack
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the openstack Terraform Provider.
    openstack logo
    OpenStack v3.15.1 published on Thursday, Feb 1, 2024 by Pulumi