published on Tuesday, Oct 27, 2026 by ucloud
published on Tuesday, Oct 27, 2026 by ucloud
Provides a rule of a security group. One resource manages exactly one rule, which is what lets a rule be changed in place, imported and destroyed without touching the rest of the group.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as ucloud from "@pulumi/ucloud";
const example = new ucloud.SecGroupRule("example", {
secGroupId: exampleUcloudSecGroup.id,
direction: "Ingress",
protocolType: "TCP",
dstPort: "80,443",
ipRange: "0.0.0.0/0",
ruleAction: "Accept",
priority: 60,
remark: "web",
});
import pulumi
import pulumi_ucloud as ucloud
example = ucloud.SecGroupRule("example",
sec_group_id=example_ucloud_sec_group["id"],
direction="Ingress",
protocol_type="TCP",
dst_port="80,443",
ip_range="0.0.0.0/0",
rule_action="Accept",
priority=60,
remark="web")
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/ucloud/ucloud"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := ucloud.NewSecGroupRule(ctx, "example", &ucloud.SecGroupRuleArgs{
SecGroupId: pulumi.Any(exampleUcloudSecGroup.Id),
Direction: pulumi.String("Ingress"),
ProtocolType: pulumi.String("TCP"),
DstPort: pulumi.String("80,443"),
IpRange: pulumi.String("0.0.0.0/0"),
RuleAction: pulumi.String("Accept"),
Priority: pulumi.Float64(60),
Remark: pulumi.String("web"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Ucloud = Pulumi.Ucloud;
return await Deployment.RunAsync(() =>
{
var example = new Ucloud.SecGroupRule("example", new()
{
SecGroupId = exampleUcloudSecGroup.Id,
Direction = "Ingress",
ProtocolType = "TCP",
DstPort = "80,443",
IpRange = "0.0.0.0/0",
RuleAction = "Accept",
Priority = 60,
Remark = "web",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.ucloud.SecGroupRule;
import com.pulumi.ucloud.SecGroupRuleArgs;
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 example = new SecGroupRule("example", SecGroupRuleArgs.builder()
.secGroupId(exampleUcloudSecGroup.id())
.direction("Ingress")
.protocolType("TCP")
.dstPort("80,443")
.ipRange("0.0.0.0/0")
.ruleAction("Accept")
.priority(60.0)
.remark("web")
.build());
}
}
resources:
example:
type: ucloud:SecGroupRule
properties:
secGroupId: ${exampleUcloudSecGroup.id}
direction: Ingress
protocolType: TCP
dstPort: 80,443
ipRange: 0.0.0.0/0
ruleAction: Accept
priority: 60
remark: web
Example coming soon!
Create SecGroupRule Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new SecGroupRule(name: string, args: SecGroupRuleArgs, opts?: CustomResourceOptions);@overload
def SecGroupRule(resource_name: str,
args: SecGroupRuleArgs,
opts: Optional[ResourceOptions] = None)
@overload
def SecGroupRule(resource_name: str,
opts: Optional[ResourceOptions] = None,
direction: Optional[str] = None,
ip_range: Optional[str] = None,
priority: Optional[float] = None,
protocol_type: Optional[str] = None,
rule_action: Optional[str] = None,
sec_group_id: Optional[str] = None,
dst_port: Optional[str] = None,
remark: Optional[str] = None,
sec_group_rule_id: Optional[str] = None)func NewSecGroupRule(ctx *Context, name string, args SecGroupRuleArgs, opts ...ResourceOption) (*SecGroupRule, error)public SecGroupRule(string name, SecGroupRuleArgs args, CustomResourceOptions? opts = null)
public SecGroupRule(String name, SecGroupRuleArgs args)
public SecGroupRule(String name, SecGroupRuleArgs args, CustomResourceOptions options)
type: ucloud:SecGroupRule
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
resource "ucloud_sec_group_rule" "name" {
# resource properties
}Parameters
- name string
- The unique name of the resource.
- args SecGroupRuleArgs
- 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 SecGroupRuleArgs
- 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 SecGroupRuleArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args SecGroupRuleArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args SecGroupRuleArgs
- 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 secGroupRuleResource = new Ucloud.SecGroupRule("secGroupRuleResource", new()
{
Direction = "string",
IpRange = "string",
Priority = 0.0,
ProtocolType = "string",
RuleAction = "string",
SecGroupId = "string",
DstPort = "string",
Remark = "string",
SecGroupRuleId = "string",
});
example, err := ucloud.NewSecGroupRule(ctx, "secGroupRuleResource", &ucloud.SecGroupRuleArgs{
Direction: pulumi.String("string"),
IpRange: pulumi.String("string"),
Priority: pulumi.Float64(0),
ProtocolType: pulumi.String("string"),
RuleAction: pulumi.String("string"),
SecGroupId: pulumi.String("string"),
DstPort: pulumi.String("string"),
Remark: pulumi.String("string"),
SecGroupRuleId: pulumi.String("string"),
})
resource "ucloud_sec_group_rule" "secGroupRuleResource" {
lifecycle {
create_before_destroy = true
}
direction = "string"
ip_range = "string"
priority = 0
protocol_type = "string"
rule_action = "string"
sec_group_id = "string"
dst_port = "string"
remark = "string"
sec_group_rule_id = "string"
}
var secGroupRuleResource = new SecGroupRule("secGroupRuleResource", SecGroupRuleArgs.builder()
.direction("string")
.ipRange("string")
.priority(0.0)
.protocolType("string")
.ruleAction("string")
.secGroupId("string")
.dstPort("string")
.remark("string")
.secGroupRuleId("string")
.build());
sec_group_rule_resource = ucloud.SecGroupRule("secGroupRuleResource",
direction="string",
ip_range="string",
priority=float(0),
protocol_type="string",
rule_action="string",
sec_group_id="string",
dst_port="string",
remark="string",
sec_group_rule_id="string")
const secGroupRuleResource = new ucloud.SecGroupRule("secGroupRuleResource", {
direction: "string",
ipRange: "string",
priority: 0,
protocolType: "string",
ruleAction: "string",
secGroupId: "string",
dstPort: "string",
remark: "string",
secGroupRuleId: "string",
});
type: ucloud:SecGroupRule
properties:
direction: string
dstPort: string
ipRange: string
priority: 0
protocolType: string
remark: string
ruleAction: string
secGroupId: string
secGroupRuleId: string
SecGroupRule 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 SecGroupRule resource accepts the following input properties:
- Direction string
- The direction of the rule. Possible values are:
Ingress,Egress. - Ip
Range string - The source the rule applies to, in one of three mutually exclusive forms: a comma separated list of CIDR blocks (e.g.
10.0.0.0/8or10.0.0.0/8,192.168.0.0/16), a single security group ID (e.g.secgroup-abc123), or a comma separated list of prefix list IDs (e.g.pl-abc123,pl-def456). The forms cannot be mixed. Whatever the form carries, it is one value of a single rule rather than a way to add several: exactly one rule is created. - Priority double
- The priority of the rule, between
1and200. A smaller value means a higher priority. - Protocol
Type string - The protocol type. Possible values are:
TCP,UDP,ICMP,ICMPv6,ALL. - Rule
Action string - The action of the rule. Possible values are:
Accept,Drop. - Sec
Group stringId - The ID of the security group the rule belongs to, e.g.
secgroup-abc123. The group is the rule's parent rather than one of its attributes, so changing it rebuilds the rule. - Dst
Port string - The destination port, a comma separated list where each item is a single port or a
from-torange, e.g.80,443or443,2000-10000. Required whenprotocol_typeisTCPorUDP, and must be omitted when it isICMP,ICMPv6orALL, where a port carries no meaning. - Remark string
- The remarks of the rule. (Default:
""). - Sec
Group stringRule Id - The ID of the rule, assigned by the API.
- Direction string
- The direction of the rule. Possible values are:
Ingress,Egress. - Ip
Range string - The source the rule applies to, in one of three mutually exclusive forms: a comma separated list of CIDR blocks (e.g.
10.0.0.0/8or10.0.0.0/8,192.168.0.0/16), a single security group ID (e.g.secgroup-abc123), or a comma separated list of prefix list IDs (e.g.pl-abc123,pl-def456). The forms cannot be mixed. Whatever the form carries, it is one value of a single rule rather than a way to add several: exactly one rule is created. - Priority float64
- The priority of the rule, between
1and200. A smaller value means a higher priority. - Protocol
Type string - The protocol type. Possible values are:
TCP,UDP,ICMP,ICMPv6,ALL. - Rule
Action string - The action of the rule. Possible values are:
Accept,Drop. - Sec
Group stringId - The ID of the security group the rule belongs to, e.g.
secgroup-abc123. The group is the rule's parent rather than one of its attributes, so changing it rebuilds the rule. - Dst
Port string - The destination port, a comma separated list where each item is a single port or a
from-torange, e.g.80,443or443,2000-10000. Required whenprotocol_typeisTCPorUDP, and must be omitted when it isICMP,ICMPv6orALL, where a port carries no meaning. - Remark string
- The remarks of the rule. (Default:
""). - Sec
Group stringRule Id - The ID of the rule, assigned by the API.
- direction string
- The direction of the rule. Possible values are:
Ingress,Egress. - ip_
range string - The source the rule applies to, in one of three mutually exclusive forms: a comma separated list of CIDR blocks (e.g.
10.0.0.0/8or10.0.0.0/8,192.168.0.0/16), a single security group ID (e.g.secgroup-abc123), or a comma separated list of prefix list IDs (e.g.pl-abc123,pl-def456). The forms cannot be mixed. Whatever the form carries, it is one value of a single rule rather than a way to add several: exactly one rule is created. - priority number
- The priority of the rule, between
1and200. A smaller value means a higher priority. - protocol_
type string - The protocol type. Possible values are:
TCP,UDP,ICMP,ICMPv6,ALL. - rule_
action string - The action of the rule. Possible values are:
Accept,Drop. - sec_
group_ stringid - The ID of the security group the rule belongs to, e.g.
secgroup-abc123. The group is the rule's parent rather than one of its attributes, so changing it rebuilds the rule. - dst_
port string - The destination port, a comma separated list where each item is a single port or a
from-torange, e.g.80,443or443,2000-10000. Required whenprotocol_typeisTCPorUDP, and must be omitted when it isICMP,ICMPv6orALL, where a port carries no meaning. - remark string
- The remarks of the rule. (Default:
""). - sec_
group_ stringrule_ id - The ID of the rule, assigned by the API.
- direction String
- The direction of the rule. Possible values are:
Ingress,Egress. - ip
Range String - The source the rule applies to, in one of three mutually exclusive forms: a comma separated list of CIDR blocks (e.g.
10.0.0.0/8or10.0.0.0/8,192.168.0.0/16), a single security group ID (e.g.secgroup-abc123), or a comma separated list of prefix list IDs (e.g.pl-abc123,pl-def456). The forms cannot be mixed. Whatever the form carries, it is one value of a single rule rather than a way to add several: exactly one rule is created. - priority Double
- The priority of the rule, between
1and200. A smaller value means a higher priority. - protocol
Type String - The protocol type. Possible values are:
TCP,UDP,ICMP,ICMPv6,ALL. - rule
Action String - The action of the rule. Possible values are:
Accept,Drop. - sec
Group StringId - The ID of the security group the rule belongs to, e.g.
secgroup-abc123. The group is the rule's parent rather than one of its attributes, so changing it rebuilds the rule. - dst
Port String - The destination port, a comma separated list where each item is a single port or a
from-torange, e.g.80,443or443,2000-10000. Required whenprotocol_typeisTCPorUDP, and must be omitted when it isICMP,ICMPv6orALL, where a port carries no meaning. - remark String
- The remarks of the rule. (Default:
""). - sec
Group StringRule Id - The ID of the rule, assigned by the API.
- direction string
- The direction of the rule. Possible values are:
Ingress,Egress. - ip
Range string - The source the rule applies to, in one of three mutually exclusive forms: a comma separated list of CIDR blocks (e.g.
10.0.0.0/8or10.0.0.0/8,192.168.0.0/16), a single security group ID (e.g.secgroup-abc123), or a comma separated list of prefix list IDs (e.g.pl-abc123,pl-def456). The forms cannot be mixed. Whatever the form carries, it is one value of a single rule rather than a way to add several: exactly one rule is created. - priority number
- The priority of the rule, between
1and200. A smaller value means a higher priority. - protocol
Type string - The protocol type. Possible values are:
TCP,UDP,ICMP,ICMPv6,ALL. - rule
Action string - The action of the rule. Possible values are:
Accept,Drop. - sec
Group stringId - The ID of the security group the rule belongs to, e.g.
secgroup-abc123. The group is the rule's parent rather than one of its attributes, so changing it rebuilds the rule. - dst
Port string - The destination port, a comma separated list where each item is a single port or a
from-torange, e.g.80,443or443,2000-10000. Required whenprotocol_typeisTCPorUDP, and must be omitted when it isICMP,ICMPv6orALL, where a port carries no meaning. - remark string
- The remarks of the rule. (Default:
""). - sec
Group stringRule Id - The ID of the rule, assigned by the API.
- direction str
- The direction of the rule. Possible values are:
Ingress,Egress. - ip_
range str - The source the rule applies to, in one of three mutually exclusive forms: a comma separated list of CIDR blocks (e.g.
10.0.0.0/8or10.0.0.0/8,192.168.0.0/16), a single security group ID (e.g.secgroup-abc123), or a comma separated list of prefix list IDs (e.g.pl-abc123,pl-def456). The forms cannot be mixed. Whatever the form carries, it is one value of a single rule rather than a way to add several: exactly one rule is created. - priority float
- The priority of the rule, between
1and200. A smaller value means a higher priority. - protocol_
type str - The protocol type. Possible values are:
TCP,UDP,ICMP,ICMPv6,ALL. - rule_
action str - The action of the rule. Possible values are:
Accept,Drop. - sec_
group_ strid - The ID of the security group the rule belongs to, e.g.
secgroup-abc123. The group is the rule's parent rather than one of its attributes, so changing it rebuilds the rule. - dst_
port str - The destination port, a comma separated list where each item is a single port or a
from-torange, e.g.80,443or443,2000-10000. Required whenprotocol_typeisTCPorUDP, and must be omitted when it isICMP,ICMPv6orALL, where a port carries no meaning. - remark str
- The remarks of the rule. (Default:
""). - sec_
group_ strrule_ id - The ID of the rule, assigned by the API.
- direction String
- The direction of the rule. Possible values are:
Ingress,Egress. - ip
Range String - The source the rule applies to, in one of three mutually exclusive forms: a comma separated list of CIDR blocks (e.g.
10.0.0.0/8or10.0.0.0/8,192.168.0.0/16), a single security group ID (e.g.secgroup-abc123), or a comma separated list of prefix list IDs (e.g.pl-abc123,pl-def456). The forms cannot be mixed. Whatever the form carries, it is one value of a single rule rather than a way to add several: exactly one rule is created. - priority Number
- The priority of the rule, between
1and200. A smaller value means a higher priority. - protocol
Type String - The protocol type. Possible values are:
TCP,UDP,ICMP,ICMPv6,ALL. - rule
Action String - The action of the rule. Possible values are:
Accept,Drop. - sec
Group StringId - The ID of the security group the rule belongs to, e.g.
secgroup-abc123. The group is the rule's parent rather than one of its attributes, so changing it rebuilds the rule. - dst
Port String - The destination port, a comma separated list where each item is a single port or a
from-torange, e.g.80,443or443,2000-10000. Required whenprotocol_typeisTCPorUDP, and must be omitted when it isICMP,ICMPv6orALL, where a port carries no meaning. - remark String
- The remarks of the rule. (Default:
""). - sec
Group StringRule Id - The ID of the rule, assigned by the API.
Outputs
All input properties are implicitly available as output properties. Additionally, the SecGroupRule 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 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 SecGroupRule Resource
Get an existing SecGroupRule 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?: SecGroupRuleState, opts?: CustomResourceOptions): SecGroupRule@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
direction: Optional[str] = None,
dst_port: Optional[str] = None,
ip_range: Optional[str] = None,
priority: Optional[float] = None,
protocol_type: Optional[str] = None,
remark: Optional[str] = None,
rule_action: Optional[str] = None,
sec_group_id: Optional[str] = None,
sec_group_rule_id: Optional[str] = None) -> SecGroupRulefunc GetSecGroupRule(ctx *Context, name string, id IDInput, state *SecGroupRuleState, opts ...ResourceOption) (*SecGroupRule, error)public static SecGroupRule Get(string name, Input<string> id, SecGroupRuleState? state, CustomResourceOptions? opts = null)public static SecGroupRule get(String name, Output<String> id, SecGroupRuleState state, CustomResourceOptions options)resources: _: type: ucloud:SecGroupRule get: id: ${id}import {
to = ucloud_sec_group_rule.example
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.
- Direction string
- The direction of the rule. Possible values are:
Ingress,Egress. - Dst
Port string - The destination port, a comma separated list where each item is a single port or a
from-torange, e.g.80,443or443,2000-10000. Required whenprotocol_typeisTCPorUDP, and must be omitted when it isICMP,ICMPv6orALL, where a port carries no meaning. - Ip
Range string - The source the rule applies to, in one of three mutually exclusive forms: a comma separated list of CIDR blocks (e.g.
10.0.0.0/8or10.0.0.0/8,192.168.0.0/16), a single security group ID (e.g.secgroup-abc123), or a comma separated list of prefix list IDs (e.g.pl-abc123,pl-def456). The forms cannot be mixed. Whatever the form carries, it is one value of a single rule rather than a way to add several: exactly one rule is created. - Priority double
- The priority of the rule, between
1and200. A smaller value means a higher priority. - Protocol
Type string - The protocol type. Possible values are:
TCP,UDP,ICMP,ICMPv6,ALL. - Remark string
- The remarks of the rule. (Default:
""). - Rule
Action string - The action of the rule. Possible values are:
Accept,Drop. - Sec
Group stringId - The ID of the security group the rule belongs to, e.g.
secgroup-abc123. The group is the rule's parent rather than one of its attributes, so changing it rebuilds the rule. - Sec
Group stringRule Id - The ID of the rule, assigned by the API.
- Direction string
- The direction of the rule. Possible values are:
Ingress,Egress. - Dst
Port string - The destination port, a comma separated list where each item is a single port or a
from-torange, e.g.80,443or443,2000-10000. Required whenprotocol_typeisTCPorUDP, and must be omitted when it isICMP,ICMPv6orALL, where a port carries no meaning. - Ip
Range string - The source the rule applies to, in one of three mutually exclusive forms: a comma separated list of CIDR blocks (e.g.
10.0.0.0/8or10.0.0.0/8,192.168.0.0/16), a single security group ID (e.g.secgroup-abc123), or a comma separated list of prefix list IDs (e.g.pl-abc123,pl-def456). The forms cannot be mixed. Whatever the form carries, it is one value of a single rule rather than a way to add several: exactly one rule is created. - Priority float64
- The priority of the rule, between
1and200. A smaller value means a higher priority. - Protocol
Type string - The protocol type. Possible values are:
TCP,UDP,ICMP,ICMPv6,ALL. - Remark string
- The remarks of the rule. (Default:
""). - Rule
Action string - The action of the rule. Possible values are:
Accept,Drop. - Sec
Group stringId - The ID of the security group the rule belongs to, e.g.
secgroup-abc123. The group is the rule's parent rather than one of its attributes, so changing it rebuilds the rule. - Sec
Group stringRule Id - The ID of the rule, assigned by the API.
- direction string
- The direction of the rule. Possible values are:
Ingress,Egress. - dst_
port string - The destination port, a comma separated list where each item is a single port or a
from-torange, e.g.80,443or443,2000-10000. Required whenprotocol_typeisTCPorUDP, and must be omitted when it isICMP,ICMPv6orALL, where a port carries no meaning. - ip_
range string - The source the rule applies to, in one of three mutually exclusive forms: a comma separated list of CIDR blocks (e.g.
10.0.0.0/8or10.0.0.0/8,192.168.0.0/16), a single security group ID (e.g.secgroup-abc123), or a comma separated list of prefix list IDs (e.g.pl-abc123,pl-def456). The forms cannot be mixed. Whatever the form carries, it is one value of a single rule rather than a way to add several: exactly one rule is created. - priority number
- The priority of the rule, between
1and200. A smaller value means a higher priority. - protocol_
type string - The protocol type. Possible values are:
TCP,UDP,ICMP,ICMPv6,ALL. - remark string
- The remarks of the rule. (Default:
""). - rule_
action string - The action of the rule. Possible values are:
Accept,Drop. - sec_
group_ stringid - The ID of the security group the rule belongs to, e.g.
secgroup-abc123. The group is the rule's parent rather than one of its attributes, so changing it rebuilds the rule. - sec_
group_ stringrule_ id - The ID of the rule, assigned by the API.
- direction String
- The direction of the rule. Possible values are:
Ingress,Egress. - dst
Port String - The destination port, a comma separated list where each item is a single port or a
from-torange, e.g.80,443or443,2000-10000. Required whenprotocol_typeisTCPorUDP, and must be omitted when it isICMP,ICMPv6orALL, where a port carries no meaning. - ip
Range String - The source the rule applies to, in one of three mutually exclusive forms: a comma separated list of CIDR blocks (e.g.
10.0.0.0/8or10.0.0.0/8,192.168.0.0/16), a single security group ID (e.g.secgroup-abc123), or a comma separated list of prefix list IDs (e.g.pl-abc123,pl-def456). The forms cannot be mixed. Whatever the form carries, it is one value of a single rule rather than a way to add several: exactly one rule is created. - priority Double
- The priority of the rule, between
1and200. A smaller value means a higher priority. - protocol
Type String - The protocol type. Possible values are:
TCP,UDP,ICMP,ICMPv6,ALL. - remark String
- The remarks of the rule. (Default:
""). - rule
Action String - The action of the rule. Possible values are:
Accept,Drop. - sec
Group StringId - The ID of the security group the rule belongs to, e.g.
secgroup-abc123. The group is the rule's parent rather than one of its attributes, so changing it rebuilds the rule. - sec
Group StringRule Id - The ID of the rule, assigned by the API.
- direction string
- The direction of the rule. Possible values are:
Ingress,Egress. - dst
Port string - The destination port, a comma separated list where each item is a single port or a
from-torange, e.g.80,443or443,2000-10000. Required whenprotocol_typeisTCPorUDP, and must be omitted when it isICMP,ICMPv6orALL, where a port carries no meaning. - ip
Range string - The source the rule applies to, in one of three mutually exclusive forms: a comma separated list of CIDR blocks (e.g.
10.0.0.0/8or10.0.0.0/8,192.168.0.0/16), a single security group ID (e.g.secgroup-abc123), or a comma separated list of prefix list IDs (e.g.pl-abc123,pl-def456). The forms cannot be mixed. Whatever the form carries, it is one value of a single rule rather than a way to add several: exactly one rule is created. - priority number
- The priority of the rule, between
1and200. A smaller value means a higher priority. - protocol
Type string - The protocol type. Possible values are:
TCP,UDP,ICMP,ICMPv6,ALL. - remark string
- The remarks of the rule. (Default:
""). - rule
Action string - The action of the rule. Possible values are:
Accept,Drop. - sec
Group stringId - The ID of the security group the rule belongs to, e.g.
secgroup-abc123. The group is the rule's parent rather than one of its attributes, so changing it rebuilds the rule. - sec
Group stringRule Id - The ID of the rule, assigned by the API.
- direction str
- The direction of the rule. Possible values are:
Ingress,Egress. - dst_
port str - The destination port, a comma separated list where each item is a single port or a
from-torange, e.g.80,443or443,2000-10000. Required whenprotocol_typeisTCPorUDP, and must be omitted when it isICMP,ICMPv6orALL, where a port carries no meaning. - ip_
range str - The source the rule applies to, in one of three mutually exclusive forms: a comma separated list of CIDR blocks (e.g.
10.0.0.0/8or10.0.0.0/8,192.168.0.0/16), a single security group ID (e.g.secgroup-abc123), or a comma separated list of prefix list IDs (e.g.pl-abc123,pl-def456). The forms cannot be mixed. Whatever the form carries, it is one value of a single rule rather than a way to add several: exactly one rule is created. - priority float
- The priority of the rule, between
1and200. A smaller value means a higher priority. - protocol_
type str - The protocol type. Possible values are:
TCP,UDP,ICMP,ICMPv6,ALL. - remark str
- The remarks of the rule. (Default:
""). - rule_
action str - The action of the rule. Possible values are:
Accept,Drop. - sec_
group_ strid - The ID of the security group the rule belongs to, e.g.
secgroup-abc123. The group is the rule's parent rather than one of its attributes, so changing it rebuilds the rule. - sec_
group_ strrule_ id - The ID of the rule, assigned by the API.
- direction String
- The direction of the rule. Possible values are:
Ingress,Egress. - dst
Port String - The destination port, a comma separated list where each item is a single port or a
from-torange, e.g.80,443or443,2000-10000. Required whenprotocol_typeisTCPorUDP, and must be omitted when it isICMP,ICMPv6orALL, where a port carries no meaning. - ip
Range String - The source the rule applies to, in one of three mutually exclusive forms: a comma separated list of CIDR blocks (e.g.
10.0.0.0/8or10.0.0.0/8,192.168.0.0/16), a single security group ID (e.g.secgroup-abc123), or a comma separated list of prefix list IDs (e.g.pl-abc123,pl-def456). The forms cannot be mixed. Whatever the form carries, it is one value of a single rule rather than a way to add several: exactly one rule is created. - priority Number
- The priority of the rule, between
1and200. A smaller value means a higher priority. - protocol
Type String - The protocol type. Possible values are:
TCP,UDP,ICMP,ICMPv6,ALL. - remark String
- The remarks of the rule. (Default:
""). - rule
Action String - The action of the rule. Possible values are:
Accept,Drop. - sec
Group StringId - The ID of the security group the rule belongs to, e.g.
secgroup-abc123. The group is the rule's parent rather than one of its attributes, so changing it rebuilds the rule. - sec
Group StringRule Id - The ID of the rule, assigned by the API.
Import
Security Group Rule can be imported using the ID of its group and the ID of the rule, separated by a slash, e.g.
$ pulumi import ucloud:index/secGroupRule:SecGroupRule example secgroup-abc123456/rule-def789012
~> Note The group has to be part of the import ID because the API cannot look a rule up from its own ID alone.
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- ucloud ucloud/terraform-provider-ucloud
- License
- Notes
- This Pulumi package is based on the
ucloudTerraform Provider.
published on Tuesday, Oct 27, 2026 by ucloud