1. Packages
  2. Volcengine
  3. API Docs
  4. mongodb
  5. MongoAllowListAssociate
Volcengine v0.0.26 published on Friday, Sep 13, 2024 by Volcengine

volcengine.mongodb.MongoAllowListAssociate

Explore with Pulumi AI

volcengine logo
Volcengine v0.0.26 published on Friday, Sep 13, 2024 by Volcengine

    Provides a resource to manage mongodb allow list associate

    Example Usage

    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Volcengine = Pulumi.Volcengine;
    
    return await Deployment.RunAsync(() => 
    {
        var fooZones = Volcengine.Ecs.Zones.Invoke();
    
        var fooVpc = new Volcengine.Vpc.Vpc("fooVpc", new()
        {
            VpcName = "acc-test-vpc",
            CidrBlock = "172.16.0.0/16",
        });
    
        var fooSubnet = new Volcengine.Vpc.Subnet("fooSubnet", new()
        {
            SubnetName = "acc-test-subnet",
            CidrBlock = "172.16.0.0/24",
            ZoneId = fooZones.Apply(zonesResult => zonesResult.Zones[0]?.Id),
            VpcId = fooVpc.Id,
        });
    
        var fooInstance = new Volcengine.Mongodb.Instance("fooInstance", new()
        {
            DbEngineVersion = "MongoDB_4_0",
            InstanceType = "ReplicaSet",
            SuperAccountPassword = "@acc-test-123",
            NodeSpec = "mongo.2c4g",
            MongosNodeSpec = "mongo.mongos.2c4g",
            InstanceName = "acc-test-mongo-replica",
            ChargeType = "PostPaid",
            ProjectName = "default",
            MongosNodeNumber = 32,
            ShardNumber = 3,
            StorageSpaceGb = 20,
            SubnetId = fooSubnet.Id,
            ZoneId = fooZones.Apply(zonesResult => zonesResult.Zones[0]?.Id),
            Tags = new[]
            {
                new Volcengine.Mongodb.Inputs.InstanceTagArgs
                {
                    Key = "k1",
                    Value = "v1",
                },
            },
        });
    
        var fooMongoAllowList = new Volcengine.Mongodb.MongoAllowList("fooMongoAllowList", new()
        {
            AllowListName = "acc-test",
            AllowListDesc = "acc-test",
            AllowListType = "IPv4",
            AllowList = "10.1.1.3,10.2.3.0/24,10.1.1.1",
        });
    
        var fooMongoAllowListAssociate = new Volcengine.Mongodb.MongoAllowListAssociate("fooMongoAllowListAssociate", new()
        {
            AllowListId = fooMongoAllowList.Id,
            InstanceId = fooInstance.Id,
        });
    
    });
    
    package main
    
    import (
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/ecs"
    	"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/mongodb"
    	"github.com/volcengine/pulumi-volcengine/sdk/go/volcengine/vpc"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		fooZones, err := ecs.Zones(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		fooVpc, err := vpc.NewVpc(ctx, "fooVpc", &vpc.VpcArgs{
    			VpcName:   pulumi.String("acc-test-vpc"),
    			CidrBlock: pulumi.String("172.16.0.0/16"),
    		})
    		if err != nil {
    			return err
    		}
    		fooSubnet, err := vpc.NewSubnet(ctx, "fooSubnet", &vpc.SubnetArgs{
    			SubnetName: pulumi.String("acc-test-subnet"),
    			CidrBlock:  pulumi.String("172.16.0.0/24"),
    			ZoneId:     *pulumi.String(fooZones.Zones[0].Id),
    			VpcId:      fooVpc.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		fooInstance, err := mongodb.NewInstance(ctx, "fooInstance", &mongodb.InstanceArgs{
    			DbEngineVersion:      pulumi.String("MongoDB_4_0"),
    			InstanceType:         pulumi.String("ReplicaSet"),
    			SuperAccountPassword: pulumi.String("@acc-test-123"),
    			NodeSpec:             pulumi.String("mongo.2c4g"),
    			MongosNodeSpec:       pulumi.String("mongo.mongos.2c4g"),
    			InstanceName:         pulumi.String("acc-test-mongo-replica"),
    			ChargeType:           pulumi.String("PostPaid"),
    			ProjectName:          pulumi.String("default"),
    			MongosNodeNumber:     pulumi.Int(32),
    			ShardNumber:          pulumi.Int(3),
    			StorageSpaceGb:       pulumi.Int(20),
    			SubnetId:             fooSubnet.ID(),
    			ZoneId:               *pulumi.String(fooZones.Zones[0].Id),
    			Tags: mongodb.InstanceTagArray{
    				&mongodb.InstanceTagArgs{
    					Key:   pulumi.String("k1"),
    					Value: pulumi.String("v1"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		fooMongoAllowList, err := mongodb.NewMongoAllowList(ctx, "fooMongoAllowList", &mongodb.MongoAllowListArgs{
    			AllowListName: pulumi.String("acc-test"),
    			AllowListDesc: pulumi.String("acc-test"),
    			AllowListType: pulumi.String("IPv4"),
    			AllowList:     pulumi.String("10.1.1.3,10.2.3.0/24,10.1.1.1"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = mongodb.NewMongoAllowListAssociate(ctx, "fooMongoAllowListAssociate", &mongodb.MongoAllowListAssociateArgs{
    			AllowListId: fooMongoAllowList.ID(),
    			InstanceId:  fooInstance.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.volcengine.ecs.EcsFunctions;
    import com.pulumi.volcengine.ecs.inputs.ZonesArgs;
    import com.pulumi.volcengine.vpc.Vpc;
    import com.pulumi.volcengine.vpc.VpcArgs;
    import com.pulumi.volcengine.vpc.Subnet;
    import com.pulumi.volcengine.vpc.SubnetArgs;
    import com.pulumi.volcengine.mongodb.Instance;
    import com.pulumi.volcengine.mongodb.InstanceArgs;
    import com.pulumi.volcengine.mongodb.inputs.InstanceTagArgs;
    import com.pulumi.volcengine.mongodb.MongoAllowList;
    import com.pulumi.volcengine.mongodb.MongoAllowListArgs;
    import com.pulumi.volcengine.mongodb.MongoAllowListAssociate;
    import com.pulumi.volcengine.mongodb.MongoAllowListAssociateArgs;
    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 fooZones = EcsFunctions.Zones();
    
            var fooVpc = new Vpc("fooVpc", VpcArgs.builder()        
                .vpcName("acc-test-vpc")
                .cidrBlock("172.16.0.0/16")
                .build());
    
            var fooSubnet = new Subnet("fooSubnet", SubnetArgs.builder()        
                .subnetName("acc-test-subnet")
                .cidrBlock("172.16.0.0/24")
                .zoneId(fooZones.applyValue(zonesResult -> zonesResult.zones()[0].id()))
                .vpcId(fooVpc.id())
                .build());
    
            var fooInstance = new Instance("fooInstance", InstanceArgs.builder()        
                .dbEngineVersion("MongoDB_4_0")
                .instanceType("ReplicaSet")
                .superAccountPassword("@acc-test-123")
                .nodeSpec("mongo.2c4g")
                .mongosNodeSpec("mongo.mongos.2c4g")
                .instanceName("acc-test-mongo-replica")
                .chargeType("PostPaid")
                .projectName("default")
                .mongosNodeNumber(32)
                .shardNumber(3)
                .storageSpaceGb(20)
                .subnetId(fooSubnet.id())
                .zoneId(fooZones.applyValue(zonesResult -> zonesResult.zones()[0].id()))
                .tags(InstanceTagArgs.builder()
                    .key("k1")
                    .value("v1")
                    .build())
                .build());
    
            var fooMongoAllowList = new MongoAllowList("fooMongoAllowList", MongoAllowListArgs.builder()        
                .allowListName("acc-test")
                .allowListDesc("acc-test")
                .allowListType("IPv4")
                .allowList("10.1.1.3,10.2.3.0/24,10.1.1.1")
                .build());
    
            var fooMongoAllowListAssociate = new MongoAllowListAssociate("fooMongoAllowListAssociate", MongoAllowListAssociateArgs.builder()        
                .allowListId(fooMongoAllowList.id())
                .instanceId(fooInstance.id())
                .build());
    
        }
    }
    
    import pulumi
    import pulumi_volcengine as volcengine
    
    foo_zones = volcengine.ecs.zones()
    foo_vpc = volcengine.vpc.Vpc("fooVpc",
        vpc_name="acc-test-vpc",
        cidr_block="172.16.0.0/16")
    foo_subnet = volcengine.vpc.Subnet("fooSubnet",
        subnet_name="acc-test-subnet",
        cidr_block="172.16.0.0/24",
        zone_id=foo_zones.zones[0].id,
        vpc_id=foo_vpc.id)
    foo_instance = volcengine.mongodb.Instance("fooInstance",
        db_engine_version="MongoDB_4_0",
        instance_type="ReplicaSet",
        super_account_password="@acc-test-123",
        node_spec="mongo.2c4g",
        mongos_node_spec="mongo.mongos.2c4g",
        instance_name="acc-test-mongo-replica",
        charge_type="PostPaid",
        project_name="default",
        mongos_node_number=32,
        shard_number=3,
        storage_space_gb=20,
        subnet_id=foo_subnet.id,
        zone_id=foo_zones.zones[0].id,
        tags=[volcengine.mongodb.InstanceTagArgs(
            key="k1",
            value="v1",
        )])
    foo_mongo_allow_list = volcengine.mongodb.MongoAllowList("fooMongoAllowList",
        allow_list_name="acc-test",
        allow_list_desc="acc-test",
        allow_list_type="IPv4",
        allow_list="10.1.1.3,10.2.3.0/24,10.1.1.1")
    foo_mongo_allow_list_associate = volcengine.mongodb.MongoAllowListAssociate("fooMongoAllowListAssociate",
        allow_list_id=foo_mongo_allow_list.id,
        instance_id=foo_instance.id)
    
    import * as pulumi from "@pulumi/pulumi";
    import * as volcengine from "@pulumi/volcengine";
    import * as volcengine from "@volcengine/pulumi";
    
    const fooZones = volcengine.ecs.Zones({});
    const fooVpc = new volcengine.vpc.Vpc("fooVpc", {
        vpcName: "acc-test-vpc",
        cidrBlock: "172.16.0.0/16",
    });
    const fooSubnet = new volcengine.vpc.Subnet("fooSubnet", {
        subnetName: "acc-test-subnet",
        cidrBlock: "172.16.0.0/24",
        zoneId: fooZones.then(fooZones => fooZones.zones?.[0]?.id),
        vpcId: fooVpc.id,
    });
    const fooInstance = new volcengine.mongodb.Instance("fooInstance", {
        dbEngineVersion: "MongoDB_4_0",
        instanceType: "ReplicaSet",
        superAccountPassword: "@acc-test-123",
        nodeSpec: "mongo.2c4g",
        mongosNodeSpec: "mongo.mongos.2c4g",
        instanceName: "acc-test-mongo-replica",
        chargeType: "PostPaid",
        projectName: "default",
        mongosNodeNumber: 32,
        shardNumber: 3,
        storageSpaceGb: 20,
        subnetId: fooSubnet.id,
        zoneId: fooZones.then(fooZones => fooZones.zones?.[0]?.id),
        tags: [{
            key: "k1",
            value: "v1",
        }],
    });
    const fooMongoAllowList = new volcengine.mongodb.MongoAllowList("fooMongoAllowList", {
        allowListName: "acc-test",
        allowListDesc: "acc-test",
        allowListType: "IPv4",
        allowList: "10.1.1.3,10.2.3.0/24,10.1.1.1",
    });
    const fooMongoAllowListAssociate = new volcengine.mongodb.MongoAllowListAssociate("fooMongoAllowListAssociate", {
        allowListId: fooMongoAllowList.id,
        instanceId: fooInstance.id,
    });
    
    resources:
      fooVpc:
        type: volcengine:vpc:Vpc
        properties:
          vpcName: acc-test-vpc
          cidrBlock: 172.16.0.0/16
      fooSubnet:
        type: volcengine:vpc:Subnet
        properties:
          subnetName: acc-test-subnet
          cidrBlock: 172.16.0.0/24
          zoneId: ${fooZones.zones[0].id}
          vpcId: ${fooVpc.id}
      fooInstance:
        type: volcengine:mongodb:Instance
        properties:
          dbEngineVersion: MongoDB_4_0
          instanceType: ReplicaSet
          superAccountPassword: '@acc-test-123'
          nodeSpec: mongo.2c4g
          mongosNodeSpec: mongo.mongos.2c4g
          instanceName: acc-test-mongo-replica
          chargeType: PostPaid
          projectName: default
          mongosNodeNumber: 32
          shardNumber: 3
          storageSpaceGb: 20
          subnetId: ${fooSubnet.id}
          zoneId: ${fooZones.zones[0].id}
          tags:
            - key: k1
              value: v1
      fooMongoAllowList:
        type: volcengine:mongodb:MongoAllowList
        properties:
          allowListName: acc-test
          allowListDesc: acc-test
          allowListType: IPv4
          allowList: 10.1.1.3,10.2.3.0/24,10.1.1.1
      fooMongoAllowListAssociate:
        type: volcengine:mongodb:MongoAllowListAssociate
        properties:
          allowListId: ${fooMongoAllowList.id}
          instanceId: ${fooInstance.id}
    variables:
      fooZones:
        fn::invoke:
          Function: volcengine:ecs:Zones
          Arguments: {}
    

    Create MongoAllowListAssociate Resource

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

    Constructor syntax

    new MongoAllowListAssociate(name: string, args: MongoAllowListAssociateArgs, opts?: CustomResourceOptions);
    @overload
    def MongoAllowListAssociate(resource_name: str,
                                args: MongoAllowListAssociateArgs,
                                opts: Optional[ResourceOptions] = None)
    
    @overload
    def MongoAllowListAssociate(resource_name: str,
                                opts: Optional[ResourceOptions] = None,
                                allow_list_id: Optional[str] = None,
                                instance_id: Optional[str] = None)
    func NewMongoAllowListAssociate(ctx *Context, name string, args MongoAllowListAssociateArgs, opts ...ResourceOption) (*MongoAllowListAssociate, error)
    public MongoAllowListAssociate(string name, MongoAllowListAssociateArgs args, CustomResourceOptions? opts = null)
    public MongoAllowListAssociate(String name, MongoAllowListAssociateArgs args)
    public MongoAllowListAssociate(String name, MongoAllowListAssociateArgs args, CustomResourceOptions options)
    
    type: volcengine:mongodb:MongoAllowListAssociate
    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 MongoAllowListAssociateArgs
    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 MongoAllowListAssociateArgs
    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 MongoAllowListAssociateArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args MongoAllowListAssociateArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args MongoAllowListAssociateArgs
    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 mongoAllowListAssociateResource = new Volcengine.Mongodb.MongoAllowListAssociate("mongoAllowListAssociateResource", new()
    {
        AllowListId = "string",
        InstanceId = "string",
    });
    
    example, err := mongodb.NewMongoAllowListAssociate(ctx, "mongoAllowListAssociateResource", &mongodb.MongoAllowListAssociateArgs{
    	AllowListId: pulumi.String("string"),
    	InstanceId:  pulumi.String("string"),
    })
    
    var mongoAllowListAssociateResource = new MongoAllowListAssociate("mongoAllowListAssociateResource", MongoAllowListAssociateArgs.builder()
        .allowListId("string")
        .instanceId("string")
        .build());
    
    mongo_allow_list_associate_resource = volcengine.mongodb.MongoAllowListAssociate("mongoAllowListAssociateResource",
        allow_list_id="string",
        instance_id="string")
    
    const mongoAllowListAssociateResource = new volcengine.mongodb.MongoAllowListAssociate("mongoAllowListAssociateResource", {
        allowListId: "string",
        instanceId: "string",
    });
    
    type: volcengine:mongodb:MongoAllowListAssociate
    properties:
        allowListId: string
        instanceId: string
    

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

    AllowListId string
    Id of allow list to associate.
    InstanceId string
    Id of instance to associate.
    AllowListId string
    Id of allow list to associate.
    InstanceId string
    Id of instance to associate.
    allowListId String
    Id of allow list to associate.
    instanceId String
    Id of instance to associate.
    allowListId string
    Id of allow list to associate.
    instanceId string
    Id of instance to associate.
    allow_list_id str
    Id of allow list to associate.
    instance_id str
    Id of instance to associate.
    allowListId String
    Id of allow list to associate.
    instanceId String
    Id of instance to associate.

    Outputs

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

    Get an existing MongoAllowListAssociate 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?: MongoAllowListAssociateState, opts?: CustomResourceOptions): MongoAllowListAssociate
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            allow_list_id: Optional[str] = None,
            instance_id: Optional[str] = None) -> MongoAllowListAssociate
    func GetMongoAllowListAssociate(ctx *Context, name string, id IDInput, state *MongoAllowListAssociateState, opts ...ResourceOption) (*MongoAllowListAssociate, error)
    public static MongoAllowListAssociate Get(string name, Input<string> id, MongoAllowListAssociateState? state, CustomResourceOptions? opts = null)
    public static MongoAllowListAssociate get(String name, Output<String> id, MongoAllowListAssociateState 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:
    AllowListId string
    Id of allow list to associate.
    InstanceId string
    Id of instance to associate.
    AllowListId string
    Id of allow list to associate.
    InstanceId string
    Id of instance to associate.
    allowListId String
    Id of allow list to associate.
    instanceId String
    Id of instance to associate.
    allowListId string
    Id of allow list to associate.
    instanceId string
    Id of instance to associate.
    allow_list_id str
    Id of allow list to associate.
    instance_id str
    Id of instance to associate.
    allowListId String
    Id of allow list to associate.
    instanceId String
    Id of instance to associate.

    Import

    mongodb allow list associate can be imported using the instanceId:allowListId, e.g.

     $ pulumi import volcengine:mongodb/mongoAllowListAssociate:MongoAllowListAssociate default mongo-replica-e405f8e2****:acl-d1fd76693bd54e658912e7337d5b****
    

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

    Package Details

    Repository
    volcengine volcengine/pulumi-volcengine
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the volcengine Terraform Provider.
    volcengine logo
    Volcengine v0.0.26 published on Friday, Sep 13, 2024 by Volcengine