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

tencentcloud.SecurityGroupRule

Explore with Pulumi AI

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

    Create SecurityGroupRule Resource

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

    Constructor syntax

    new SecurityGroupRule(name: string, args: SecurityGroupRuleArgs, opts?: CustomResourceOptions);
    @overload
    def SecurityGroupRule(resource_name: str,
                          args: SecurityGroupRuleArgs,
                          opts: Optional[ResourceOptions] = None)
    
    @overload
    def SecurityGroupRule(resource_name: str,
                          opts: Optional[ResourceOptions] = None,
                          policy: Optional[str] = None,
                          security_group_id: Optional[str] = None,
                          type: Optional[str] = None,
                          address_template: Optional[SecurityGroupRuleAddressTemplateArgs] = None,
                          cidr_ip: Optional[str] = None,
                          description: Optional[str] = None,
                          ip_protocol: Optional[str] = None,
                          policy_index: Optional[float] = None,
                          port_range: Optional[str] = None,
                          protocol_template: Optional[SecurityGroupRuleProtocolTemplateArgs] = None,
                          security_group_rule_id: Optional[str] = None,
                          source_sgid: Optional[str] = None)
    func NewSecurityGroupRule(ctx *Context, name string, args SecurityGroupRuleArgs, opts ...ResourceOption) (*SecurityGroupRule, error)
    public SecurityGroupRule(string name, SecurityGroupRuleArgs args, CustomResourceOptions? opts = null)
    public SecurityGroupRule(String name, SecurityGroupRuleArgs args)
    public SecurityGroupRule(String name, SecurityGroupRuleArgs args, CustomResourceOptions options)
    
    type: tencentcloud:SecurityGroupRule
    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 SecurityGroupRuleArgs
    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 SecurityGroupRuleArgs
    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 SecurityGroupRuleArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args SecurityGroupRuleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args SecurityGroupRuleArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

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

    Policy string
    Rule policy of security group. Valid values: ACCEPT and DROP.
    SecurityGroupId string
    ID of the security group to be queried.
    Type string
    Type of the security group rule. Valid values: ingress and egress.
    AddressTemplate SecurityGroupRuleAddressTemplate
    ID of the address template, and confilicts with source_sgid and cidr_ip.
    CidrIp string
    An IP address network or segment, and conflict with source_sgid and address_template.
    Description string
    Description of the security group rule.
    IpProtocol string
    Type of IP protocol. Valid values: TCP, UDP, ICMP, ICMPv6 and ALL. Default to all types protocol, and conflicts with protocol_template.
    PolicyIndex double
    The security group rule index number, the value of which dynamically changes as the security group rule changes.
    PortRange string
    Range of the port. The available value can be one, multiple or one segment. E.g. 80, 80,90 and 80-90. Default to all ports, and confilicts with protocol_template.
    ProtocolTemplate SecurityGroupRuleProtocolTemplate
    ID of the address template, and conflict with ip_protocol, port_range.
    SecurityGroupRuleId string
    SourceSgid string
    ID of the nested security group, and conflicts with cidr_ip and address_template.
    Policy string
    Rule policy of security group. Valid values: ACCEPT and DROP.
    SecurityGroupId string
    ID of the security group to be queried.
    Type string
    Type of the security group rule. Valid values: ingress and egress.
    AddressTemplate SecurityGroupRuleAddressTemplateArgs
    ID of the address template, and confilicts with source_sgid and cidr_ip.
    CidrIp string
    An IP address network or segment, and conflict with source_sgid and address_template.
    Description string
    Description of the security group rule.
    IpProtocol string
    Type of IP protocol. Valid values: TCP, UDP, ICMP, ICMPv6 and ALL. Default to all types protocol, and conflicts with protocol_template.
    PolicyIndex float64
    The security group rule index number, the value of which dynamically changes as the security group rule changes.
    PortRange string
    Range of the port. The available value can be one, multiple or one segment. E.g. 80, 80,90 and 80-90. Default to all ports, and confilicts with protocol_template.
    ProtocolTemplate SecurityGroupRuleProtocolTemplateArgs
    ID of the address template, and conflict with ip_protocol, port_range.
    SecurityGroupRuleId string
    SourceSgid string
    ID of the nested security group, and conflicts with cidr_ip and address_template.
    policy String
    Rule policy of security group. Valid values: ACCEPT and DROP.
    securityGroupId String
    ID of the security group to be queried.
    type String
    Type of the security group rule. Valid values: ingress and egress.
    addressTemplate SecurityGroupRuleAddressTemplate
    ID of the address template, and confilicts with source_sgid and cidr_ip.
    cidrIp String
    An IP address network or segment, and conflict with source_sgid and address_template.
    description String
    Description of the security group rule.
    ipProtocol String
    Type of IP protocol. Valid values: TCP, UDP, ICMP, ICMPv6 and ALL. Default to all types protocol, and conflicts with protocol_template.
    policyIndex Double
    The security group rule index number, the value of which dynamically changes as the security group rule changes.
    portRange String
    Range of the port. The available value can be one, multiple or one segment. E.g. 80, 80,90 and 80-90. Default to all ports, and confilicts with protocol_template.
    protocolTemplate SecurityGroupRuleProtocolTemplate
    ID of the address template, and conflict with ip_protocol, port_range.
    securityGroupRuleId String
    sourceSgid String
    ID of the nested security group, and conflicts with cidr_ip and address_template.
    policy string
    Rule policy of security group. Valid values: ACCEPT and DROP.
    securityGroupId string
    ID of the security group to be queried.
    type string
    Type of the security group rule. Valid values: ingress and egress.
    addressTemplate SecurityGroupRuleAddressTemplate
    ID of the address template, and confilicts with source_sgid and cidr_ip.
    cidrIp string
    An IP address network or segment, and conflict with source_sgid and address_template.
    description string
    Description of the security group rule.
    ipProtocol string
    Type of IP protocol. Valid values: TCP, UDP, ICMP, ICMPv6 and ALL. Default to all types protocol, and conflicts with protocol_template.
    policyIndex number
    The security group rule index number, the value of which dynamically changes as the security group rule changes.
    portRange string
    Range of the port. The available value can be one, multiple or one segment. E.g. 80, 80,90 and 80-90. Default to all ports, and confilicts with protocol_template.
    protocolTemplate SecurityGroupRuleProtocolTemplate
    ID of the address template, and conflict with ip_protocol, port_range.
    securityGroupRuleId string
    sourceSgid string
    ID of the nested security group, and conflicts with cidr_ip and address_template.
    policy str
    Rule policy of security group. Valid values: ACCEPT and DROP.
    security_group_id str
    ID of the security group to be queried.
    type str
    Type of the security group rule. Valid values: ingress and egress.
    address_template SecurityGroupRuleAddressTemplateArgs
    ID of the address template, and confilicts with source_sgid and cidr_ip.
    cidr_ip str
    An IP address network or segment, and conflict with source_sgid and address_template.
    description str
    Description of the security group rule.
    ip_protocol str
    Type of IP protocol. Valid values: TCP, UDP, ICMP, ICMPv6 and ALL. Default to all types protocol, and conflicts with protocol_template.
    policy_index float
    The security group rule index number, the value of which dynamically changes as the security group rule changes.
    port_range str
    Range of the port. The available value can be one, multiple or one segment. E.g. 80, 80,90 and 80-90. Default to all ports, and confilicts with protocol_template.
    protocol_template SecurityGroupRuleProtocolTemplateArgs
    ID of the address template, and conflict with ip_protocol, port_range.
    security_group_rule_id str
    source_sgid str
    ID of the nested security group, and conflicts with cidr_ip and address_template.
    policy String
    Rule policy of security group. Valid values: ACCEPT and DROP.
    securityGroupId String
    ID of the security group to be queried.
    type String
    Type of the security group rule. Valid values: ingress and egress.
    addressTemplate Property Map
    ID of the address template, and confilicts with source_sgid and cidr_ip.
    cidrIp String
    An IP address network or segment, and conflict with source_sgid and address_template.
    description String
    Description of the security group rule.
    ipProtocol String
    Type of IP protocol. Valid values: TCP, UDP, ICMP, ICMPv6 and ALL. Default to all types protocol, and conflicts with protocol_template.
    policyIndex Number
    The security group rule index number, the value of which dynamically changes as the security group rule changes.
    portRange String
    Range of the port. The available value can be one, multiple or one segment. E.g. 80, 80,90 and 80-90. Default to all ports, and confilicts with protocol_template.
    protocolTemplate Property Map
    ID of the address template, and conflict with ip_protocol, port_range.
    securityGroupRuleId String
    sourceSgid String
    ID of the nested security group, and conflicts with cidr_ip and address_template.

    Outputs

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

    Get an existing SecurityGroupRule 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?: SecurityGroupRuleState, opts?: CustomResourceOptions): SecurityGroupRule
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            address_template: Optional[SecurityGroupRuleAddressTemplateArgs] = None,
            cidr_ip: Optional[str] = None,
            description: Optional[str] = None,
            ip_protocol: Optional[str] = None,
            policy: Optional[str] = None,
            policy_index: Optional[float] = None,
            port_range: Optional[str] = None,
            protocol_template: Optional[SecurityGroupRuleProtocolTemplateArgs] = None,
            security_group_id: Optional[str] = None,
            security_group_rule_id: Optional[str] = None,
            source_sgid: Optional[str] = None,
            type: Optional[str] = None) -> SecurityGroupRule
    func GetSecurityGroupRule(ctx *Context, name string, id IDInput, state *SecurityGroupRuleState, opts ...ResourceOption) (*SecurityGroupRule, error)
    public static SecurityGroupRule Get(string name, Input<string> id, SecurityGroupRuleState? state, CustomResourceOptions? opts = null)
    public static SecurityGroupRule get(String name, Output<String> id, SecurityGroupRuleState state, CustomResourceOptions options)
    resources:  _:    type: tencentcloud:SecurityGroupRule    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:
    AddressTemplate SecurityGroupRuleAddressTemplate
    ID of the address template, and confilicts with source_sgid and cidr_ip.
    CidrIp string
    An IP address network or segment, and conflict with source_sgid and address_template.
    Description string
    Description of the security group rule.
    IpProtocol string
    Type of IP protocol. Valid values: TCP, UDP, ICMP, ICMPv6 and ALL. Default to all types protocol, and conflicts with protocol_template.
    Policy string
    Rule policy of security group. Valid values: ACCEPT and DROP.
    PolicyIndex double
    The security group rule index number, the value of which dynamically changes as the security group rule changes.
    PortRange string
    Range of the port. The available value can be one, multiple or one segment. E.g. 80, 80,90 and 80-90. Default to all ports, and confilicts with protocol_template.
    ProtocolTemplate SecurityGroupRuleProtocolTemplate
    ID of the address template, and conflict with ip_protocol, port_range.
    SecurityGroupId string
    ID of the security group to be queried.
    SecurityGroupRuleId string
    SourceSgid string
    ID of the nested security group, and conflicts with cidr_ip and address_template.
    Type string
    Type of the security group rule. Valid values: ingress and egress.
    AddressTemplate SecurityGroupRuleAddressTemplateArgs
    ID of the address template, and confilicts with source_sgid and cidr_ip.
    CidrIp string
    An IP address network or segment, and conflict with source_sgid and address_template.
    Description string
    Description of the security group rule.
    IpProtocol string
    Type of IP protocol. Valid values: TCP, UDP, ICMP, ICMPv6 and ALL. Default to all types protocol, and conflicts with protocol_template.
    Policy string
    Rule policy of security group. Valid values: ACCEPT and DROP.
    PolicyIndex float64
    The security group rule index number, the value of which dynamically changes as the security group rule changes.
    PortRange string
    Range of the port. The available value can be one, multiple or one segment. E.g. 80, 80,90 and 80-90. Default to all ports, and confilicts with protocol_template.
    ProtocolTemplate SecurityGroupRuleProtocolTemplateArgs
    ID of the address template, and conflict with ip_protocol, port_range.
    SecurityGroupId string
    ID of the security group to be queried.
    SecurityGroupRuleId string
    SourceSgid string
    ID of the nested security group, and conflicts with cidr_ip and address_template.
    Type string
    Type of the security group rule. Valid values: ingress and egress.
    addressTemplate SecurityGroupRuleAddressTemplate
    ID of the address template, and confilicts with source_sgid and cidr_ip.
    cidrIp String
    An IP address network or segment, and conflict with source_sgid and address_template.
    description String
    Description of the security group rule.
    ipProtocol String
    Type of IP protocol. Valid values: TCP, UDP, ICMP, ICMPv6 and ALL. Default to all types protocol, and conflicts with protocol_template.
    policy String
    Rule policy of security group. Valid values: ACCEPT and DROP.
    policyIndex Double
    The security group rule index number, the value of which dynamically changes as the security group rule changes.
    portRange String
    Range of the port. The available value can be one, multiple or one segment. E.g. 80, 80,90 and 80-90. Default to all ports, and confilicts with protocol_template.
    protocolTemplate SecurityGroupRuleProtocolTemplate
    ID of the address template, and conflict with ip_protocol, port_range.
    securityGroupId String
    ID of the security group to be queried.
    securityGroupRuleId String
    sourceSgid String
    ID of the nested security group, and conflicts with cidr_ip and address_template.
    type String
    Type of the security group rule. Valid values: ingress and egress.
    addressTemplate SecurityGroupRuleAddressTemplate
    ID of the address template, and confilicts with source_sgid and cidr_ip.
    cidrIp string
    An IP address network or segment, and conflict with source_sgid and address_template.
    description string
    Description of the security group rule.
    ipProtocol string
    Type of IP protocol. Valid values: TCP, UDP, ICMP, ICMPv6 and ALL. Default to all types protocol, and conflicts with protocol_template.
    policy string
    Rule policy of security group. Valid values: ACCEPT and DROP.
    policyIndex number
    The security group rule index number, the value of which dynamically changes as the security group rule changes.
    portRange string
    Range of the port. The available value can be one, multiple or one segment. E.g. 80, 80,90 and 80-90. Default to all ports, and confilicts with protocol_template.
    protocolTemplate SecurityGroupRuleProtocolTemplate
    ID of the address template, and conflict with ip_protocol, port_range.
    securityGroupId string
    ID of the security group to be queried.
    securityGroupRuleId string
    sourceSgid string
    ID of the nested security group, and conflicts with cidr_ip and address_template.
    type string
    Type of the security group rule. Valid values: ingress and egress.
    address_template SecurityGroupRuleAddressTemplateArgs
    ID of the address template, and confilicts with source_sgid and cidr_ip.
    cidr_ip str
    An IP address network or segment, and conflict with source_sgid and address_template.
    description str
    Description of the security group rule.
    ip_protocol str
    Type of IP protocol. Valid values: TCP, UDP, ICMP, ICMPv6 and ALL. Default to all types protocol, and conflicts with protocol_template.
    policy str
    Rule policy of security group. Valid values: ACCEPT and DROP.
    policy_index float
    The security group rule index number, the value of which dynamically changes as the security group rule changes.
    port_range str
    Range of the port. The available value can be one, multiple or one segment. E.g. 80, 80,90 and 80-90. Default to all ports, and confilicts with protocol_template.
    protocol_template SecurityGroupRuleProtocolTemplateArgs
    ID of the address template, and conflict with ip_protocol, port_range.
    security_group_id str
    ID of the security group to be queried.
    security_group_rule_id str
    source_sgid str
    ID of the nested security group, and conflicts with cidr_ip and address_template.
    type str
    Type of the security group rule. Valid values: ingress and egress.
    addressTemplate Property Map
    ID of the address template, and confilicts with source_sgid and cidr_ip.
    cidrIp String
    An IP address network or segment, and conflict with source_sgid and address_template.
    description String
    Description of the security group rule.
    ipProtocol String
    Type of IP protocol. Valid values: TCP, UDP, ICMP, ICMPv6 and ALL. Default to all types protocol, and conflicts with protocol_template.
    policy String
    Rule policy of security group. Valid values: ACCEPT and DROP.
    policyIndex Number
    The security group rule index number, the value of which dynamically changes as the security group rule changes.
    portRange String
    Range of the port. The available value can be one, multiple or one segment. E.g. 80, 80,90 and 80-90. Default to all ports, and confilicts with protocol_template.
    protocolTemplate Property Map
    ID of the address template, and conflict with ip_protocol, port_range.
    securityGroupId String
    ID of the security group to be queried.
    securityGroupRuleId String
    sourceSgid String
    ID of the nested security group, and conflicts with cidr_ip and address_template.
    type String
    Type of the security group rule. Valid values: ingress and egress.

    Supporting Types

    SecurityGroupRuleAddressTemplate, SecurityGroupRuleAddressTemplateArgs

    GroupId string
    Address template group ID, conflicts with template_id.
    TemplateId string
    Address template ID, conflicts with group_id.
    GroupId string
    Address template group ID, conflicts with template_id.
    TemplateId string
    Address template ID, conflicts with group_id.
    groupId String
    Address template group ID, conflicts with template_id.
    templateId String
    Address template ID, conflicts with group_id.
    groupId string
    Address template group ID, conflicts with template_id.
    templateId string
    Address template ID, conflicts with group_id.
    group_id str
    Address template group ID, conflicts with template_id.
    template_id str
    Address template ID, conflicts with group_id.
    groupId String
    Address template group ID, conflicts with template_id.
    templateId String
    Address template ID, conflicts with group_id.

    SecurityGroupRuleProtocolTemplate, SecurityGroupRuleProtocolTemplateArgs

    GroupId string
    Address template group ID, conflicts with template_id.
    TemplateId string
    Address template ID, conflicts with group_id.
    GroupId string
    Address template group ID, conflicts with template_id.
    TemplateId string
    Address template ID, conflicts with group_id.
    groupId String
    Address template group ID, conflicts with template_id.
    templateId String
    Address template ID, conflicts with group_id.
    groupId string
    Address template group ID, conflicts with template_id.
    templateId string
    Address template ID, conflicts with group_id.
    group_id str
    Address template group ID, conflicts with template_id.
    template_id str
    Address template ID, conflicts with group_id.
    groupId String
    Address template group ID, conflicts with template_id.
    templateId String
    Address template ID, conflicts with group_id.

    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