UNPKG

@huaweicloudos/pulumi

Version:

A Pulumi package for creating and managing Huaweicloud cloud resources.

374 lines (373 loc) 15.8 kB
import * as pulumi from "@pulumi/pulumi"; /** * Manages a Security Group Rule resource within HuaweiCloud. * * ## Example Usage * ### Create an ingress rule that opens TCP port 8080 with port range parameters * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const securityGroupId = config.requireObject("securityGroupId"); * const test = new huaweicloud.vpc.SecgroupRule("test", { * securityGroupId: securityGroupId, * direction: "ingress", * ethertype: "IPv4", * protocol: "tcp", * portRangeMin: 8080, * portRangeMax: 8080, * remoteIpPrefix: "0.0.0.0/0", * }); * ``` * ### Create an egress rule that opens TCP port 8080 with port range parameters * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const securityGroupId = config.requireObject("securityGroupId"); * const test = new huaweicloud.vpc.SecgroupRule("test", { * securityGroupId: securityGroupId, * direction: "egress", * ethertype: "IPv4", * protocol: "tcp", * portRangeMin: 8080, * portRangeMax: 8080, * remoteIpPrefix: "0.0.0.0/0", * }); * ``` * ### Create an ingress rule that enable the remote address group and open some TCP ports * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const groupName = config.requireObject("groupName"); * const securityGroupId = config.requireObject("securityGroupId"); * const testAddressGroup = new huaweicloud.vpc.AddressGroup("testAddressGroup", {addresses: [ * "192.168.10.12", * "192.168.11.0-192.168.11.240", * ]}); * const testSecgroupRule = new huaweicloud.vpc.SecgroupRule("testSecgroupRule", { * securityGroupId: securityGroupId, * direction: "ingress", * action: "allow", * ethertype: "IPv4", * ports: "80,500,600-800", * protocol: "tcp", * priority: 5, * remoteAddressGroupId: testAddressGroup.id, * }); * ``` * ### Create an egress rule that enable the remote address group and open some TCP ports * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as pulumi from "@huaweicloudos/pulumi"; * * const config = new pulumi.Config(); * const groupName = config.requireObject("groupName"); * const securityGroupId = config.requireObject("securityGroupId"); * const testAddressGroup = new huaweicloud.vpc.AddressGroup("testAddressGroup", {addresses: [ * "192.168.10.12", * "192.168.11.0-192.168.11.240", * ]}); * const testSecgroupRule = new huaweicloud.vpc.SecgroupRule("testSecgroupRule", { * securityGroupId: securityGroupId, * direction: "egress", * action: "allow", * ethertype: "IPv4", * ports: "80,500,600-800", * protocol: "tcp", * priority: 5, * remoteAddressGroupId: testAddressGroup.id, * }); * ``` * * ## Import * * Security Group Rules can be imported using the `id`, e.g. bash * * ```sh * $ pulumi import huaweicloud:Vpc/secgroupRule:SecgroupRule secgroup_rule_1 aeb68ee3-6e9d-4256-955c-9584a6212745 * ``` */ export declare class SecgroupRule extends pulumi.CustomResource { /** * Get an existing SecgroupRule resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ static get(name: string, id: pulumi.Input<pulumi.ID>, state?: SecgroupRuleState, opts?: pulumi.CustomResourceOptions): SecgroupRule; /** * Returns true if the given object is an instance of SecgroupRule. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ static isInstance(obj: any): obj is SecgroupRule; /** * Specifies the effective policy. The valid values are **allow** and **deny**. * This parameter is not used with `portRangeMin` and `portRangeMax`. * Changing this creates a new security group rule. */ readonly action: pulumi.Output<string>; /** * Specifies the supplementary information about the networking security * group rule. This parameter can contain a maximum of 255 characters and cannot contain angle brackets (< or >). * Changing this creates a new security group rule. */ readonly description: pulumi.Output<string | undefined>; /** * Specifies the direction of the rule, valid values are **ingress** or * **egress**. Changing this creates a new security group rule. */ readonly direction: pulumi.Output<string>; /** * Specifies the layer 3 protocol type, valid values are **IPv4** or **IPv6**. * Changing this creates a new security group rule. */ readonly ethertype: pulumi.Output<string>; /** * Specifies the higher part of the allowed port range, valid integer value * needs to be between `1` and `65,535`. Changing this creates a new security group rule. * This parameter and `ports` are alternative. */ readonly portRangeMax: pulumi.Output<number>; /** * Specifies the lower part of the allowed port range, valid integer value * needs to be between `1` and `65,535`. Changing this creates a new security group rule. * This parameter and `ports` are alternative. */ readonly portRangeMin: pulumi.Output<number>; /** * Specifies the allowed port value range, which supports single port (80), * continuous port (1-30) and discontinuous port (22, 3389, 80) The valid port values is range form `1` to `65,535`. * Changing this creates a new security group rule. */ readonly ports: pulumi.Output<string>; /** * Specifies the priority number. * The valid value is range from `1` to `100`. The default value is `1`. * This parameter is not used with `portRangeMin` and `portRangeMax`. * Changing this creates a new security group rule. */ readonly priority: pulumi.Output<number>; /** * Specifies the layer 4 protocol type, valid values are **tcp**, **udp**, * **icmp** and **icmpv6**. If omitted, the protocol means that all protocols are supported. * This is required if you want to specify a port range. Changing this creates a new security group rule. */ readonly protocol: pulumi.Output<string>; /** * Specifies the region in which to create the security group rule resource. If * omitted, the provider-level region will be used. Changing this creates a new security group rule. */ readonly region: pulumi.Output<string>; /** * Specifies the remote address group ID. * This parameter is not used with `portRangeMin` and `portRangeMax`. * Changing this creates a new security group rule. */ readonly remoteAddressGroupId: pulumi.Output<string>; /** * Specifies the remote group ID. Changing this creates a new security * group rule. */ readonly remoteGroupId: pulumi.Output<string>; /** * Specifies the remote CIDR, the value needs to be a valid CIDR (i.e. * 192.168.0.0/16). If not specified, the empty value means all IP addresses, which is same as the value `0.0.0.0/0`. * Changing this creates a new security group rule. */ readonly remoteIpPrefix: pulumi.Output<string>; /** * Specifies the security group ID the rule should belong to. Changing * this creates a new security group rule. */ readonly securityGroupId: pulumi.Output<string>; /** * Create a SecgroupRule resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: SecgroupRuleArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering SecgroupRule resources. */ export interface SecgroupRuleState { /** * Specifies the effective policy. The valid values are **allow** and **deny**. * This parameter is not used with `portRangeMin` and `portRangeMax`. * Changing this creates a new security group rule. */ action?: pulumi.Input<string>; /** * Specifies the supplementary information about the networking security * group rule. This parameter can contain a maximum of 255 characters and cannot contain angle brackets (< or >). * Changing this creates a new security group rule. */ description?: pulumi.Input<string>; /** * Specifies the direction of the rule, valid values are **ingress** or * **egress**. Changing this creates a new security group rule. */ direction?: pulumi.Input<string>; /** * Specifies the layer 3 protocol type, valid values are **IPv4** or **IPv6**. * Changing this creates a new security group rule. */ ethertype?: pulumi.Input<string>; /** * Specifies the higher part of the allowed port range, valid integer value * needs to be between `1` and `65,535`. Changing this creates a new security group rule. * This parameter and `ports` are alternative. */ portRangeMax?: pulumi.Input<number>; /** * Specifies the lower part of the allowed port range, valid integer value * needs to be between `1` and `65,535`. Changing this creates a new security group rule. * This parameter and `ports` are alternative. */ portRangeMin?: pulumi.Input<number>; /** * Specifies the allowed port value range, which supports single port (80), * continuous port (1-30) and discontinuous port (22, 3389, 80) The valid port values is range form `1` to `65,535`. * Changing this creates a new security group rule. */ ports?: pulumi.Input<string>; /** * Specifies the priority number. * The valid value is range from `1` to `100`. The default value is `1`. * This parameter is not used with `portRangeMin` and `portRangeMax`. * Changing this creates a new security group rule. */ priority?: pulumi.Input<number>; /** * Specifies the layer 4 protocol type, valid values are **tcp**, **udp**, * **icmp** and **icmpv6**. If omitted, the protocol means that all protocols are supported. * This is required if you want to specify a port range. Changing this creates a new security group rule. */ protocol?: pulumi.Input<string>; /** * Specifies the region in which to create the security group rule resource. If * omitted, the provider-level region will be used. Changing this creates a new security group rule. */ region?: pulumi.Input<string>; /** * Specifies the remote address group ID. * This parameter is not used with `portRangeMin` and `portRangeMax`. * Changing this creates a new security group rule. */ remoteAddressGroupId?: pulumi.Input<string>; /** * Specifies the remote group ID. Changing this creates a new security * group rule. */ remoteGroupId?: pulumi.Input<string>; /** * Specifies the remote CIDR, the value needs to be a valid CIDR (i.e. * 192.168.0.0/16). If not specified, the empty value means all IP addresses, which is same as the value `0.0.0.0/0`. * Changing this creates a new security group rule. */ remoteIpPrefix?: pulumi.Input<string>; /** * Specifies the security group ID the rule should belong to. Changing * this creates a new security group rule. */ securityGroupId?: pulumi.Input<string>; } /** * The set of arguments for constructing a SecgroupRule resource. */ export interface SecgroupRuleArgs { /** * Specifies the effective policy. The valid values are **allow** and **deny**. * This parameter is not used with `portRangeMin` and `portRangeMax`. * Changing this creates a new security group rule. */ action?: pulumi.Input<string>; /** * Specifies the supplementary information about the networking security * group rule. This parameter can contain a maximum of 255 characters and cannot contain angle brackets (< or >). * Changing this creates a new security group rule. */ description?: pulumi.Input<string>; /** * Specifies the direction of the rule, valid values are **ingress** or * **egress**. Changing this creates a new security group rule. */ direction: pulumi.Input<string>; /** * Specifies the layer 3 protocol type, valid values are **IPv4** or **IPv6**. * Changing this creates a new security group rule. */ ethertype: pulumi.Input<string>; /** * Specifies the higher part of the allowed port range, valid integer value * needs to be between `1` and `65,535`. Changing this creates a new security group rule. * This parameter and `ports` are alternative. */ portRangeMax?: pulumi.Input<number>; /** * Specifies the lower part of the allowed port range, valid integer value * needs to be between `1` and `65,535`. Changing this creates a new security group rule. * This parameter and `ports` are alternative. */ portRangeMin?: pulumi.Input<number>; /** * Specifies the allowed port value range, which supports single port (80), * continuous port (1-30) and discontinuous port (22, 3389, 80) The valid port values is range form `1` to `65,535`. * Changing this creates a new security group rule. */ ports?: pulumi.Input<string>; /** * Specifies the priority number. * The valid value is range from `1` to `100`. The default value is `1`. * This parameter is not used with `portRangeMin` and `portRangeMax`. * Changing this creates a new security group rule. */ priority?: pulumi.Input<number>; /** * Specifies the layer 4 protocol type, valid values are **tcp**, **udp**, * **icmp** and **icmpv6**. If omitted, the protocol means that all protocols are supported. * This is required if you want to specify a port range. Changing this creates a new security group rule. */ protocol?: pulumi.Input<string>; /** * Specifies the region in which to create the security group rule resource. If * omitted, the provider-level region will be used. Changing this creates a new security group rule. */ region?: pulumi.Input<string>; /** * Specifies the remote address group ID. * This parameter is not used with `portRangeMin` and `portRangeMax`. * Changing this creates a new security group rule. */ remoteAddressGroupId?: pulumi.Input<string>; /** * Specifies the remote group ID. Changing this creates a new security * group rule. */ remoteGroupId?: pulumi.Input<string>; /** * Specifies the remote CIDR, the value needs to be a valid CIDR (i.e. * 192.168.0.0/16). If not specified, the empty value means all IP addresses, which is same as the value `0.0.0.0/0`. * Changing this creates a new security group rule. */ remoteIpPrefix?: pulumi.Input<string>; /** * Specifies the security group ID the rule should belong to. Changing * this creates a new security group rule. */ securityGroupId: pulumi.Input<string>; }