1. Packages
  2. Tencentcloud Provider
  3. API Docs
  4. CfwVpcFirewallSwitch
tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack

tencentcloud.CfwVpcFirewallSwitch

Explore with Pulumi AI

tencentcloud logo
tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack

    Provides a resource to create a cfw vpc_firewall_switch

    Example Usage

    Turn off switch

    import * as pulumi from "@pulumi/pulumi";
    import * as tencentcloud from "@pulumi/tencentcloud";
    
    const exampleCfwVpcFwSwitches = tencentcloud.getCfwVpcFwSwitches({
        vpcInsId: "cfwg-c8c2de41",
    });
    const exampleCfwVpcFirewallSwitch = new tencentcloud.CfwVpcFirewallSwitch("exampleCfwVpcFirewallSwitch", {
        vpcInsId: exampleCfwVpcFwSwitches.then(exampleCfwVpcFwSwitches => exampleCfwVpcFwSwitches.id),
        switchId: exampleCfwVpcFwSwitches.then(exampleCfwVpcFwSwitches => exampleCfwVpcFwSwitches.switchLists?.[0]?.switchId),
        enable: 0,
    });
    
    import pulumi
    import pulumi_tencentcloud as tencentcloud
    
    example_cfw_vpc_fw_switches = tencentcloud.get_cfw_vpc_fw_switches(vpc_ins_id="cfwg-c8c2de41")
    example_cfw_vpc_firewall_switch = tencentcloud.CfwVpcFirewallSwitch("exampleCfwVpcFirewallSwitch",
        vpc_ins_id=example_cfw_vpc_fw_switches.id,
        switch_id=example_cfw_vpc_fw_switches.switch_lists[0].switch_id,
        enable=0)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/tencentcloud/tencentcloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		exampleCfwVpcFwSwitches, err := tencentcloud.GetCfwVpcFwSwitches(ctx, &tencentcloud.GetCfwVpcFwSwitchesArgs{
    			VpcInsId: "cfwg-c8c2de41",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = tencentcloud.NewCfwVpcFirewallSwitch(ctx, "exampleCfwVpcFirewallSwitch", &tencentcloud.CfwVpcFirewallSwitchArgs{
    			VpcInsId: pulumi.String(exampleCfwVpcFwSwitches.Id),
    			SwitchId: pulumi.String(exampleCfwVpcFwSwitches.SwitchLists[0].SwitchId),
    			Enable:   pulumi.Float64(0),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Tencentcloud = Pulumi.Tencentcloud;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleCfwVpcFwSwitches = Tencentcloud.GetCfwVpcFwSwitches.Invoke(new()
        {
            VpcInsId = "cfwg-c8c2de41",
        });
    
        var exampleCfwVpcFirewallSwitch = new Tencentcloud.CfwVpcFirewallSwitch("exampleCfwVpcFirewallSwitch", new()
        {
            VpcInsId = exampleCfwVpcFwSwitches.Apply(getCfwVpcFwSwitchesResult => getCfwVpcFwSwitchesResult.Id),
            SwitchId = exampleCfwVpcFwSwitches.Apply(getCfwVpcFwSwitchesResult => getCfwVpcFwSwitchesResult.SwitchLists[0]?.SwitchId),
            Enable = 0,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.tencentcloud.TencentcloudFunctions;
    import com.pulumi.tencentcloud.inputs.GetCfwVpcFwSwitchesArgs;
    import com.pulumi.tencentcloud.CfwVpcFirewallSwitch;
    import com.pulumi.tencentcloud.CfwVpcFirewallSwitchArgs;
    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) {
            final var exampleCfwVpcFwSwitches = TencentcloudFunctions.getCfwVpcFwSwitches(GetCfwVpcFwSwitchesArgs.builder()
                .vpcInsId("cfwg-c8c2de41")
                .build());
    
            var exampleCfwVpcFirewallSwitch = new CfwVpcFirewallSwitch("exampleCfwVpcFirewallSwitch", CfwVpcFirewallSwitchArgs.builder()
                .vpcInsId(exampleCfwVpcFwSwitches.applyValue(getCfwVpcFwSwitchesResult -> getCfwVpcFwSwitchesResult.id()))
                .switchId(exampleCfwVpcFwSwitches.applyValue(getCfwVpcFwSwitchesResult -> getCfwVpcFwSwitchesResult.switchLists()[0].switchId()))
                .enable(0)
                .build());
    
        }
    }
    
    resources:
      exampleCfwVpcFirewallSwitch:
        type: tencentcloud:CfwVpcFirewallSwitch
        properties:
          vpcInsId: ${exampleCfwVpcFwSwitches.id}
          switchId: ${exampleCfwVpcFwSwitches.switchLists[0].switchId}
          enable: 0
    variables:
      exampleCfwVpcFwSwitches:
        fn::invoke:
          function: tencentcloud:getCfwVpcFwSwitches
          arguments:
            vpcInsId: cfwg-c8c2de41
    

    Or turn on switch

    import * as pulumi from "@pulumi/pulumi";
    import * as tencentcloud from "@pulumi/tencentcloud";
    
    const exampleCfwVpcFwSwitches = tencentcloud.getCfwVpcFwSwitches({
        vpcInsId: "cfwg-c8c2de41",
    });
    const exampleCfwVpcFirewallSwitch = new tencentcloud.CfwVpcFirewallSwitch("exampleCfwVpcFirewallSwitch", {
        vpcInsId: exampleCfwVpcFwSwitches.then(exampleCfwVpcFwSwitches => exampleCfwVpcFwSwitches.id),
        switchId: exampleCfwVpcFwSwitches.then(exampleCfwVpcFwSwitches => exampleCfwVpcFwSwitches.switchLists?.[0]?.switchId),
        enable: 1,
    });
    
    import pulumi
    import pulumi_tencentcloud as tencentcloud
    
    example_cfw_vpc_fw_switches = tencentcloud.get_cfw_vpc_fw_switches(vpc_ins_id="cfwg-c8c2de41")
    example_cfw_vpc_firewall_switch = tencentcloud.CfwVpcFirewallSwitch("exampleCfwVpcFirewallSwitch",
        vpc_ins_id=example_cfw_vpc_fw_switches.id,
        switch_id=example_cfw_vpc_fw_switches.switch_lists[0].switch_id,
        enable=1)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/tencentcloud/tencentcloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		exampleCfwVpcFwSwitches, err := tencentcloud.GetCfwVpcFwSwitches(ctx, &tencentcloud.GetCfwVpcFwSwitchesArgs{
    			VpcInsId: "cfwg-c8c2de41",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = tencentcloud.NewCfwVpcFirewallSwitch(ctx, "exampleCfwVpcFirewallSwitch", &tencentcloud.CfwVpcFirewallSwitchArgs{
    			VpcInsId: pulumi.String(exampleCfwVpcFwSwitches.Id),
    			SwitchId: pulumi.String(exampleCfwVpcFwSwitches.SwitchLists[0].SwitchId),
    			Enable:   pulumi.Float64(1),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Tencentcloud = Pulumi.Tencentcloud;
    
    return await Deployment.RunAsync(() => 
    {
        var exampleCfwVpcFwSwitches = Tencentcloud.GetCfwVpcFwSwitches.Invoke(new()
        {
            VpcInsId = "cfwg-c8c2de41",
        });
    
        var exampleCfwVpcFirewallSwitch = new Tencentcloud.CfwVpcFirewallSwitch("exampleCfwVpcFirewallSwitch", new()
        {
            VpcInsId = exampleCfwVpcFwSwitches.Apply(getCfwVpcFwSwitchesResult => getCfwVpcFwSwitchesResult.Id),
            SwitchId = exampleCfwVpcFwSwitches.Apply(getCfwVpcFwSwitchesResult => getCfwVpcFwSwitchesResult.SwitchLists[0]?.SwitchId),
            Enable = 1,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.tencentcloud.TencentcloudFunctions;
    import com.pulumi.tencentcloud.inputs.GetCfwVpcFwSwitchesArgs;
    import com.pulumi.tencentcloud.CfwVpcFirewallSwitch;
    import com.pulumi.tencentcloud.CfwVpcFirewallSwitchArgs;
    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) {
            final var exampleCfwVpcFwSwitches = TencentcloudFunctions.getCfwVpcFwSwitches(GetCfwVpcFwSwitchesArgs.builder()
                .vpcInsId("cfwg-c8c2de41")
                .build());
    
            var exampleCfwVpcFirewallSwitch = new CfwVpcFirewallSwitch("exampleCfwVpcFirewallSwitch", CfwVpcFirewallSwitchArgs.builder()
                .vpcInsId(exampleCfwVpcFwSwitches.applyValue(getCfwVpcFwSwitchesResult -> getCfwVpcFwSwitchesResult.id()))
                .switchId(exampleCfwVpcFwSwitches.applyValue(getCfwVpcFwSwitchesResult -> getCfwVpcFwSwitchesResult.switchLists()[0].switchId()))
                .enable(1)
                .build());
    
        }
    }
    
    resources:
      exampleCfwVpcFirewallSwitch:
        type: tencentcloud:CfwVpcFirewallSwitch
        properties:
          vpcInsId: ${exampleCfwVpcFwSwitches.id}
          switchId: ${exampleCfwVpcFwSwitches.switchLists[0].switchId}
          enable: 1
    variables:
      exampleCfwVpcFwSwitches:
        fn::invoke:
          function: tencentcloud:getCfwVpcFwSwitches
          arguments:
            vpcInsId: cfwg-c8c2de41
    

    Create CfwVpcFirewallSwitch Resource

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

    Constructor syntax

    new CfwVpcFirewallSwitch(name: string, args: CfwVpcFirewallSwitchArgs, opts?: CustomResourceOptions);
    @overload
    def CfwVpcFirewallSwitch(resource_name: str,
                             args: CfwVpcFirewallSwitchArgs,
                             opts: Optional[ResourceOptions] = None)
    
    @overload
    def CfwVpcFirewallSwitch(resource_name: str,
                             opts: Optional[ResourceOptions] = None,
                             enable: Optional[float] = None,
                             switch_id: Optional[str] = None,
                             vpc_ins_id: Optional[str] = None,
                             cfw_vpc_firewall_switch_id: Optional[str] = None)
    func NewCfwVpcFirewallSwitch(ctx *Context, name string, args CfwVpcFirewallSwitchArgs, opts ...ResourceOption) (*CfwVpcFirewallSwitch, error)
    public CfwVpcFirewallSwitch(string name, CfwVpcFirewallSwitchArgs args, CustomResourceOptions? opts = null)
    public CfwVpcFirewallSwitch(String name, CfwVpcFirewallSwitchArgs args)
    public CfwVpcFirewallSwitch(String name, CfwVpcFirewallSwitchArgs args, CustomResourceOptions options)
    
    type: tencentcloud:CfwVpcFirewallSwitch
    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 CfwVpcFirewallSwitchArgs
    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 CfwVpcFirewallSwitchArgs
    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 CfwVpcFirewallSwitchArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args CfwVpcFirewallSwitchArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args CfwVpcFirewallSwitchArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

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

    Enable double
    Turn the switch on or off. 0: turn off the switch; 1: Turn on the switch.
    SwitchId string
    Firewall switch ID.
    VpcInsId string
    Firewall instance id.
    CfwVpcFirewallSwitchId string
    ID of the resource.
    Enable float64
    Turn the switch on or off. 0: turn off the switch; 1: Turn on the switch.
    SwitchId string
    Firewall switch ID.
    VpcInsId string
    Firewall instance id.
    CfwVpcFirewallSwitchId string
    ID of the resource.
    enable Double
    Turn the switch on or off. 0: turn off the switch; 1: Turn on the switch.
    switchId String
    Firewall switch ID.
    vpcInsId String
    Firewall instance id.
    cfwVpcFirewallSwitchId String
    ID of the resource.
    enable number
    Turn the switch on or off. 0: turn off the switch; 1: Turn on the switch.
    switchId string
    Firewall switch ID.
    vpcInsId string
    Firewall instance id.
    cfwVpcFirewallSwitchId string
    ID of the resource.
    enable float
    Turn the switch on or off. 0: turn off the switch; 1: Turn on the switch.
    switch_id str
    Firewall switch ID.
    vpc_ins_id str
    Firewall instance id.
    cfw_vpc_firewall_switch_id str
    ID of the resource.
    enable Number
    Turn the switch on or off. 0: turn off the switch; 1: Turn on the switch.
    switchId String
    Firewall switch ID.
    vpcInsId String
    Firewall instance id.
    cfwVpcFirewallSwitchId String
    ID of the resource.

    Outputs

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

    Get an existing CfwVpcFirewallSwitch 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?: CfwVpcFirewallSwitchState, opts?: CustomResourceOptions): CfwVpcFirewallSwitch
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            cfw_vpc_firewall_switch_id: Optional[str] = None,
            enable: Optional[float] = None,
            switch_id: Optional[str] = None,
            vpc_ins_id: Optional[str] = None) -> CfwVpcFirewallSwitch
    func GetCfwVpcFirewallSwitch(ctx *Context, name string, id IDInput, state *CfwVpcFirewallSwitchState, opts ...ResourceOption) (*CfwVpcFirewallSwitch, error)
    public static CfwVpcFirewallSwitch Get(string name, Input<string> id, CfwVpcFirewallSwitchState? state, CustomResourceOptions? opts = null)
    public static CfwVpcFirewallSwitch get(String name, Output<String> id, CfwVpcFirewallSwitchState state, CustomResourceOptions options)
    resources:  _:    type: tencentcloud:CfwVpcFirewallSwitch    get:      id: ${id}
    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:
    CfwVpcFirewallSwitchId string
    ID of the resource.
    Enable double
    Turn the switch on or off. 0: turn off the switch; 1: Turn on the switch.
    SwitchId string
    Firewall switch ID.
    VpcInsId string
    Firewall instance id.
    CfwVpcFirewallSwitchId string
    ID of the resource.
    Enable float64
    Turn the switch on or off. 0: turn off the switch; 1: Turn on the switch.
    SwitchId string
    Firewall switch ID.
    VpcInsId string
    Firewall instance id.
    cfwVpcFirewallSwitchId String
    ID of the resource.
    enable Double
    Turn the switch on or off. 0: turn off the switch; 1: Turn on the switch.
    switchId String
    Firewall switch ID.
    vpcInsId String
    Firewall instance id.
    cfwVpcFirewallSwitchId string
    ID of the resource.
    enable number
    Turn the switch on or off. 0: turn off the switch; 1: Turn on the switch.
    switchId string
    Firewall switch ID.
    vpcInsId string
    Firewall instance id.
    cfw_vpc_firewall_switch_id str
    ID of the resource.
    enable float
    Turn the switch on or off. 0: turn off the switch; 1: Turn on the switch.
    switch_id str
    Firewall switch ID.
    vpc_ins_id str
    Firewall instance id.
    cfwVpcFirewallSwitchId String
    ID of the resource.
    enable Number
    Turn the switch on or off. 0: turn off the switch; 1: Turn on the switch.
    switchId String
    Firewall switch ID.
    vpcInsId String
    Firewall instance id.

    Import

    cfw vpc_firewall_switch can be imported using the id, e.g.

    $ pulumi import tencentcloud:index/cfwVpcFirewallSwitch:CfwVpcFirewallSwitch example cfwg-c8c2de41#cfws-f2c63ded84
    

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

    Package Details

    Repository
    tencentcloud tencentcloudstack/terraform-provider-tencentcloud
    License
    Notes
    This Pulumi package is based on the tencentcloud Terraform Provider.
    tencentcloud logo
    tencentcloud 1.81.189 published on Wednesday, Apr 30, 2025 by tencentcloudstack