1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. alloydb
  5. User
Google Cloud Classic v7.29.0 published on Wednesday, Jun 26, 2024 by Pulumi

gcp.alloydb.User

Explore with Pulumi AI

gcp logo
Google Cloud Classic v7.29.0 published on Wednesday, Jun 26, 2024 by Pulumi

    A database user in an AlloyDB cluster.

    To get more information about User, see:

    Example Usage

    Alloydb User Builtin

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const defaultNetwork = new gcp.compute.Network("default", {name: "alloydb-network"});
    const defaultCluster = new gcp.alloydb.Cluster("default", {
        clusterId: "alloydb-cluster",
        location: "us-central1",
        network: defaultNetwork.id,
        initialUser: {
            password: "cluster_secret",
        },
    });
    const privateIpAlloc = new gcp.compute.GlobalAddress("private_ip_alloc", {
        name: "alloydb-cluster",
        addressType: "INTERNAL",
        purpose: "VPC_PEERING",
        prefixLength: 16,
        network: defaultNetwork.id,
    });
    const vpcConnection = new gcp.servicenetworking.Connection("vpc_connection", {
        network: defaultNetwork.id,
        service: "servicenetworking.googleapis.com",
        reservedPeeringRanges: [privateIpAlloc.name],
    });
    const _default = new gcp.alloydb.Instance("default", {
        cluster: defaultCluster.name,
        instanceId: "alloydb-instance",
        instanceType: "PRIMARY",
    }, {
        dependsOn: [vpcConnection],
    });
    const project = gcp.organizations.getProject({});
    const user1 = new gcp.alloydb.User("user1", {
        cluster: defaultCluster.name,
        userId: "user1",
        userType: "ALLOYDB_BUILT_IN",
        password: "user_secret",
        databaseRoles: ["alloydbsuperuser"],
    }, {
        dependsOn: [_default],
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    default_network = gcp.compute.Network("default", name="alloydb-network")
    default_cluster = gcp.alloydb.Cluster("default",
        cluster_id="alloydb-cluster",
        location="us-central1",
        network=default_network.id,
        initial_user=gcp.alloydb.ClusterInitialUserArgs(
            password="cluster_secret",
        ))
    private_ip_alloc = gcp.compute.GlobalAddress("private_ip_alloc",
        name="alloydb-cluster",
        address_type="INTERNAL",
        purpose="VPC_PEERING",
        prefix_length=16,
        network=default_network.id)
    vpc_connection = gcp.servicenetworking.Connection("vpc_connection",
        network=default_network.id,
        service="servicenetworking.googleapis.com",
        reserved_peering_ranges=[private_ip_alloc.name])
    default = gcp.alloydb.Instance("default",
        cluster=default_cluster.name,
        instance_id="alloydb-instance",
        instance_type="PRIMARY",
        opts = pulumi.ResourceOptions(depends_on=[vpc_connection]))
    project = gcp.organizations.get_project()
    user1 = gcp.alloydb.User("user1",
        cluster=default_cluster.name,
        user_id="user1",
        user_type="ALLOYDB_BUILT_IN",
        password="user_secret",
        database_roles=["alloydbsuperuser"],
        opts = pulumi.ResourceOptions(depends_on=[default]))
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/alloydb"
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/servicenetworking"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		defaultNetwork, err := compute.NewNetwork(ctx, "default", &compute.NetworkArgs{
    			Name: pulumi.String("alloydb-network"),
    		})
    		if err != nil {
    			return err
    		}
    		defaultCluster, err := alloydb.NewCluster(ctx, "default", &alloydb.ClusterArgs{
    			ClusterId: pulumi.String("alloydb-cluster"),
    			Location:  pulumi.String("us-central1"),
    			Network:   defaultNetwork.ID(),
    			InitialUser: &alloydb.ClusterInitialUserArgs{
    				Password: pulumi.String("cluster_secret"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		privateIpAlloc, err := compute.NewGlobalAddress(ctx, "private_ip_alloc", &compute.GlobalAddressArgs{
    			Name:         pulumi.String("alloydb-cluster"),
    			AddressType:  pulumi.String("INTERNAL"),
    			Purpose:      pulumi.String("VPC_PEERING"),
    			PrefixLength: pulumi.Int(16),
    			Network:      defaultNetwork.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		vpcConnection, err := servicenetworking.NewConnection(ctx, "vpc_connection", &servicenetworking.ConnectionArgs{
    			Network: defaultNetwork.ID(),
    			Service: pulumi.String("servicenetworking.googleapis.com"),
    			ReservedPeeringRanges: pulumi.StringArray{
    				privateIpAlloc.Name,
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = alloydb.NewInstance(ctx, "default", &alloydb.InstanceArgs{
    			Cluster:      defaultCluster.Name,
    			InstanceId:   pulumi.String("alloydb-instance"),
    			InstanceType: pulumi.String("PRIMARY"),
    		}, pulumi.DependsOn([]pulumi.Resource{
    			vpcConnection,
    		}))
    		if err != nil {
    			return err
    		}
    		_, err = organizations.LookupProject(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		_, err = alloydb.NewUser(ctx, "user1", &alloydb.UserArgs{
    			Cluster:  defaultCluster.Name,
    			UserId:   pulumi.String("user1"),
    			UserType: pulumi.String("ALLOYDB_BUILT_IN"),
    			Password: pulumi.String("user_secret"),
    			DatabaseRoles: pulumi.StringArray{
    				pulumi.String("alloydbsuperuser"),
    			},
    		}, pulumi.DependsOn([]pulumi.Resource{
    			_default,
    		}))
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var defaultNetwork = new Gcp.Compute.Network("default", new()
        {
            Name = "alloydb-network",
        });
    
        var defaultCluster = new Gcp.Alloydb.Cluster("default", new()
        {
            ClusterId = "alloydb-cluster",
            Location = "us-central1",
            Network = defaultNetwork.Id,
            InitialUser = new Gcp.Alloydb.Inputs.ClusterInitialUserArgs
            {
                Password = "cluster_secret",
            },
        });
    
        var privateIpAlloc = new Gcp.Compute.GlobalAddress("private_ip_alloc", new()
        {
            Name = "alloydb-cluster",
            AddressType = "INTERNAL",
            Purpose = "VPC_PEERING",
            PrefixLength = 16,
            Network = defaultNetwork.Id,
        });
    
        var vpcConnection = new Gcp.ServiceNetworking.Connection("vpc_connection", new()
        {
            Network = defaultNetwork.Id,
            Service = "servicenetworking.googleapis.com",
            ReservedPeeringRanges = new[]
            {
                privateIpAlloc.Name,
            },
        });
    
        var @default = new Gcp.Alloydb.Instance("default", new()
        {
            Cluster = defaultCluster.Name,
            InstanceId = "alloydb-instance",
            InstanceType = "PRIMARY",
        }, new CustomResourceOptions
        {
            DependsOn =
            {
                vpcConnection,
            },
        });
    
        var project = Gcp.Organizations.GetProject.Invoke();
    
        var user1 = new Gcp.Alloydb.User("user1", new()
        {
            Cluster = defaultCluster.Name,
            UserId = "user1",
            UserType = "ALLOYDB_BUILT_IN",
            Password = "user_secret",
            DatabaseRoles = new[]
            {
                "alloydbsuperuser",
            },
        }, new CustomResourceOptions
        {
            DependsOn =
            {
                @default,
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.compute.Network;
    import com.pulumi.gcp.compute.NetworkArgs;
    import com.pulumi.gcp.alloydb.Cluster;
    import com.pulumi.gcp.alloydb.ClusterArgs;
    import com.pulumi.gcp.alloydb.inputs.ClusterInitialUserArgs;
    import com.pulumi.gcp.compute.GlobalAddress;
    import com.pulumi.gcp.compute.GlobalAddressArgs;
    import com.pulumi.gcp.servicenetworking.Connection;
    import com.pulumi.gcp.servicenetworking.ConnectionArgs;
    import com.pulumi.gcp.alloydb.Instance;
    import com.pulumi.gcp.alloydb.InstanceArgs;
    import com.pulumi.gcp.organizations.OrganizationsFunctions;
    import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
    import com.pulumi.gcp.alloydb.User;
    import com.pulumi.gcp.alloydb.UserArgs;
    import com.pulumi.resources.CustomResourceOptions;
    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 defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()
                .name("alloydb-network")
                .build());
    
            var defaultCluster = new Cluster("defaultCluster", ClusterArgs.builder()
                .clusterId("alloydb-cluster")
                .location("us-central1")
                .network(defaultNetwork.id())
                .initialUser(ClusterInitialUserArgs.builder()
                    .password("cluster_secret")
                    .build())
                .build());
    
            var privateIpAlloc = new GlobalAddress("privateIpAlloc", GlobalAddressArgs.builder()
                .name("alloydb-cluster")
                .addressType("INTERNAL")
                .purpose("VPC_PEERING")
                .prefixLength(16)
                .network(defaultNetwork.id())
                .build());
    
            var vpcConnection = new Connection("vpcConnection", ConnectionArgs.builder()
                .network(defaultNetwork.id())
                .service("servicenetworking.googleapis.com")
                .reservedPeeringRanges(privateIpAlloc.name())
                .build());
    
            var default_ = new Instance("default", InstanceArgs.builder()
                .cluster(defaultCluster.name())
                .instanceId("alloydb-instance")
                .instanceType("PRIMARY")
                .build(), CustomResourceOptions.builder()
                    .dependsOn(vpcConnection)
                    .build());
    
            final var project = OrganizationsFunctions.getProject();
    
            var user1 = new User("user1", UserArgs.builder()
                .cluster(defaultCluster.name())
                .userId("user1")
                .userType("ALLOYDB_BUILT_IN")
                .password("user_secret")
                .databaseRoles("alloydbsuperuser")
                .build(), CustomResourceOptions.builder()
                    .dependsOn(default_)
                    .build());
    
        }
    }
    
    resources:
      default:
        type: gcp:alloydb:Instance
        properties:
          cluster: ${defaultCluster.name}
          instanceId: alloydb-instance
          instanceType: PRIMARY
        options:
          dependson:
            - ${vpcConnection}
      defaultCluster:
        type: gcp:alloydb:Cluster
        name: default
        properties:
          clusterId: alloydb-cluster
          location: us-central1
          network: ${defaultNetwork.id}
          initialUser:
            password: cluster_secret
      defaultNetwork:
        type: gcp:compute:Network
        name: default
        properties:
          name: alloydb-network
      privateIpAlloc:
        type: gcp:compute:GlobalAddress
        name: private_ip_alloc
        properties:
          name: alloydb-cluster
          addressType: INTERNAL
          purpose: VPC_PEERING
          prefixLength: 16
          network: ${defaultNetwork.id}
      vpcConnection:
        type: gcp:servicenetworking:Connection
        name: vpc_connection
        properties:
          network: ${defaultNetwork.id}
          service: servicenetworking.googleapis.com
          reservedPeeringRanges:
            - ${privateIpAlloc.name}
      user1:
        type: gcp:alloydb:User
        properties:
          cluster: ${defaultCluster.name}
          userId: user1
          userType: ALLOYDB_BUILT_IN
          password: user_secret
          databaseRoles:
            - alloydbsuperuser
        options:
          dependson:
            - ${default}
    variables:
      project:
        fn::invoke:
          Function: gcp:organizations:getProject
          Arguments: {}
    

    Alloydb User Iam

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const defaultNetwork = new gcp.compute.Network("default", {name: "alloydb-network"});
    const defaultCluster = new gcp.alloydb.Cluster("default", {
        clusterId: "alloydb-cluster",
        location: "us-central1",
        network: defaultNetwork.id,
        initialUser: {
            password: "cluster_secret",
        },
    });
    const privateIpAlloc = new gcp.compute.GlobalAddress("private_ip_alloc", {
        name: "alloydb-cluster",
        addressType: "INTERNAL",
        purpose: "VPC_PEERING",
        prefixLength: 16,
        network: defaultNetwork.id,
    });
    const vpcConnection = new gcp.servicenetworking.Connection("vpc_connection", {
        network: defaultNetwork.id,
        service: "servicenetworking.googleapis.com",
        reservedPeeringRanges: [privateIpAlloc.name],
    });
    const _default = new gcp.alloydb.Instance("default", {
        cluster: defaultCluster.name,
        instanceId: "alloydb-instance",
        instanceType: "PRIMARY",
    }, {
        dependsOn: [vpcConnection],
    });
    const project = gcp.organizations.getProject({});
    const user2 = new gcp.alloydb.User("user2", {
        cluster: defaultCluster.name,
        userId: "user2@foo.com",
        userType: "ALLOYDB_IAM_USER",
        databaseRoles: ["alloydbiamuser"],
    }, {
        dependsOn: [_default],
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    default_network = gcp.compute.Network("default", name="alloydb-network")
    default_cluster = gcp.alloydb.Cluster("default",
        cluster_id="alloydb-cluster",
        location="us-central1",
        network=default_network.id,
        initial_user=gcp.alloydb.ClusterInitialUserArgs(
            password="cluster_secret",
        ))
    private_ip_alloc = gcp.compute.GlobalAddress("private_ip_alloc",
        name="alloydb-cluster",
        address_type="INTERNAL",
        purpose="VPC_PEERING",
        prefix_length=16,
        network=default_network.id)
    vpc_connection = gcp.servicenetworking.Connection("vpc_connection",
        network=default_network.id,
        service="servicenetworking.googleapis.com",
        reserved_peering_ranges=[private_ip_alloc.name])
    default = gcp.alloydb.Instance("default",
        cluster=default_cluster.name,
        instance_id="alloydb-instance",
        instance_type="PRIMARY",
        opts = pulumi.ResourceOptions(depends_on=[vpc_connection]))
    project = gcp.organizations.get_project()
    user2 = gcp.alloydb.User("user2",
        cluster=default_cluster.name,
        user_id="user2@foo.com",
        user_type="ALLOYDB_IAM_USER",
        database_roles=["alloydbiamuser"],
        opts = pulumi.ResourceOptions(depends_on=[default]))
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/alloydb"
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/servicenetworking"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		defaultNetwork, err := compute.NewNetwork(ctx, "default", &compute.NetworkArgs{
    			Name: pulumi.String("alloydb-network"),
    		})
    		if err != nil {
    			return err
    		}
    		defaultCluster, err := alloydb.NewCluster(ctx, "default", &alloydb.ClusterArgs{
    			ClusterId: pulumi.String("alloydb-cluster"),
    			Location:  pulumi.String("us-central1"),
    			Network:   defaultNetwork.ID(),
    			InitialUser: &alloydb.ClusterInitialUserArgs{
    				Password: pulumi.String("cluster_secret"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		privateIpAlloc, err := compute.NewGlobalAddress(ctx, "private_ip_alloc", &compute.GlobalAddressArgs{
    			Name:         pulumi.String("alloydb-cluster"),
    			AddressType:  pulumi.String("INTERNAL"),
    			Purpose:      pulumi.String("VPC_PEERING"),
    			PrefixLength: pulumi.Int(16),
    			Network:      defaultNetwork.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		vpcConnection, err := servicenetworking.NewConnection(ctx, "vpc_connection", &servicenetworking.ConnectionArgs{
    			Network: defaultNetwork.ID(),
    			Service: pulumi.String("servicenetworking.googleapis.com"),
    			ReservedPeeringRanges: pulumi.StringArray{
    				privateIpAlloc.Name,
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = alloydb.NewInstance(ctx, "default", &alloydb.InstanceArgs{
    			Cluster:      defaultCluster.Name,
    			InstanceId:   pulumi.String("alloydb-instance"),
    			InstanceType: pulumi.String("PRIMARY"),
    		}, pulumi.DependsOn([]pulumi.Resource{
    			vpcConnection,
    		}))
    		if err != nil {
    			return err
    		}
    		_, err = organizations.LookupProject(ctx, nil, nil)
    		if err != nil {
    			return err
    		}
    		_, err = alloydb.NewUser(ctx, "user2", &alloydb.UserArgs{
    			Cluster:  defaultCluster.Name,
    			UserId:   pulumi.String("user2@foo.com"),
    			UserType: pulumi.String("ALLOYDB_IAM_USER"),
    			DatabaseRoles: pulumi.StringArray{
    				pulumi.String("alloydbiamuser"),
    			},
    		}, pulumi.DependsOn([]pulumi.Resource{
    			_default,
    		}))
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var defaultNetwork = new Gcp.Compute.Network("default", new()
        {
            Name = "alloydb-network",
        });
    
        var defaultCluster = new Gcp.Alloydb.Cluster("default", new()
        {
            ClusterId = "alloydb-cluster",
            Location = "us-central1",
            Network = defaultNetwork.Id,
            InitialUser = new Gcp.Alloydb.Inputs.ClusterInitialUserArgs
            {
                Password = "cluster_secret",
            },
        });
    
        var privateIpAlloc = new Gcp.Compute.GlobalAddress("private_ip_alloc", new()
        {
            Name = "alloydb-cluster",
            AddressType = "INTERNAL",
            Purpose = "VPC_PEERING",
            PrefixLength = 16,
            Network = defaultNetwork.Id,
        });
    
        var vpcConnection = new Gcp.ServiceNetworking.Connection("vpc_connection", new()
        {
            Network = defaultNetwork.Id,
            Service = "servicenetworking.googleapis.com",
            ReservedPeeringRanges = new[]
            {
                privateIpAlloc.Name,
            },
        });
    
        var @default = new Gcp.Alloydb.Instance("default", new()
        {
            Cluster = defaultCluster.Name,
            InstanceId = "alloydb-instance",
            InstanceType = "PRIMARY",
        }, new CustomResourceOptions
        {
            DependsOn =
            {
                vpcConnection,
            },
        });
    
        var project = Gcp.Organizations.GetProject.Invoke();
    
        var user2 = new Gcp.Alloydb.User("user2", new()
        {
            Cluster = defaultCluster.Name,
            UserId = "user2@foo.com",
            UserType = "ALLOYDB_IAM_USER",
            DatabaseRoles = new[]
            {
                "alloydbiamuser",
            },
        }, new CustomResourceOptions
        {
            DependsOn =
            {
                @default,
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.compute.Network;
    import com.pulumi.gcp.compute.NetworkArgs;
    import com.pulumi.gcp.alloydb.Cluster;
    import com.pulumi.gcp.alloydb.ClusterArgs;
    import com.pulumi.gcp.alloydb.inputs.ClusterInitialUserArgs;
    import com.pulumi.gcp.compute.GlobalAddress;
    import com.pulumi.gcp.compute.GlobalAddressArgs;
    import com.pulumi.gcp.servicenetworking.Connection;
    import com.pulumi.gcp.servicenetworking.ConnectionArgs;
    import com.pulumi.gcp.alloydb.Instance;
    import com.pulumi.gcp.alloydb.InstanceArgs;
    import com.pulumi.gcp.organizations.OrganizationsFunctions;
    import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
    import com.pulumi.gcp.alloydb.User;
    import com.pulumi.gcp.alloydb.UserArgs;
    import com.pulumi.resources.CustomResourceOptions;
    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 defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder()
                .name("alloydb-network")
                .build());
    
            var defaultCluster = new Cluster("defaultCluster", ClusterArgs.builder()
                .clusterId("alloydb-cluster")
                .location("us-central1")
                .network(defaultNetwork.id())
                .initialUser(ClusterInitialUserArgs.builder()
                    .password("cluster_secret")
                    .build())
                .build());
    
            var privateIpAlloc = new GlobalAddress("privateIpAlloc", GlobalAddressArgs.builder()
                .name("alloydb-cluster")
                .addressType("INTERNAL")
                .purpose("VPC_PEERING")
                .prefixLength(16)
                .network(defaultNetwork.id())
                .build());
    
            var vpcConnection = new Connection("vpcConnection", ConnectionArgs.builder()
                .network(defaultNetwork.id())
                .service("servicenetworking.googleapis.com")
                .reservedPeeringRanges(privateIpAlloc.name())
                .build());
    
            var default_ = new Instance("default", InstanceArgs.builder()
                .cluster(defaultCluster.name())
                .instanceId("alloydb-instance")
                .instanceType("PRIMARY")
                .build(), CustomResourceOptions.builder()
                    .dependsOn(vpcConnection)
                    .build());
    
            final var project = OrganizationsFunctions.getProject();
    
            var user2 = new User("user2", UserArgs.builder()
                .cluster(defaultCluster.name())
                .userId("user2@foo.com")
                .userType("ALLOYDB_IAM_USER")
                .databaseRoles("alloydbiamuser")
                .build(), CustomResourceOptions.builder()
                    .dependsOn(default_)
                    .build());
    
        }
    }
    
    resources:
      default:
        type: gcp:alloydb:Instance
        properties:
          cluster: ${defaultCluster.name}
          instanceId: alloydb-instance
          instanceType: PRIMARY
        options:
          dependson:
            - ${vpcConnection}
      defaultCluster:
        type: gcp:alloydb:Cluster
        name: default
        properties:
          clusterId: alloydb-cluster
          location: us-central1
          network: ${defaultNetwork.id}
          initialUser:
            password: cluster_secret
      defaultNetwork:
        type: gcp:compute:Network
        name: default
        properties:
          name: alloydb-network
      privateIpAlloc:
        type: gcp:compute:GlobalAddress
        name: private_ip_alloc
        properties:
          name: alloydb-cluster
          addressType: INTERNAL
          purpose: VPC_PEERING
          prefixLength: 16
          network: ${defaultNetwork.id}
      vpcConnection:
        type: gcp:servicenetworking:Connection
        name: vpc_connection
        properties:
          network: ${defaultNetwork.id}
          service: servicenetworking.googleapis.com
          reservedPeeringRanges:
            - ${privateIpAlloc.name}
      user2:
        type: gcp:alloydb:User
        properties:
          cluster: ${defaultCluster.name}
          userId: user2@foo.com
          userType: ALLOYDB_IAM_USER
          databaseRoles:
            - alloydbiamuser
        options:
          dependson:
            - ${default}
    variables:
      project:
        fn::invoke:
          Function: gcp:organizations:getProject
          Arguments: {}
    

    Create User Resource

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

    Constructor syntax

    new User(name: string, args: UserArgs, opts?: CustomResourceOptions);
    @overload
    def User(resource_name: str,
             args: UserArgs,
             opts: Optional[ResourceOptions] = None)
    
    @overload
    def User(resource_name: str,
             opts: Optional[ResourceOptions] = None,
             cluster: Optional[str] = None,
             user_id: Optional[str] = None,
             user_type: Optional[str] = None,
             database_roles: Optional[Sequence[str]] = None,
             password: Optional[str] = None)
    func NewUser(ctx *Context, name string, args UserArgs, opts ...ResourceOption) (*User, error)
    public User(string name, UserArgs args, CustomResourceOptions? opts = null)
    public User(String name, UserArgs args)
    public User(String name, UserArgs args, CustomResourceOptions options)
    
    type: gcp:alloydb:User
    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 UserArgs
    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 UserArgs
    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 UserArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args UserArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args UserArgs
    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 userResource = new Gcp.Alloydb.User("userResource", new()
    {
        Cluster = "string",
        UserId = "string",
        UserType = "string",
        DatabaseRoles = new[]
        {
            "string",
        },
        Password = "string",
    });
    
    example, err := alloydb.NewUser(ctx, "userResource", &alloydb.UserArgs{
    	Cluster:  pulumi.String("string"),
    	UserId:   pulumi.String("string"),
    	UserType: pulumi.String("string"),
    	DatabaseRoles: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	Password: pulumi.String("string"),
    })
    
    var userResource = new User("userResource", UserArgs.builder()
        .cluster("string")
        .userId("string")
        .userType("string")
        .databaseRoles("string")
        .password("string")
        .build());
    
    user_resource = gcp.alloydb.User("userResource",
        cluster="string",
        user_id="string",
        user_type="string",
        database_roles=["string"],
        password="string")
    
    const userResource = new gcp.alloydb.User("userResource", {
        cluster: "string",
        userId: "string",
        userType: "string",
        databaseRoles: ["string"],
        password: "string",
    });
    
    type: gcp:alloydb:User
    properties:
        cluster: string
        databaseRoles:
            - string
        password: string
        userId: string
        userType: string
    

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

    Cluster string
    Identifies the alloydb cluster. Must be in the format 'projects/{project}/locations/{location}/clusters/{cluster_id}'
    UserId string
    The database role name of the user.
    UserType string
    The type of this user. Possible values are: ALLOYDB_BUILT_IN, ALLOYDB_IAM_USER.


    DatabaseRoles List<string>
    List of database roles this database user has.
    Password string
    Password for this database user.
    Cluster string
    Identifies the alloydb cluster. Must be in the format 'projects/{project}/locations/{location}/clusters/{cluster_id}'
    UserId string
    The database role name of the user.
    UserType string
    The type of this user. Possible values are: ALLOYDB_BUILT_IN, ALLOYDB_IAM_USER.


    DatabaseRoles []string
    List of database roles this database user has.
    Password string
    Password for this database user.
    cluster String
    Identifies the alloydb cluster. Must be in the format 'projects/{project}/locations/{location}/clusters/{cluster_id}'
    userId String
    The database role name of the user.
    userType String
    The type of this user. Possible values are: ALLOYDB_BUILT_IN, ALLOYDB_IAM_USER.


    databaseRoles List<String>
    List of database roles this database user has.
    password String
    Password for this database user.
    cluster string
    Identifies the alloydb cluster. Must be in the format 'projects/{project}/locations/{location}/clusters/{cluster_id}'
    userId string
    The database role name of the user.
    userType string
    The type of this user. Possible values are: ALLOYDB_BUILT_IN, ALLOYDB_IAM_USER.


    databaseRoles string[]
    List of database roles this database user has.
    password string
    Password for this database user.
    cluster str
    Identifies the alloydb cluster. Must be in the format 'projects/{project}/locations/{location}/clusters/{cluster_id}'
    user_id str
    The database role name of the user.
    user_type str
    The type of this user. Possible values are: ALLOYDB_BUILT_IN, ALLOYDB_IAM_USER.


    database_roles Sequence[str]
    List of database roles this database user has.
    password str
    Password for this database user.
    cluster String
    Identifies the alloydb cluster. Must be in the format 'projects/{project}/locations/{location}/clusters/{cluster_id}'
    userId String
    The database role name of the user.
    userType String
    The type of this user. Possible values are: ALLOYDB_BUILT_IN, ALLOYDB_IAM_USER.


    databaseRoles List<String>
    List of database roles this database user has.
    password String
    Password for this database user.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the User resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    Name of the resource in the form of projects/{project}/locations/{location}/clusters/{cluster}/users/{user}.
    Id string
    The provider-assigned unique ID for this managed resource.
    Name string
    Name of the resource in the form of projects/{project}/locations/{location}/clusters/{cluster}/users/{user}.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    Name of the resource in the form of projects/{project}/locations/{location}/clusters/{cluster}/users/{user}.
    id string
    The provider-assigned unique ID for this managed resource.
    name string
    Name of the resource in the form of projects/{project}/locations/{location}/clusters/{cluster}/users/{user}.
    id str
    The provider-assigned unique ID for this managed resource.
    name str
    Name of the resource in the form of projects/{project}/locations/{location}/clusters/{cluster}/users/{user}.
    id String
    The provider-assigned unique ID for this managed resource.
    name String
    Name of the resource in the form of projects/{project}/locations/{location}/clusters/{cluster}/users/{user}.

    Look up Existing User Resource

    Get an existing User 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?: UserState, opts?: CustomResourceOptions): User
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            cluster: Optional[str] = None,
            database_roles: Optional[Sequence[str]] = None,
            name: Optional[str] = None,
            password: Optional[str] = None,
            user_id: Optional[str] = None,
            user_type: Optional[str] = None) -> User
    func GetUser(ctx *Context, name string, id IDInput, state *UserState, opts ...ResourceOption) (*User, error)
    public static User Get(string name, Input<string> id, UserState? state, CustomResourceOptions? opts = null)
    public static User get(String name, Output<String> id, UserState 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:
    Cluster string
    Identifies the alloydb cluster. Must be in the format 'projects/{project}/locations/{location}/clusters/{cluster_id}'
    DatabaseRoles List<string>
    List of database roles this database user has.
    Name string
    Name of the resource in the form of projects/{project}/locations/{location}/clusters/{cluster}/users/{user}.
    Password string
    Password for this database user.
    UserId string
    The database role name of the user.
    UserType string
    The type of this user. Possible values are: ALLOYDB_BUILT_IN, ALLOYDB_IAM_USER.


    Cluster string
    Identifies the alloydb cluster. Must be in the format 'projects/{project}/locations/{location}/clusters/{cluster_id}'
    DatabaseRoles []string
    List of database roles this database user has.
    Name string
    Name of the resource in the form of projects/{project}/locations/{location}/clusters/{cluster}/users/{user}.
    Password string
    Password for this database user.
    UserId string
    The database role name of the user.
    UserType string
    The type of this user. Possible values are: ALLOYDB_BUILT_IN, ALLOYDB_IAM_USER.


    cluster String
    Identifies the alloydb cluster. Must be in the format 'projects/{project}/locations/{location}/clusters/{cluster_id}'
    databaseRoles List<String>
    List of database roles this database user has.
    name String
    Name of the resource in the form of projects/{project}/locations/{location}/clusters/{cluster}/users/{user}.
    password String
    Password for this database user.
    userId String
    The database role name of the user.
    userType String
    The type of this user. Possible values are: ALLOYDB_BUILT_IN, ALLOYDB_IAM_USER.


    cluster string
    Identifies the alloydb cluster. Must be in the format 'projects/{project}/locations/{location}/clusters/{cluster_id}'
    databaseRoles string[]
    List of database roles this database user has.
    name string
    Name of the resource in the form of projects/{project}/locations/{location}/clusters/{cluster}/users/{user}.
    password string
    Password for this database user.
    userId string
    The database role name of the user.
    userType string
    The type of this user. Possible values are: ALLOYDB_BUILT_IN, ALLOYDB_IAM_USER.


    cluster str
    Identifies the alloydb cluster. Must be in the format 'projects/{project}/locations/{location}/clusters/{cluster_id}'
    database_roles Sequence[str]
    List of database roles this database user has.
    name str
    Name of the resource in the form of projects/{project}/locations/{location}/clusters/{cluster}/users/{user}.
    password str
    Password for this database user.
    user_id str
    The database role name of the user.
    user_type str
    The type of this user. Possible values are: ALLOYDB_BUILT_IN, ALLOYDB_IAM_USER.


    cluster String
    Identifies the alloydb cluster. Must be in the format 'projects/{project}/locations/{location}/clusters/{cluster_id}'
    databaseRoles List<String>
    List of database roles this database user has.
    name String
    Name of the resource in the form of projects/{project}/locations/{location}/clusters/{cluster}/users/{user}.
    password String
    Password for this database user.
    userId String
    The database role name of the user.
    userType String
    The type of this user. Possible values are: ALLOYDB_BUILT_IN, ALLOYDB_IAM_USER.


    Import

    User can be imported using any of these accepted formats:

    • projects/{{project}}/locations/{{location}}/clusters/{{cluster}}/users/{{user_id}}

    • {{project}}/{{location}}/{{cluster}}/{{user_id}}

    • {{location}}/{{cluster}}/{{user_id}}

    When using the pulumi import command, User can be imported using one of the formats above. For example:

    $ pulumi import gcp:alloydb/user:User default projects/{{project}}/locations/{{location}}/clusters/{{cluster}}/users/{{user_id}}
    
    $ pulumi import gcp:alloydb/user:User default {{project}}/{{location}}/{{cluster}}/{{user_id}}
    
    $ pulumi import gcp:alloydb/user:User default {{location}}/{{cluster}}/{{user_id}}
    

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

    Package Details

    Repository
    Google Cloud (GCP) Classic pulumi/pulumi-gcp
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the google-beta Terraform Provider.
    gcp logo
    Google Cloud Classic v7.29.0 published on Wednesday, Jun 26, 2024 by Pulumi