1. Packages
  2. Oracle Cloud Infrastructure
  3. API Docs
  4. Core
  5. NetworkSecurityGroup
Oracle Cloud Infrastructure v1.41.0 published on Wednesday, Jun 19, 2024 by Pulumi

oci.Core.NetworkSecurityGroup

Explore with Pulumi AI

oci logo
Oracle Cloud Infrastructure v1.41.0 published on Wednesday, Jun 19, 2024 by Pulumi

    This resource provides the Network Security Group resource in Oracle Cloud Infrastructure Core service.

    Creates a new network security group for the specified VCN.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as oci from "@pulumi/oci";
    
    const testNetworkSecurityGroup = new oci.core.NetworkSecurityGroup("test_network_security_group", {
        compartmentId: compartmentId,
        vcnId: testVcn.id,
        definedTags: {
            "Operations.CostCenter": "42",
        },
        displayName: networkSecurityGroupDisplayName,
        freeformTags: {
            Department: "Finance",
        },
    });
    
    import pulumi
    import pulumi_oci as oci
    
    test_network_security_group = oci.core.NetworkSecurityGroup("test_network_security_group",
        compartment_id=compartment_id,
        vcn_id=test_vcn["id"],
        defined_tags={
            "Operations.CostCenter": "42",
        },
        display_name=network_security_group_display_name,
        freeform_tags={
            "Department": "Finance",
        })
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-oci/sdk/go/oci/Core"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := Core.NewNetworkSecurityGroup(ctx, "test_network_security_group", &Core.NetworkSecurityGroupArgs{
    			CompartmentId: pulumi.Any(compartmentId),
    			VcnId:         pulumi.Any(testVcn.Id),
    			DefinedTags: pulumi.Map{
    				"Operations.CostCenter": pulumi.Any("42"),
    			},
    			DisplayName: pulumi.Any(networkSecurityGroupDisplayName),
    			FreeformTags: pulumi.Map{
    				"Department": pulumi.Any("Finance"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Oci = Pulumi.Oci;
    
    return await Deployment.RunAsync(() => 
    {
        var testNetworkSecurityGroup = new Oci.Core.NetworkSecurityGroup("test_network_security_group", new()
        {
            CompartmentId = compartmentId,
            VcnId = testVcn.Id,
            DefinedTags = 
            {
                { "Operations.CostCenter", "42" },
            },
            DisplayName = networkSecurityGroupDisplayName,
            FreeformTags = 
            {
                { "Department", "Finance" },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.oci.Core.NetworkSecurityGroup;
    import com.pulumi.oci.Core.NetworkSecurityGroupArgs;
    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 testNetworkSecurityGroup = new NetworkSecurityGroup("testNetworkSecurityGroup", NetworkSecurityGroupArgs.builder()
                .compartmentId(compartmentId)
                .vcnId(testVcn.id())
                .definedTags(Map.of("Operations.CostCenter", "42"))
                .displayName(networkSecurityGroupDisplayName)
                .freeformTags(Map.of("Department", "Finance"))
                .build());
    
        }
    }
    
    resources:
      testNetworkSecurityGroup:
        type: oci:Core:NetworkSecurityGroup
        name: test_network_security_group
        properties:
          compartmentId: ${compartmentId}
          vcnId: ${testVcn.id}
          definedTags:
            Operations.CostCenter: '42'
          displayName: ${networkSecurityGroupDisplayName}
          freeformTags:
            Department: Finance
    

    Create NetworkSecurityGroup Resource

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

    Constructor syntax

    new NetworkSecurityGroup(name: string, args: NetworkSecurityGroupArgs, opts?: CustomResourceOptions);
    @overload
    def NetworkSecurityGroup(resource_name: str,
                             args: NetworkSecurityGroupArgs,
                             opts: Optional[ResourceOptions] = None)
    
    @overload
    def NetworkSecurityGroup(resource_name: str,
                             opts: Optional[ResourceOptions] = None,
                             compartment_id: Optional[str] = None,
                             vcn_id: Optional[str] = None,
                             defined_tags: Optional[Mapping[str, Any]] = None,
                             display_name: Optional[str] = None,
                             freeform_tags: Optional[Mapping[str, Any]] = None)
    func NewNetworkSecurityGroup(ctx *Context, name string, args NetworkSecurityGroupArgs, opts ...ResourceOption) (*NetworkSecurityGroup, error)
    public NetworkSecurityGroup(string name, NetworkSecurityGroupArgs args, CustomResourceOptions? opts = null)
    public NetworkSecurityGroup(String name, NetworkSecurityGroupArgs args)
    public NetworkSecurityGroup(String name, NetworkSecurityGroupArgs args, CustomResourceOptions options)
    
    type: oci:Core:NetworkSecurityGroup
    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 NetworkSecurityGroupArgs
    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 NetworkSecurityGroupArgs
    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 NetworkSecurityGroupArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args NetworkSecurityGroupArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args NetworkSecurityGroupArgs
    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 networkSecurityGroupResource = new Oci.Core.NetworkSecurityGroup("networkSecurityGroupResource", new()
    {
        CompartmentId = "string",
        VcnId = "string",
        DefinedTags = 
        {
            { "string", "any" },
        },
        DisplayName = "string",
        FreeformTags = 
        {
            { "string", "any" },
        },
    });
    
    example, err := Core.NewNetworkSecurityGroup(ctx, "networkSecurityGroupResource", &Core.NetworkSecurityGroupArgs{
    	CompartmentId: pulumi.String("string"),
    	VcnId:         pulumi.String("string"),
    	DefinedTags: pulumi.Map{
    		"string": pulumi.Any("any"),
    	},
    	DisplayName: pulumi.String("string"),
    	FreeformTags: pulumi.Map{
    		"string": pulumi.Any("any"),
    	},
    })
    
    var networkSecurityGroupResource = new NetworkSecurityGroup("networkSecurityGroupResource", NetworkSecurityGroupArgs.builder()
        .compartmentId("string")
        .vcnId("string")
        .definedTags(Map.of("string", "any"))
        .displayName("string")
        .freeformTags(Map.of("string", "any"))
        .build());
    
    network_security_group_resource = oci.core.NetworkSecurityGroup("networkSecurityGroupResource",
        compartment_id="string",
        vcn_id="string",
        defined_tags={
            "string": "any",
        },
        display_name="string",
        freeform_tags={
            "string": "any",
        })
    
    const networkSecurityGroupResource = new oci.core.NetworkSecurityGroup("networkSecurityGroupResource", {
        compartmentId: "string",
        vcnId: "string",
        definedTags: {
            string: "any",
        },
        displayName: "string",
        freeformTags: {
            string: "any",
        },
    });
    
    type: oci:Core:NetworkSecurityGroup
    properties:
        compartmentId: string
        definedTags:
            string: any
        displayName: string
        freeformTags:
            string: any
        vcnId: string
    

    NetworkSecurityGroup 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 NetworkSecurityGroup resource accepts the following input properties:

    CompartmentId string
    (Updatable) The OCID of the compartment to contain the network security group.
    VcnId string

    The OCID of the VCN to create the network security group in.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    DefinedTags Dictionary<string, object>
    (Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    DisplayName string
    (Updatable) A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
    FreeformTags Dictionary<string, object>
    (Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    CompartmentId string
    (Updatable) The OCID of the compartment to contain the network security group.
    VcnId string

    The OCID of the VCN to create the network security group in.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    DefinedTags map[string]interface{}
    (Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    DisplayName string
    (Updatable) A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
    FreeformTags map[string]interface{}
    (Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    compartmentId String
    (Updatable) The OCID of the compartment to contain the network security group.
    vcnId String

    The OCID of the VCN to create the network security group in.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    definedTags Map<String,Object>
    (Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    displayName String
    (Updatable) A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
    freeformTags Map<String,Object>
    (Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    compartmentId string
    (Updatable) The OCID of the compartment to contain the network security group.
    vcnId string

    The OCID of the VCN to create the network security group in.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    definedTags {[key: string]: any}
    (Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    displayName string
    (Updatable) A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
    freeformTags {[key: string]: any}
    (Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    compartment_id str
    (Updatable) The OCID of the compartment to contain the network security group.
    vcn_id str

    The OCID of the VCN to create the network security group in.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    defined_tags Mapping[str, Any]
    (Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    display_name str
    (Updatable) A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
    freeform_tags Mapping[str, Any]
    (Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    compartmentId String
    (Updatable) The OCID of the compartment to contain the network security group.
    vcnId String

    The OCID of the VCN to create the network security group in.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    definedTags Map<Any>
    (Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    displayName String
    (Updatable) A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
    freeformTags Map<Any>
    (Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    State string
    The network security group's current state.
    TimeCreated string
    The date and time the network security group was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    Id string
    The provider-assigned unique ID for this managed resource.
    State string
    The network security group's current state.
    TimeCreated string
    The date and time the network security group was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    id String
    The provider-assigned unique ID for this managed resource.
    state String
    The network security group's current state.
    timeCreated String
    The date and time the network security group was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    id string
    The provider-assigned unique ID for this managed resource.
    state string
    The network security group's current state.
    timeCreated string
    The date and time the network security group was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    id str
    The provider-assigned unique ID for this managed resource.
    state str
    The network security group's current state.
    time_created str
    The date and time the network security group was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    id String
    The provider-assigned unique ID for this managed resource.
    state String
    The network security group's current state.
    timeCreated String
    The date and time the network security group was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z

    Look up Existing NetworkSecurityGroup Resource

    Get an existing NetworkSecurityGroup 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?: NetworkSecurityGroupState, opts?: CustomResourceOptions): NetworkSecurityGroup
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            compartment_id: Optional[str] = None,
            defined_tags: Optional[Mapping[str, Any]] = None,
            display_name: Optional[str] = None,
            freeform_tags: Optional[Mapping[str, Any]] = None,
            state: Optional[str] = None,
            time_created: Optional[str] = None,
            vcn_id: Optional[str] = None) -> NetworkSecurityGroup
    func GetNetworkSecurityGroup(ctx *Context, name string, id IDInput, state *NetworkSecurityGroupState, opts ...ResourceOption) (*NetworkSecurityGroup, error)
    public static NetworkSecurityGroup Get(string name, Input<string> id, NetworkSecurityGroupState? state, CustomResourceOptions? opts = null)
    public static NetworkSecurityGroup get(String name, Output<String> id, NetworkSecurityGroupState 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:
    CompartmentId string
    (Updatable) The OCID of the compartment to contain the network security group.
    DefinedTags Dictionary<string, object>
    (Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    DisplayName string
    (Updatable) A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
    FreeformTags Dictionary<string, object>
    (Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    State string
    The network security group's current state.
    TimeCreated string
    The date and time the network security group was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    VcnId string

    The OCID of the VCN to create the network security group in.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    CompartmentId string
    (Updatable) The OCID of the compartment to contain the network security group.
    DefinedTags map[string]interface{}
    (Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    DisplayName string
    (Updatable) A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
    FreeformTags map[string]interface{}
    (Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    State string
    The network security group's current state.
    TimeCreated string
    The date and time the network security group was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    VcnId string

    The OCID of the VCN to create the network security group in.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    compartmentId String
    (Updatable) The OCID of the compartment to contain the network security group.
    definedTags Map<String,Object>
    (Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    displayName String
    (Updatable) A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
    freeformTags Map<String,Object>
    (Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    state String
    The network security group's current state.
    timeCreated String
    The date and time the network security group was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    vcnId String

    The OCID of the VCN to create the network security group in.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    compartmentId string
    (Updatable) The OCID of the compartment to contain the network security group.
    definedTags {[key: string]: any}
    (Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    displayName string
    (Updatable) A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
    freeformTags {[key: string]: any}
    (Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    state string
    The network security group's current state.
    timeCreated string
    The date and time the network security group was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    vcnId string

    The OCID of the VCN to create the network security group in.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    compartment_id str
    (Updatable) The OCID of the compartment to contain the network security group.
    defined_tags Mapping[str, Any]
    (Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    display_name str
    (Updatable) A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
    freeform_tags Mapping[str, Any]
    (Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    state str
    The network security group's current state.
    time_created str
    The date and time the network security group was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    vcn_id str

    The OCID of the VCN to create the network security group in.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    compartmentId String
    (Updatable) The OCID of the compartment to contain the network security group.
    definedTags Map<Any>
    (Updatable) Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: {"Operations.CostCenter": "42"}
    displayName String
    (Updatable) A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
    freeformTags Map<Any>
    (Updatable) Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: {"Department": "Finance"}
    state String
    The network security group's current state.
    timeCreated String
    The date and time the network security group was created, in the format defined by RFC3339. Example: 2016-08-25T21:10:29.600Z
    vcnId String

    The OCID of the VCN to create the network security group in.

    ** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

    Import

    NetworkSecurityGroups can be imported using the id, e.g.

    $ pulumi import oci:Core/networkSecurityGroup:NetworkSecurityGroup test_network_security_group "id"
    

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

    Package Details

    Repository
    oci pulumi/pulumi-oci
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the oci Terraform Provider.
    oci logo
    Oracle Cloud Infrastructure v1.41.0 published on Wednesday, Jun 19, 2024 by Pulumi