tencentcloud.SgRule
Explore with Pulumi AI
Provides a resource to create a cfw sg_rule
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as tencentcloud from "@pulumi/tencentcloud";
const sgRule = new tencentcloud.SgRule("sgRule", {
data: {
description: "1111112",
destContent: "0.0.0.0/0",
destType: "net",
port: "-1/-1",
protocol: "ANY",
ruleAction: "accept",
serviceTemplateId: "ppm-l9u5pf1y",
sourceContent: "0.0.0.0/0",
sourceType: "net",
},
enable: 1,
});
import pulumi
import pulumi_tencentcloud as tencentcloud
sg_rule = tencentcloud.SgRule("sgRule",
data={
"description": "1111112",
"dest_content": "0.0.0.0/0",
"dest_type": "net",
"port": "-1/-1",
"protocol": "ANY",
"rule_action": "accept",
"service_template_id": "ppm-l9u5pf1y",
"source_content": "0.0.0.0/0",
"source_type": "net",
},
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 {
_, err := tencentcloud.NewSgRule(ctx, "sgRule", &tencentcloud.SgRuleArgs{
Data: &tencentcloud.SgRuleDataArgs{
Description: pulumi.String("1111112"),
DestContent: pulumi.String("0.0.0.0/0"),
DestType: pulumi.String("net"),
Port: pulumi.String("-1/-1"),
Protocol: pulumi.String("ANY"),
RuleAction: pulumi.String("accept"),
ServiceTemplateId: pulumi.String("ppm-l9u5pf1y"),
SourceContent: pulumi.String("0.0.0.0/0"),
SourceType: pulumi.String("net"),
},
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 sgRule = new Tencentcloud.SgRule("sgRule", new()
{
Data = new Tencentcloud.Inputs.SgRuleDataArgs
{
Description = "1111112",
DestContent = "0.0.0.0/0",
DestType = "net",
Port = "-1/-1",
Protocol = "ANY",
RuleAction = "accept",
ServiceTemplateId = "ppm-l9u5pf1y",
SourceContent = "0.0.0.0/0",
SourceType = "net",
},
Enable = 1,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.tencentcloud.SgRule;
import com.pulumi.tencentcloud.SgRuleArgs;
import com.pulumi.tencentcloud.inputs.SgRuleDataArgs;
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 sgRule = new SgRule("sgRule", SgRuleArgs.builder()
.data(SgRuleDataArgs.builder()
.description("1111112")
.destContent("0.0.0.0/0")
.destType("net")
.port("-1/-1")
.protocol("ANY")
.ruleAction("accept")
.serviceTemplateId("ppm-l9u5pf1y")
.sourceContent("0.0.0.0/0")
.sourceType("net")
.build())
.enable(1)
.build());
}
}
resources:
sgRule:
type: tencentcloud:SgRule
properties:
data:
description: '1111112'
destContent: 0.0.0.0/0
destType: net
port: -1/-1
protocol: ANY
ruleAction: accept
serviceTemplateId: ppm-l9u5pf1y
sourceContent: 0.0.0.0/0
sourceType: net
enable: 1
Create SgRule Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new SgRule(name: string, args: SgRuleArgs, opts?: CustomResourceOptions);
@overload
def SgRule(resource_name: str,
args: SgRuleArgs,
opts: Optional[ResourceOptions] = None)
@overload
def SgRule(resource_name: str,
opts: Optional[ResourceOptions] = None,
data: Optional[SgRuleDataArgs] = None,
enable: Optional[float] = None,
sg_rule_id: Optional[str] = None)
func NewSgRule(ctx *Context, name string, args SgRuleArgs, opts ...ResourceOption) (*SgRule, error)
public SgRule(string name, SgRuleArgs args, CustomResourceOptions? opts = null)
public SgRule(String name, SgRuleArgs args)
public SgRule(String name, SgRuleArgs args, CustomResourceOptions options)
type: tencentcloud:SgRule
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 SgRuleArgs
- 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 SgRuleArgs
- 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 SgRuleArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args SgRuleArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args SgRuleArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
SgRule 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 SgRule resource accepts the following input properties:
- Data
Sg
Rule Data - Creates rule data.
- Enable double
- Rule status.
0
is off,1
is on. This parameter is not required or is 1 when creating. - Sg
Rule stringId - ID of the resource.
- Data
Sg
Rule Data Args - Creates rule data.
- Enable float64
- Rule status.
0
is off,1
is on. This parameter is not required or is 1 when creating. - Sg
Rule stringId - ID of the resource.
- data
Sg
Rule Data - Creates rule data.
- enable Double
- Rule status.
0
is off,1
is on. This parameter is not required or is 1 when creating. - sg
Rule StringId - ID of the resource.
- data
Sg
Rule Data - Creates rule data.
- enable number
- Rule status.
0
is off,1
is on. This parameter is not required or is 1 when creating. - sg
Rule stringId - ID of the resource.
- data
Sg
Rule Data Args - Creates rule data.
- enable float
- Rule status.
0
is off,1
is on. This parameter is not required or is 1 when creating. - sg_
rule_ strid - ID of the resource.
- data Property Map
- Creates rule data.
- enable Number
- Rule status.
0
is off,1
is on. This parameter is not required or is 1 when creating. - sg
Rule StringId - ID of the resource.
Outputs
All input properties are implicitly available as output properties. Additionally, the SgRule 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 SgRule Resource
Get an existing SgRule 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?: SgRuleState, opts?: CustomResourceOptions): SgRule
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
data: Optional[SgRuleDataArgs] = None,
enable: Optional[float] = None,
sg_rule_id: Optional[str] = None) -> SgRule
func GetSgRule(ctx *Context, name string, id IDInput, state *SgRuleState, opts ...ResourceOption) (*SgRule, error)
public static SgRule Get(string name, Input<string> id, SgRuleState? state, CustomResourceOptions? opts = null)
public static SgRule get(String name, Output<String> id, SgRuleState state, CustomResourceOptions options)
resources: _: type: tencentcloud:SgRule 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.
- Data
Sg
Rule Data - Creates rule data.
- Enable double
- Rule status.
0
is off,1
is on. This parameter is not required or is 1 when creating. - Sg
Rule stringId - ID of the resource.
- Data
Sg
Rule Data Args - Creates rule data.
- Enable float64
- Rule status.
0
is off,1
is on. This parameter is not required or is 1 when creating. - Sg
Rule stringId - ID of the resource.
- data
Sg
Rule Data - Creates rule data.
- enable Double
- Rule status.
0
is off,1
is on. This parameter is not required or is 1 when creating. - sg
Rule StringId - ID of the resource.
- data
Sg
Rule Data - Creates rule data.
- enable number
- Rule status.
0
is off,1
is on. This parameter is not required or is 1 when creating. - sg
Rule stringId - ID of the resource.
- data
Sg
Rule Data Args - Creates rule data.
- enable float
- Rule status.
0
is off,1
is on. This parameter is not required or is 1 when creating. - sg_
rule_ strid - ID of the resource.
- data Property Map
- Creates rule data.
- enable Number
- Rule status.
0
is off,1
is on. This parameter is not required or is 1 when creating. - sg
Rule StringId - ID of the resource.
Supporting Types
SgRuleData, SgRuleDataArgs
- Description string
- Description.
- Dest
Content string - Destination example:
net
: IP/CIDR (192.168.0.2);template
: parameter template (ipm-dyodhpby);instance
: asset instance (ins-123456);resourcegroup
: asset group (/all groups/group 1/subgroup 1);tag
: resource tag ({"Key":"tag key","Value":"tag value"});region
: region (ap-gaungzhou). - Dest
Type string - Access destination type. Valid values: net|template|instance|resourcegroup|tag|region.
- Rule
Action string - The action that Cloud Firewall performs on the traffic. Valid values:
accept
: allow,drop
: deny. - Source
Content string - Source example:
net
: IP/CIDR (192.168.0.2);template
: parameter template (ipm-dyodhpby);instance
: asset instance (ins-123456);resourcegroup
: asset group (/all groups/group 1/subgroup 1);tag
: resource tag ({"Key":"tag key","Value":"tag value"});region
: region (ap-gaungzhou). - Source
Type string - Access source type. Valid values: net|template|instance|resourcegroup|tag|region.
- Order
Index string - Rule priority.
- Port string
- The port to apply access control rules. Valid values:
-1/-1
: all ports,80
: port 80. - Protocol string
- Protocol. TCP/UDP/ICMP/ANY.
- Service
Template stringId - Parameter template ID of port and protocol type; mutually exclusive with Protocol and Port.
- Description string
- Description.
- Dest
Content string - Destination example:
net
: IP/CIDR (192.168.0.2);template
: parameter template (ipm-dyodhpby);instance
: asset instance (ins-123456);resourcegroup
: asset group (/all groups/group 1/subgroup 1);tag
: resource tag ({"Key":"tag key","Value":"tag value"});region
: region (ap-gaungzhou). - Dest
Type string - Access destination type. Valid values: net|template|instance|resourcegroup|tag|region.
- Rule
Action string - The action that Cloud Firewall performs on the traffic. Valid values:
accept
: allow,drop
: deny. - Source
Content string - Source example:
net
: IP/CIDR (192.168.0.2);template
: parameter template (ipm-dyodhpby);instance
: asset instance (ins-123456);resourcegroup
: asset group (/all groups/group 1/subgroup 1);tag
: resource tag ({"Key":"tag key","Value":"tag value"});region
: region (ap-gaungzhou). - Source
Type string - Access source type. Valid values: net|template|instance|resourcegroup|tag|region.
- Order
Index string - Rule priority.
- Port string
- The port to apply access control rules. Valid values:
-1/-1
: all ports,80
: port 80. - Protocol string
- Protocol. TCP/UDP/ICMP/ANY.
- Service
Template stringId - Parameter template ID of port and protocol type; mutually exclusive with Protocol and Port.
- description String
- Description.
- dest
Content String - Destination example:
net
: IP/CIDR (192.168.0.2);template
: parameter template (ipm-dyodhpby);instance
: asset instance (ins-123456);resourcegroup
: asset group (/all groups/group 1/subgroup 1);tag
: resource tag ({"Key":"tag key","Value":"tag value"});region
: region (ap-gaungzhou). - dest
Type String - Access destination type. Valid values: net|template|instance|resourcegroup|tag|region.
- rule
Action String - The action that Cloud Firewall performs on the traffic. Valid values:
accept
: allow,drop
: deny. - source
Content String - Source example:
net
: IP/CIDR (192.168.0.2);template
: parameter template (ipm-dyodhpby);instance
: asset instance (ins-123456);resourcegroup
: asset group (/all groups/group 1/subgroup 1);tag
: resource tag ({"Key":"tag key","Value":"tag value"});region
: region (ap-gaungzhou). - source
Type String - Access source type. Valid values: net|template|instance|resourcegroup|tag|region.
- order
Index String - Rule priority.
- port String
- The port to apply access control rules. Valid values:
-1/-1
: all ports,80
: port 80. - protocol String
- Protocol. TCP/UDP/ICMP/ANY.
- service
Template StringId - Parameter template ID of port and protocol type; mutually exclusive with Protocol and Port.
- description string
- Description.
- dest
Content string - Destination example:
net
: IP/CIDR (192.168.0.2);template
: parameter template (ipm-dyodhpby);instance
: asset instance (ins-123456);resourcegroup
: asset group (/all groups/group 1/subgroup 1);tag
: resource tag ({"Key":"tag key","Value":"tag value"});region
: region (ap-gaungzhou). - dest
Type string - Access destination type. Valid values: net|template|instance|resourcegroup|tag|region.
- rule
Action string - The action that Cloud Firewall performs on the traffic. Valid values:
accept
: allow,drop
: deny. - source
Content string - Source example:
net
: IP/CIDR (192.168.0.2);template
: parameter template (ipm-dyodhpby);instance
: asset instance (ins-123456);resourcegroup
: asset group (/all groups/group 1/subgroup 1);tag
: resource tag ({"Key":"tag key","Value":"tag value"});region
: region (ap-gaungzhou). - source
Type string - Access source type. Valid values: net|template|instance|resourcegroup|tag|region.
- order
Index string - Rule priority.
- port string
- The port to apply access control rules. Valid values:
-1/-1
: all ports,80
: port 80. - protocol string
- Protocol. TCP/UDP/ICMP/ANY.
- service
Template stringId - Parameter template ID of port and protocol type; mutually exclusive with Protocol and Port.
- description str
- Description.
- dest_
content str - Destination example:
net
: IP/CIDR (192.168.0.2);template
: parameter template (ipm-dyodhpby);instance
: asset instance (ins-123456);resourcegroup
: asset group (/all groups/group 1/subgroup 1);tag
: resource tag ({"Key":"tag key","Value":"tag value"});region
: region (ap-gaungzhou). - dest_
type str - Access destination type. Valid values: net|template|instance|resourcegroup|tag|region.
- rule_
action str - The action that Cloud Firewall performs on the traffic. Valid values:
accept
: allow,drop
: deny. - source_
content str - Source example:
net
: IP/CIDR (192.168.0.2);template
: parameter template (ipm-dyodhpby);instance
: asset instance (ins-123456);resourcegroup
: asset group (/all groups/group 1/subgroup 1);tag
: resource tag ({"Key":"tag key","Value":"tag value"});region
: region (ap-gaungzhou). - source_
type str - Access source type. Valid values: net|template|instance|resourcegroup|tag|region.
- order_
index str - Rule priority.
- port str
- The port to apply access control rules. Valid values:
-1/-1
: all ports,80
: port 80. - protocol str
- Protocol. TCP/UDP/ICMP/ANY.
- service_
template_ strid - Parameter template ID of port and protocol type; mutually exclusive with Protocol and Port.
- description String
- Description.
- dest
Content String - Destination example:
net
: IP/CIDR (192.168.0.2);template
: parameter template (ipm-dyodhpby);instance
: asset instance (ins-123456);resourcegroup
: asset group (/all groups/group 1/subgroup 1);tag
: resource tag ({"Key":"tag key","Value":"tag value"});region
: region (ap-gaungzhou). - dest
Type String - Access destination type. Valid values: net|template|instance|resourcegroup|tag|region.
- rule
Action String - The action that Cloud Firewall performs on the traffic. Valid values:
accept
: allow,drop
: deny. - source
Content String - Source example:
net
: IP/CIDR (192.168.0.2);template
: parameter template (ipm-dyodhpby);instance
: asset instance (ins-123456);resourcegroup
: asset group (/all groups/group 1/subgroup 1);tag
: resource tag ({"Key":"tag key","Value":"tag value"});region
: region (ap-gaungzhou). - source
Type String - Access source type. Valid values: net|template|instance|resourcegroup|tag|region.
- order
Index String - Rule priority.
- port String
- The port to apply access control rules. Valid values:
-1/-1
: all ports,80
: port 80. - protocol String
- Protocol. TCP/UDP/ICMP/ANY.
- service
Template StringId - Parameter template ID of port and protocol type; mutually exclusive with Protocol and Port.
Import
cfw sg_rule can be imported using the id, e.g.
$ pulumi import tencentcloud:index/sgRule:SgRule sg_rule rule_id
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.