1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. kms
  5. NetworkRule
Alibaba Cloud v3.54.0 published on Wednesday, Apr 24, 2024 by Pulumi

alicloud.kms.NetworkRule

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.54.0 published on Wednesday, Apr 24, 2024 by Pulumi

    Provides a KMS Network Rule resource. Network rules that can be bound by Application Access Point’s policies.

    For information about KMS Network Rule and how to use it, see What is Network Rule.

    NOTE: Available since v1.210.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "terraform-example";
    const _default = new alicloud.kms.NetworkRule("default", {
        description: "example-description",
        sourcePrivateIps: [
            "10.10.10.10/24",
            "192.168.17.13",
            "100.177.24.254",
        ],
        networkRuleName: name,
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "terraform-example"
    default = alicloud.kms.NetworkRule("default",
        description="example-description",
        source_private_ips=[
            "10.10.10.10/24",
            "192.168.17.13",
            "100.177.24.254",
        ],
        network_rule_name=name)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/kms"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		name := "terraform-example"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		_, err := kms.NewNetworkRule(ctx, "default", &kms.NetworkRuleArgs{
    			Description: pulumi.String("example-description"),
    			SourcePrivateIps: pulumi.StringArray{
    				pulumi.String("10.10.10.10/24"),
    				pulumi.String("192.168.17.13"),
    				pulumi.String("100.177.24.254"),
    			},
    			NetworkRuleName: pulumi.String(name),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "terraform-example";
        var @default = new AliCloud.Kms.NetworkRule("default", new()
        {
            Description = "example-description",
            SourcePrivateIps = new[]
            {
                "10.10.10.10/24",
                "192.168.17.13",
                "100.177.24.254",
            },
            NetworkRuleName = name,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.kms.NetworkRule;
    import com.pulumi.alicloud.kms.NetworkRuleArgs;
    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 config = ctx.config();
            final var name = config.get("name").orElse("terraform-example");
            var default_ = new NetworkRule("default", NetworkRuleArgs.builder()        
                .description("example-description")
                .sourcePrivateIps(            
                    "10.10.10.10/24",
                    "192.168.17.13",
                    "100.177.24.254")
                .networkRuleName(name)
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: terraform-example
    resources:
      default:
        type: alicloud:kms:NetworkRule
        properties:
          description: example-description
          sourcePrivateIps:
            - 10.10.10.10/24
            - 192.168.17.13
            - 100.177.24.254
          networkRuleName: ${name}
    

    Create NetworkRule Resource

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

    Constructor syntax

    new NetworkRule(name: string, args: NetworkRuleArgs, opts?: CustomResourceOptions);
    @overload
    def NetworkRule(resource_name: str,
                    args: NetworkRuleArgs,
                    opts: Optional[ResourceOptions] = None)
    
    @overload
    def NetworkRule(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    source_private_ips: Optional[Sequence[str]] = None,
                    description: Optional[str] = None,
                    network_rule_name: Optional[str] = None)
    func NewNetworkRule(ctx *Context, name string, args NetworkRuleArgs, opts ...ResourceOption) (*NetworkRule, error)
    public NetworkRule(string name, NetworkRuleArgs args, CustomResourceOptions? opts = null)
    public NetworkRule(String name, NetworkRuleArgs args)
    public NetworkRule(String name, NetworkRuleArgs args, CustomResourceOptions options)
    
    type: alicloud:kms:NetworkRule
    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 NetworkRuleArgs
    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 NetworkRuleArgs
    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 NetworkRuleArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args NetworkRuleArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args NetworkRuleArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var networkRuleResource = new AliCloud.Kms.NetworkRule("networkRuleResource", new()
    {
        SourcePrivateIps = new[]
        {
            "string",
        },
        Description = "string",
        NetworkRuleName = "string",
    });
    
    example, err := kms.NewNetworkRule(ctx, "networkRuleResource", &kms.NetworkRuleArgs{
    	SourcePrivateIps: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	Description:     pulumi.String("string"),
    	NetworkRuleName: pulumi.String("string"),
    })
    
    var networkRuleResource = new NetworkRule("networkRuleResource", NetworkRuleArgs.builder()        
        .sourcePrivateIps("string")
        .description("string")
        .networkRuleName("string")
        .build());
    
    network_rule_resource = alicloud.kms.NetworkRule("networkRuleResource",
        source_private_ips=["string"],
        description="string",
        network_rule_name="string")
    
    const networkRuleResource = new alicloud.kms.NetworkRule("networkRuleResource", {
        sourcePrivateIps: ["string"],
        description: "string",
        networkRuleName: "string",
    });
    
    type: alicloud:kms:NetworkRule
    properties:
        description: string
        networkRuleName: string
        sourcePrivateIps:
            - string
    

    NetworkRule Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The NetworkRule resource accepts the following input properties:

    SourcePrivateIps List<string>
    Allowed private network addresses.
    Description string
    Description.
    NetworkRuleName string
    Network Rule Name.
    SourcePrivateIps []string
    Allowed private network addresses.
    Description string
    Description.
    NetworkRuleName string
    Network Rule Name.
    sourcePrivateIps List<String>
    Allowed private network addresses.
    description String
    Description.
    networkRuleName String
    Network Rule Name.
    sourcePrivateIps string[]
    Allowed private network addresses.
    description string
    Description.
    networkRuleName string
    Network Rule Name.
    source_private_ips Sequence[str]
    Allowed private network addresses.
    description str
    Description.
    network_rule_name str
    Network Rule Name.
    sourcePrivateIps List<String>
    Allowed private network addresses.
    description String
    Description.
    networkRuleName String
    Network Rule Name.

    Outputs

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

    Get an existing NetworkRule 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?: NetworkRuleState, opts?: CustomResourceOptions): NetworkRule
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            description: Optional[str] = None,
            network_rule_name: Optional[str] = None,
            source_private_ips: Optional[Sequence[str]] = None) -> NetworkRule
    func GetNetworkRule(ctx *Context, name string, id IDInput, state *NetworkRuleState, opts ...ResourceOption) (*NetworkRule, error)
    public static NetworkRule Get(string name, Input<string> id, NetworkRuleState? state, CustomResourceOptions? opts = null)
    public static NetworkRule get(String name, Output<String> id, NetworkRuleState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    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:
    Description string
    Description.
    NetworkRuleName string
    Network Rule Name.
    SourcePrivateIps List<string>
    Allowed private network addresses.
    Description string
    Description.
    NetworkRuleName string
    Network Rule Name.
    SourcePrivateIps []string
    Allowed private network addresses.
    description String
    Description.
    networkRuleName String
    Network Rule Name.
    sourcePrivateIps List<String>
    Allowed private network addresses.
    description string
    Description.
    networkRuleName string
    Network Rule Name.
    sourcePrivateIps string[]
    Allowed private network addresses.
    description str
    Description.
    network_rule_name str
    Network Rule Name.
    source_private_ips Sequence[str]
    Allowed private network addresses.
    description String
    Description.
    networkRuleName String
    Network Rule Name.
    sourcePrivateIps List<String>
    Allowed private network addresses.

    Import

    KMS Network Rule can be imported using the id, e.g.

    $ pulumi import alicloud:kms/networkRule:NetworkRule example <id>
    

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

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo
    Alibaba Cloud v3.54.0 published on Wednesday, Apr 24, 2024 by Pulumi