1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. redis
  5. ClusterUserCreatedConnections
Google Cloud v8.26.0 published on Thursday, Apr 10, 2025 by Pulumi

gcp.redis.ClusterUserCreatedConnections

Explore with Pulumi AI

Example Usage

Redis Cluster User Created Connections

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const network1 = new gcp.compute.Network("network1", {
    name: "net1",
    autoCreateSubnetworks: false,
});
const subnetNetwork1 = new gcp.compute.Subnetwork("subnet_network1", {
    name: "subnet-net1",
    ipCidrRange: "10.0.0.248/29",
    region: "us-central1",
    network: network1.id,
});
const ip1Network1 = new gcp.compute.Address("ip1_network1", {
    name: "ip1-net1",
    region: "us-central1",
    subnetwork: subnetNetwork1.id,
    addressType: "INTERNAL",
    purpose: "GCE_ENDPOINT",
});
// redis cluster without endpoint
const cluster_user_connCluster = new gcp.redis.Cluster("cluster-user-conn", {
    name: "cluster-user-conn",
    shardCount: 3,
    region: "us-central1",
    replicaCount: 0,
    deletionProtectionEnabled: false,
});
const forwardingRule1Network1 = new gcp.compute.ForwardingRule("forwarding_rule1_network1", {
    name: "fwd1-net1",
    region: "us-central1",
    ipAddress: ip1Network1.id,
    loadBalancingScheme: "",
    network: network1.id,
    target: cluster_user_connCluster.pscServiceAttachments.apply(pscServiceAttachments => pscServiceAttachments[0].serviceAttachment),
});
const ip2Network1 = new gcp.compute.Address("ip2_network1", {
    name: "ip2-net1",
    region: "us-central1",
    subnetwork: subnetNetwork1.id,
    addressType: "INTERNAL",
    purpose: "GCE_ENDPOINT",
});
const forwardingRule2Network1 = new gcp.compute.ForwardingRule("forwarding_rule2_network1", {
    name: "fwd2-net1",
    region: "us-central1",
    ipAddress: ip2Network1.id,
    loadBalancingScheme: "",
    network: network1.id,
    target: cluster_user_connCluster.pscServiceAttachments.apply(pscServiceAttachments => pscServiceAttachments[1].serviceAttachment),
});
const network2 = new gcp.compute.Network("network2", {
    name: "network2",
    autoCreateSubnetworks: false,
});
const subnetNetwork2 = new gcp.compute.Subnetwork("subnet_network2", {
    name: "subnet-net2",
    ipCidrRange: "10.0.0.248/29",
    region: "us-central1",
    network: network2.id,
});
const ip1Network2 = new gcp.compute.Address("ip1_network2", {
    name: "ip1-net2",
    region: "us-central1",
    subnetwork: subnetNetwork2.id,
    addressType: "INTERNAL",
    purpose: "GCE_ENDPOINT",
});
const forwardingRule1Network2 = new gcp.compute.ForwardingRule("forwarding_rule1_network2", {
    name: "fwd1-net2",
    region: "us-central1",
    ipAddress: ip1Network2.id,
    loadBalancingScheme: "",
    network: network2.id,
    target: cluster_user_connCluster.pscServiceAttachments.apply(pscServiceAttachments => pscServiceAttachments[0].serviceAttachment),
});
const ip2Network2 = new gcp.compute.Address("ip2_network2", {
    name: "ip2-net2",
    region: "us-central1",
    subnetwork: subnetNetwork2.id,
    addressType: "INTERNAL",
    purpose: "GCE_ENDPOINT",
});
const forwardingRule2Network2 = new gcp.compute.ForwardingRule("forwarding_rule2_network2", {
    name: "fwd2-net2",
    region: "us-central1",
    ipAddress: ip2Network2.id,
    loadBalancingScheme: "",
    network: network2.id,
    target: cluster_user_connCluster.pscServiceAttachments.apply(pscServiceAttachments => pscServiceAttachments[1].serviceAttachment),
});
const project = gcp.organizations.getProject({});
const cluster_user_conn = new gcp.redis.ClusterUserCreatedConnections("cluster-user-conn", {
    name: "cluster-user-conn",
    region: "us-central1",
    clusterEndpoints: [
        {
            connections: [
                {
                    pscConnection: {
                        pscConnectionId: forwardingRule1Network1.pscConnectionId,
                        address: ip1Network1.address,
                        forwardingRule: forwardingRule1Network1.id,
                        network: network1.id,
                        projectId: project.then(project => project.projectId),
                        serviceAttachment: cluster_user_connCluster.pscServiceAttachments.apply(pscServiceAttachments => pscServiceAttachments[0].serviceAttachment),
                    },
                },
                {
                    pscConnection: {
                        pscConnectionId: forwardingRule2Network1.pscConnectionId,
                        address: ip2Network1.address,
                        forwardingRule: forwardingRule2Network1.id,
                        network: network1.id,
                        serviceAttachment: cluster_user_connCluster.pscServiceAttachments.apply(pscServiceAttachments => pscServiceAttachments[1].serviceAttachment),
                    },
                },
            ],
        },
        {
            connections: [
                {
                    pscConnection: {
                        pscConnectionId: forwardingRule1Network2.pscConnectionId,
                        address: ip1Network2.address,
                        forwardingRule: forwardingRule1Network2.id,
                        network: network2.id,
                        serviceAttachment: cluster_user_connCluster.pscServiceAttachments.apply(pscServiceAttachments => pscServiceAttachments[0].serviceAttachment),
                    },
                },
                {
                    pscConnection: {
                        pscConnectionId: forwardingRule2Network2.pscConnectionId,
                        address: ip2Network2.address,
                        forwardingRule: forwardingRule2Network2.id,
                        network: network2.id,
                        serviceAttachment: cluster_user_connCluster.pscServiceAttachments.apply(pscServiceAttachments => pscServiceAttachments[1].serviceAttachment),
                    },
                },
            ],
        },
    ],
});
Copy
import pulumi
import pulumi_gcp as gcp

network1 = gcp.compute.Network("network1",
    name="net1",
    auto_create_subnetworks=False)
subnet_network1 = gcp.compute.Subnetwork("subnet_network1",
    name="subnet-net1",
    ip_cidr_range="10.0.0.248/29",
    region="us-central1",
    network=network1.id)
ip1_network1 = gcp.compute.Address("ip1_network1",
    name="ip1-net1",
    region="us-central1",
    subnetwork=subnet_network1.id,
    address_type="INTERNAL",
    purpose="GCE_ENDPOINT")
# redis cluster without endpoint
cluster_user_conn_cluster = gcp.redis.Cluster("cluster-user-conn",
    name="cluster-user-conn",
    shard_count=3,
    region="us-central1",
    replica_count=0,
    deletion_protection_enabled=False)
forwarding_rule1_network1 = gcp.compute.ForwardingRule("forwarding_rule1_network1",
    name="fwd1-net1",
    region="us-central1",
    ip_address=ip1_network1.id,
    load_balancing_scheme="",
    network=network1.id,
    target=cluster_user_conn_cluster.psc_service_attachments[0].service_attachment)
ip2_network1 = gcp.compute.Address("ip2_network1",
    name="ip2-net1",
    region="us-central1",
    subnetwork=subnet_network1.id,
    address_type="INTERNAL",
    purpose="GCE_ENDPOINT")
forwarding_rule2_network1 = gcp.compute.ForwardingRule("forwarding_rule2_network1",
    name="fwd2-net1",
    region="us-central1",
    ip_address=ip2_network1.id,
    load_balancing_scheme="",
    network=network1.id,
    target=cluster_user_conn_cluster.psc_service_attachments[1].service_attachment)
network2 = gcp.compute.Network("network2",
    name="network2",
    auto_create_subnetworks=False)
subnet_network2 = gcp.compute.Subnetwork("subnet_network2",
    name="subnet-net2",
    ip_cidr_range="10.0.0.248/29",
    region="us-central1",
    network=network2.id)
ip1_network2 = gcp.compute.Address("ip1_network2",
    name="ip1-net2",
    region="us-central1",
    subnetwork=subnet_network2.id,
    address_type="INTERNAL",
    purpose="GCE_ENDPOINT")
forwarding_rule1_network2 = gcp.compute.ForwardingRule("forwarding_rule1_network2",
    name="fwd1-net2",
    region="us-central1",
    ip_address=ip1_network2.id,
    load_balancing_scheme="",
    network=network2.id,
    target=cluster_user_conn_cluster.psc_service_attachments[0].service_attachment)
ip2_network2 = gcp.compute.Address("ip2_network2",
    name="ip2-net2",
    region="us-central1",
    subnetwork=subnet_network2.id,
    address_type="INTERNAL",
    purpose="GCE_ENDPOINT")
forwarding_rule2_network2 = gcp.compute.ForwardingRule("forwarding_rule2_network2",
    name="fwd2-net2",
    region="us-central1",
    ip_address=ip2_network2.id,
    load_balancing_scheme="",
    network=network2.id,
    target=cluster_user_conn_cluster.psc_service_attachments[1].service_attachment)
project = gcp.organizations.get_project()
cluster_user_conn = gcp.redis.ClusterUserCreatedConnections("cluster-user-conn",
    name="cluster-user-conn",
    region="us-central1",
    cluster_endpoints=[
        {
            "connections": [
                {
                    "psc_connection": {
                        "psc_connection_id": forwarding_rule1_network1.psc_connection_id,
                        "address": ip1_network1.address,
                        "forwarding_rule": forwarding_rule1_network1.id,
                        "network": network1.id,
                        "project_id": project.project_id,
                        "service_attachment": cluster_user_conn_cluster.psc_service_attachments[0].service_attachment,
                    },
                },
                {
                    "psc_connection": {
                        "psc_connection_id": forwarding_rule2_network1.psc_connection_id,
                        "address": ip2_network1.address,
                        "forwarding_rule": forwarding_rule2_network1.id,
                        "network": network1.id,
                        "service_attachment": cluster_user_conn_cluster.psc_service_attachments[1].service_attachment,
                    },
                },
            ],
        },
        {
            "connections": [
                {
                    "psc_connection": {
                        "psc_connection_id": forwarding_rule1_network2.psc_connection_id,
                        "address": ip1_network2.address,
                        "forwarding_rule": forwarding_rule1_network2.id,
                        "network": network2.id,
                        "service_attachment": cluster_user_conn_cluster.psc_service_attachments[0].service_attachment,
                    },
                },
                {
                    "psc_connection": {
                        "psc_connection_id": forwarding_rule2_network2.psc_connection_id,
                        "address": ip2_network2.address,
                        "forwarding_rule": forwarding_rule2_network2.id,
                        "network": network2.id,
                        "service_attachment": cluster_user_conn_cluster.psc_service_attachments[1].service_attachment,
                    },
                },
            ],
        },
    ])
Copy
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/compute"
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/organizations"
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/redis"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		network1, err := compute.NewNetwork(ctx, "network1", &compute.NetworkArgs{
			Name:                  pulumi.String("net1"),
			AutoCreateSubnetworks: pulumi.Bool(false),
		})
		if err != nil {
			return err
		}
		subnetNetwork1, err := compute.NewSubnetwork(ctx, "subnet_network1", &compute.SubnetworkArgs{
			Name:        pulumi.String("subnet-net1"),
			IpCidrRange: pulumi.String("10.0.0.248/29"),
			Region:      pulumi.String("us-central1"),
			Network:     network1.ID(),
		})
		if err != nil {
			return err
		}
		ip1Network1, err := compute.NewAddress(ctx, "ip1_network1", &compute.AddressArgs{
			Name:        pulumi.String("ip1-net1"),
			Region:      pulumi.String("us-central1"),
			Subnetwork:  subnetNetwork1.ID(),
			AddressType: pulumi.String("INTERNAL"),
			Purpose:     pulumi.String("GCE_ENDPOINT"),
		})
		if err != nil {
			return err
		}
		// redis cluster without endpoint
		cluster_user_connCluster, err := redis.NewCluster(ctx, "cluster-user-conn", &redis.ClusterArgs{
			Name:                      pulumi.String("cluster-user-conn"),
			ShardCount:                pulumi.Int(3),
			Region:                    pulumi.String("us-central1"),
			ReplicaCount:              pulumi.Int(0),
			DeletionProtectionEnabled: pulumi.Bool(false),
		})
		if err != nil {
			return err
		}
		forwardingRule1Network1, err := compute.NewForwardingRule(ctx, "forwarding_rule1_network1", &compute.ForwardingRuleArgs{
			Name:                pulumi.String("fwd1-net1"),
			Region:              pulumi.String("us-central1"),
			IpAddress:           ip1Network1.ID(),
			LoadBalancingScheme: pulumi.String(""),
			Network:             network1.ID(),
			Target: pulumi.String(cluster_user_connCluster.PscServiceAttachments.ApplyT(func(pscServiceAttachments []redis.ClusterPscServiceAttachment) (*string, error) {
				return &pscServiceAttachments[0].ServiceAttachment, nil
			}).(pulumi.StringPtrOutput)),
		})
		if err != nil {
			return err
		}
		ip2Network1, err := compute.NewAddress(ctx, "ip2_network1", &compute.AddressArgs{
			Name:        pulumi.String("ip2-net1"),
			Region:      pulumi.String("us-central1"),
			Subnetwork:  subnetNetwork1.ID(),
			AddressType: pulumi.String("INTERNAL"),
			Purpose:     pulumi.String("GCE_ENDPOINT"),
		})
		if err != nil {
			return err
		}
		forwardingRule2Network1, err := compute.NewForwardingRule(ctx, "forwarding_rule2_network1", &compute.ForwardingRuleArgs{
			Name:                pulumi.String("fwd2-net1"),
			Region:              pulumi.String("us-central1"),
			IpAddress:           ip2Network1.ID(),
			LoadBalancingScheme: pulumi.String(""),
			Network:             network1.ID(),
			Target: pulumi.String(cluster_user_connCluster.PscServiceAttachments.ApplyT(func(pscServiceAttachments []redis.ClusterPscServiceAttachment) (*string, error) {
				return &pscServiceAttachments[1].ServiceAttachment, nil
			}).(pulumi.StringPtrOutput)),
		})
		if err != nil {
			return err
		}
		network2, err := compute.NewNetwork(ctx, "network2", &compute.NetworkArgs{
			Name:                  pulumi.String("network2"),
			AutoCreateSubnetworks: pulumi.Bool(false),
		})
		if err != nil {
			return err
		}
		subnetNetwork2, err := compute.NewSubnetwork(ctx, "subnet_network2", &compute.SubnetworkArgs{
			Name:        pulumi.String("subnet-net2"),
			IpCidrRange: pulumi.String("10.0.0.248/29"),
			Region:      pulumi.String("us-central1"),
			Network:     network2.ID(),
		})
		if err != nil {
			return err
		}
		ip1Network2, err := compute.NewAddress(ctx, "ip1_network2", &compute.AddressArgs{
			Name:        pulumi.String("ip1-net2"),
			Region:      pulumi.String("us-central1"),
			Subnetwork:  subnetNetwork2.ID(),
			AddressType: pulumi.String("INTERNAL"),
			Purpose:     pulumi.String("GCE_ENDPOINT"),
		})
		if err != nil {
			return err
		}
		forwardingRule1Network2, err := compute.NewForwardingRule(ctx, "forwarding_rule1_network2", &compute.ForwardingRuleArgs{
			Name:                pulumi.String("fwd1-net2"),
			Region:              pulumi.String("us-central1"),
			IpAddress:           ip1Network2.ID(),
			LoadBalancingScheme: pulumi.String(""),
			Network:             network2.ID(),
			Target: pulumi.String(cluster_user_connCluster.PscServiceAttachments.ApplyT(func(pscServiceAttachments []redis.ClusterPscServiceAttachment) (*string, error) {
				return &pscServiceAttachments[0].ServiceAttachment, nil
			}).(pulumi.StringPtrOutput)),
		})
		if err != nil {
			return err
		}
		ip2Network2, err := compute.NewAddress(ctx, "ip2_network2", &compute.AddressArgs{
			Name:        pulumi.String("ip2-net2"),
			Region:      pulumi.String("us-central1"),
			Subnetwork:  subnetNetwork2.ID(),
			AddressType: pulumi.String("INTERNAL"),
			Purpose:     pulumi.String("GCE_ENDPOINT"),
		})
		if err != nil {
			return err
		}
		forwardingRule2Network2, err := compute.NewForwardingRule(ctx, "forwarding_rule2_network2", &compute.ForwardingRuleArgs{
			Name:                pulumi.String("fwd2-net2"),
			Region:              pulumi.String("us-central1"),
			IpAddress:           ip2Network2.ID(),
			LoadBalancingScheme: pulumi.String(""),
			Network:             network2.ID(),
			Target: pulumi.String(cluster_user_connCluster.PscServiceAttachments.ApplyT(func(pscServiceAttachments []redis.ClusterPscServiceAttachment) (*string, error) {
				return &pscServiceAttachments[1].ServiceAttachment, nil
			}).(pulumi.StringPtrOutput)),
		})
		if err != nil {
			return err
		}
		project, err := organizations.LookupProject(ctx, &organizations.LookupProjectArgs{}, nil)
		if err != nil {
			return err
		}
		_, err = redis.NewClusterUserCreatedConnections(ctx, "cluster-user-conn", &redis.ClusterUserCreatedConnectionsArgs{
			Name:   pulumi.String("cluster-user-conn"),
			Region: pulumi.String("us-central1"),
			ClusterEndpoints: redis.ClusterUserCreatedConnectionsClusterEndpointArray{
				&redis.ClusterUserCreatedConnectionsClusterEndpointArgs{
					Connections: redis.ClusterUserCreatedConnectionsClusterEndpointConnectionArray{
						&redis.ClusterUserCreatedConnectionsClusterEndpointConnectionArgs{
							PscConnection: &redis.ClusterUserCreatedConnectionsClusterEndpointConnectionPscConnectionArgs{
								PscConnectionId: forwardingRule1Network1.PscConnectionId,
								Address:         ip1Network1.Address,
								ForwardingRule:  forwardingRule1Network1.ID(),
								Network:         network1.ID(),
								ProjectId:       pulumi.String(project.ProjectId),
								ServiceAttachment: cluster_user_connCluster.PscServiceAttachments.ApplyT(func(pscServiceAttachments []redis.ClusterPscServiceAttachment) (*string, error) {
									return &pscServiceAttachments[0].ServiceAttachment, nil
								}).(pulumi.StringPtrOutput),
							},
						},
						&redis.ClusterUserCreatedConnectionsClusterEndpointConnectionArgs{
							PscConnection: &redis.ClusterUserCreatedConnectionsClusterEndpointConnectionPscConnectionArgs{
								PscConnectionId: forwardingRule2Network1.PscConnectionId,
								Address:         ip2Network1.Address,
								ForwardingRule:  forwardingRule2Network1.ID(),
								Network:         network1.ID(),
								ServiceAttachment: cluster_user_connCluster.PscServiceAttachments.ApplyT(func(pscServiceAttachments []redis.ClusterPscServiceAttachment) (*string, error) {
									return &pscServiceAttachments[1].ServiceAttachment, nil
								}).(pulumi.StringPtrOutput),
							},
						},
					},
				},
				&redis.ClusterUserCreatedConnectionsClusterEndpointArgs{
					Connections: redis.ClusterUserCreatedConnectionsClusterEndpointConnectionArray{
						&redis.ClusterUserCreatedConnectionsClusterEndpointConnectionArgs{
							PscConnection: &redis.ClusterUserCreatedConnectionsClusterEndpointConnectionPscConnectionArgs{
								PscConnectionId: forwardingRule1Network2.PscConnectionId,
								Address:         ip1Network2.Address,
								ForwardingRule:  forwardingRule1Network2.ID(),
								Network:         network2.ID(),
								ServiceAttachment: cluster_user_connCluster.PscServiceAttachments.ApplyT(func(pscServiceAttachments []redis.ClusterPscServiceAttachment) (*string, error) {
									return &pscServiceAttachments[0].ServiceAttachment, nil
								}).(pulumi.StringPtrOutput),
							},
						},
						&redis.ClusterUserCreatedConnectionsClusterEndpointConnectionArgs{
							PscConnection: &redis.ClusterUserCreatedConnectionsClusterEndpointConnectionPscConnectionArgs{
								PscConnectionId: forwardingRule2Network2.PscConnectionId,
								Address:         ip2Network2.Address,
								ForwardingRule:  forwardingRule2Network2.ID(),
								Network:         network2.ID(),
								ServiceAttachment: cluster_user_connCluster.PscServiceAttachments.ApplyT(func(pscServiceAttachments []redis.ClusterPscServiceAttachment) (*string, error) {
									return &pscServiceAttachments[1].ServiceAttachment, nil
								}).(pulumi.StringPtrOutput),
							},
						},
					},
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var network1 = new Gcp.Compute.Network("network1", new()
    {
        Name = "net1",
        AutoCreateSubnetworks = false,
    });

    var subnetNetwork1 = new Gcp.Compute.Subnetwork("subnet_network1", new()
    {
        Name = "subnet-net1",
        IpCidrRange = "10.0.0.248/29",
        Region = "us-central1",
        Network = network1.Id,
    });

    var ip1Network1 = new Gcp.Compute.Address("ip1_network1", new()
    {
        Name = "ip1-net1",
        Region = "us-central1",
        Subnetwork = subnetNetwork1.Id,
        AddressType = "INTERNAL",
        Purpose = "GCE_ENDPOINT",
    });

    // redis cluster without endpoint
    var cluster_user_connCluster = new Gcp.Redis.Cluster("cluster-user-conn", new()
    {
        Name = "cluster-user-conn",
        ShardCount = 3,
        Region = "us-central1",
        ReplicaCount = 0,
        DeletionProtectionEnabled = false,
    });

    var forwardingRule1Network1 = new Gcp.Compute.ForwardingRule("forwarding_rule1_network1", new()
    {
        Name = "fwd1-net1",
        Region = "us-central1",
        IpAddress = ip1Network1.Id,
        LoadBalancingScheme = "",
        Network = network1.Id,
        Target = cluster_user_connCluster.PscServiceAttachments.Apply(pscServiceAttachments => pscServiceAttachments[0].ServiceAttachment),
    });

    var ip2Network1 = new Gcp.Compute.Address("ip2_network1", new()
    {
        Name = "ip2-net1",
        Region = "us-central1",
        Subnetwork = subnetNetwork1.Id,
        AddressType = "INTERNAL",
        Purpose = "GCE_ENDPOINT",
    });

    var forwardingRule2Network1 = new Gcp.Compute.ForwardingRule("forwarding_rule2_network1", new()
    {
        Name = "fwd2-net1",
        Region = "us-central1",
        IpAddress = ip2Network1.Id,
        LoadBalancingScheme = "",
        Network = network1.Id,
        Target = cluster_user_connCluster.PscServiceAttachments.Apply(pscServiceAttachments => pscServiceAttachments[1].ServiceAttachment),
    });

    var network2 = new Gcp.Compute.Network("network2", new()
    {
        Name = "network2",
        AutoCreateSubnetworks = false,
    });

    var subnetNetwork2 = new Gcp.Compute.Subnetwork("subnet_network2", new()
    {
        Name = "subnet-net2",
        IpCidrRange = "10.0.0.248/29",
        Region = "us-central1",
        Network = network2.Id,
    });

    var ip1Network2 = new Gcp.Compute.Address("ip1_network2", new()
    {
        Name = "ip1-net2",
        Region = "us-central1",
        Subnetwork = subnetNetwork2.Id,
        AddressType = "INTERNAL",
        Purpose = "GCE_ENDPOINT",
    });

    var forwardingRule1Network2 = new Gcp.Compute.ForwardingRule("forwarding_rule1_network2", new()
    {
        Name = "fwd1-net2",
        Region = "us-central1",
        IpAddress = ip1Network2.Id,
        LoadBalancingScheme = "",
        Network = network2.Id,
        Target = cluster_user_connCluster.PscServiceAttachments.Apply(pscServiceAttachments => pscServiceAttachments[0].ServiceAttachment),
    });

    var ip2Network2 = new Gcp.Compute.Address("ip2_network2", new()
    {
        Name = "ip2-net2",
        Region = "us-central1",
        Subnetwork = subnetNetwork2.Id,
        AddressType = "INTERNAL",
        Purpose = "GCE_ENDPOINT",
    });

    var forwardingRule2Network2 = new Gcp.Compute.ForwardingRule("forwarding_rule2_network2", new()
    {
        Name = "fwd2-net2",
        Region = "us-central1",
        IpAddress = ip2Network2.Id,
        LoadBalancingScheme = "",
        Network = network2.Id,
        Target = cluster_user_connCluster.PscServiceAttachments.Apply(pscServiceAttachments => pscServiceAttachments[1].ServiceAttachment),
    });

    var project = Gcp.Organizations.GetProject.Invoke();

    var cluster_user_conn = new Gcp.Redis.ClusterUserCreatedConnections("cluster-user-conn", new()
    {
        Name = "cluster-user-conn",
        Region = "us-central1",
        ClusterEndpoints = new[]
        {
            new Gcp.Redis.Inputs.ClusterUserCreatedConnectionsClusterEndpointArgs
            {
                Connections = new[]
                {
                    new Gcp.Redis.Inputs.ClusterUserCreatedConnectionsClusterEndpointConnectionArgs
                    {
                        PscConnection = new Gcp.Redis.Inputs.ClusterUserCreatedConnectionsClusterEndpointConnectionPscConnectionArgs
                        {
                            PscConnectionId = forwardingRule1Network1.PscConnectionId,
                            Address = ip1Network1.IPAddress,
                            ForwardingRule = forwardingRule1Network1.Id,
                            Network = network1.Id,
                            ProjectId = project.Apply(getProjectResult => getProjectResult.ProjectId),
                            ServiceAttachment = cluster_user_connCluster.PscServiceAttachments.Apply(pscServiceAttachments => pscServiceAttachments[0].ServiceAttachment),
                        },
                    },
                    new Gcp.Redis.Inputs.ClusterUserCreatedConnectionsClusterEndpointConnectionArgs
                    {
                        PscConnection = new Gcp.Redis.Inputs.ClusterUserCreatedConnectionsClusterEndpointConnectionPscConnectionArgs
                        {
                            PscConnectionId = forwardingRule2Network1.PscConnectionId,
                            Address = ip2Network1.IPAddress,
                            ForwardingRule = forwardingRule2Network1.Id,
                            Network = network1.Id,
                            ServiceAttachment = cluster_user_connCluster.PscServiceAttachments.Apply(pscServiceAttachments => pscServiceAttachments[1].ServiceAttachment),
                        },
                    },
                },
            },
            new Gcp.Redis.Inputs.ClusterUserCreatedConnectionsClusterEndpointArgs
            {
                Connections = new[]
                {
                    new Gcp.Redis.Inputs.ClusterUserCreatedConnectionsClusterEndpointConnectionArgs
                    {
                        PscConnection = new Gcp.Redis.Inputs.ClusterUserCreatedConnectionsClusterEndpointConnectionPscConnectionArgs
                        {
                            PscConnectionId = forwardingRule1Network2.PscConnectionId,
                            Address = ip1Network2.IPAddress,
                            ForwardingRule = forwardingRule1Network2.Id,
                            Network = network2.Id,
                            ServiceAttachment = cluster_user_connCluster.PscServiceAttachments.Apply(pscServiceAttachments => pscServiceAttachments[0].ServiceAttachment),
                        },
                    },
                    new Gcp.Redis.Inputs.ClusterUserCreatedConnectionsClusterEndpointConnectionArgs
                    {
                        PscConnection = new Gcp.Redis.Inputs.ClusterUserCreatedConnectionsClusterEndpointConnectionPscConnectionArgs
                        {
                            PscConnectionId = forwardingRule2Network2.PscConnectionId,
                            Address = ip2Network2.IPAddress,
                            ForwardingRule = forwardingRule2Network2.Id,
                            Network = network2.Id,
                            ServiceAttachment = cluster_user_connCluster.PscServiceAttachments.Apply(pscServiceAttachments => pscServiceAttachments[1].ServiceAttachment),
                        },
                    },
                },
            },
        },
    });

});
Copy
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.compute.Subnetwork;
import com.pulumi.gcp.compute.SubnetworkArgs;
import com.pulumi.gcp.compute.Address;
import com.pulumi.gcp.compute.AddressArgs;
import com.pulumi.gcp.redis.Cluster;
import com.pulumi.gcp.redis.ClusterArgs;
import com.pulumi.gcp.compute.ForwardingRule;
import com.pulumi.gcp.compute.ForwardingRuleArgs;
import com.pulumi.gcp.organizations.OrganizationsFunctions;
import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
import com.pulumi.gcp.redis.ClusterUserCreatedConnections;
import com.pulumi.gcp.redis.ClusterUserCreatedConnectionsArgs;
import com.pulumi.gcp.redis.inputs.ClusterUserCreatedConnectionsClusterEndpointArgs;
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 network1 = new Network("network1", NetworkArgs.builder()
            .name("net1")
            .autoCreateSubnetworks(false)
            .build());

        var subnetNetwork1 = new Subnetwork("subnetNetwork1", SubnetworkArgs.builder()
            .name("subnet-net1")
            .ipCidrRange("10.0.0.248/29")
            .region("us-central1")
            .network(network1.id())
            .build());

        var ip1Network1 = new Address("ip1Network1", AddressArgs.builder()
            .name("ip1-net1")
            .region("us-central1")
            .subnetwork(subnetNetwork1.id())
            .addressType("INTERNAL")
            .purpose("GCE_ENDPOINT")
            .build());

        // redis cluster without endpoint
        var cluster_user_connCluster = new Cluster("cluster-user-connCluster", ClusterArgs.builder()
            .name("cluster-user-conn")
            .shardCount(3)
            .region("us-central1")
            .replicaCount(0)
            .deletionProtectionEnabled(false)
            .build());

        var forwardingRule1Network1 = new ForwardingRule("forwardingRule1Network1", ForwardingRuleArgs.builder()
            .name("fwd1-net1")
            .region("us-central1")
            .ipAddress(ip1Network1.id())
            .loadBalancingScheme("")
            .network(network1.id())
            .target(cluster_user_connCluster.pscServiceAttachments().applyValue(_pscServiceAttachments -> _pscServiceAttachments[0].serviceAttachment()))
            .build());

        var ip2Network1 = new Address("ip2Network1", AddressArgs.builder()
            .name("ip2-net1")
            .region("us-central1")
            .subnetwork(subnetNetwork1.id())
            .addressType("INTERNAL")
            .purpose("GCE_ENDPOINT")
            .build());

        var forwardingRule2Network1 = new ForwardingRule("forwardingRule2Network1", ForwardingRuleArgs.builder()
            .name("fwd2-net1")
            .region("us-central1")
            .ipAddress(ip2Network1.id())
            .loadBalancingScheme("")
            .network(network1.id())
            .target(cluster_user_connCluster.pscServiceAttachments().applyValue(_pscServiceAttachments -> _pscServiceAttachments[1].serviceAttachment()))
            .build());

        var network2 = new Network("network2", NetworkArgs.builder()
            .name("network2")
            .autoCreateSubnetworks(false)
            .build());

        var subnetNetwork2 = new Subnetwork("subnetNetwork2", SubnetworkArgs.builder()
            .name("subnet-net2")
            .ipCidrRange("10.0.0.248/29")
            .region("us-central1")
            .network(network2.id())
            .build());

        var ip1Network2 = new Address("ip1Network2", AddressArgs.builder()
            .name("ip1-net2")
            .region("us-central1")
            .subnetwork(subnetNetwork2.id())
            .addressType("INTERNAL")
            .purpose("GCE_ENDPOINT")
            .build());

        var forwardingRule1Network2 = new ForwardingRule("forwardingRule1Network2", ForwardingRuleArgs.builder()
            .name("fwd1-net2")
            .region("us-central1")
            .ipAddress(ip1Network2.id())
            .loadBalancingScheme("")
            .network(network2.id())
            .target(cluster_user_connCluster.pscServiceAttachments().applyValue(_pscServiceAttachments -> _pscServiceAttachments[0].serviceAttachment()))
            .build());

        var ip2Network2 = new Address("ip2Network2", AddressArgs.builder()
            .name("ip2-net2")
            .region("us-central1")
            .subnetwork(subnetNetwork2.id())
            .addressType("INTERNAL")
            .purpose("GCE_ENDPOINT")
            .build());

        var forwardingRule2Network2 = new ForwardingRule("forwardingRule2Network2", ForwardingRuleArgs.builder()
            .name("fwd2-net2")
            .region("us-central1")
            .ipAddress(ip2Network2.id())
            .loadBalancingScheme("")
            .network(network2.id())
            .target(cluster_user_connCluster.pscServiceAttachments().applyValue(_pscServiceAttachments -> _pscServiceAttachments[1].serviceAttachment()))
            .build());

        final var project = OrganizationsFunctions.getProject(GetProjectArgs.builder()
            .build());

        var cluster_user_conn = new ClusterUserCreatedConnections("cluster-user-conn", ClusterUserCreatedConnectionsArgs.builder()
            .name("cluster-user-conn")
            .region("us-central1")
            .clusterEndpoints(            
                ClusterUserCreatedConnectionsClusterEndpointArgs.builder()
                    .connections(                    
                        ClusterUserCreatedConnectionsClusterEndpointConnectionArgs.builder()
                            .pscConnection(ClusterUserCreatedConnectionsClusterEndpointConnectionPscConnectionArgs.builder()
                                .pscConnectionId(forwardingRule1Network1.pscConnectionId())
                                .address(ip1Network1.address())
                                .forwardingRule(forwardingRule1Network1.id())
                                .network(network1.id())
                                .projectId(project.projectId())
                                .serviceAttachment(cluster_user_connCluster.pscServiceAttachments().applyValue(_pscServiceAttachments -> _pscServiceAttachments[0].serviceAttachment()))
                                .build())
                            .build(),
                        ClusterUserCreatedConnectionsClusterEndpointConnectionArgs.builder()
                            .pscConnection(ClusterUserCreatedConnectionsClusterEndpointConnectionPscConnectionArgs.builder()
                                .pscConnectionId(forwardingRule2Network1.pscConnectionId())
                                .address(ip2Network1.address())
                                .forwardingRule(forwardingRule2Network1.id())
                                .network(network1.id())
                                .serviceAttachment(cluster_user_connCluster.pscServiceAttachments().applyValue(_pscServiceAttachments -> _pscServiceAttachments[1].serviceAttachment()))
                                .build())
                            .build())
                    .build(),
                ClusterUserCreatedConnectionsClusterEndpointArgs.builder()
                    .connections(                    
                        ClusterUserCreatedConnectionsClusterEndpointConnectionArgs.builder()
                            .pscConnection(ClusterUserCreatedConnectionsClusterEndpointConnectionPscConnectionArgs.builder()
                                .pscConnectionId(forwardingRule1Network2.pscConnectionId())
                                .address(ip1Network2.address())
                                .forwardingRule(forwardingRule1Network2.id())
                                .network(network2.id())
                                .serviceAttachment(cluster_user_connCluster.pscServiceAttachments().applyValue(_pscServiceAttachments -> _pscServiceAttachments[0].serviceAttachment()))
                                .build())
                            .build(),
                        ClusterUserCreatedConnectionsClusterEndpointConnectionArgs.builder()
                            .pscConnection(ClusterUserCreatedConnectionsClusterEndpointConnectionPscConnectionArgs.builder()
                                .pscConnectionId(forwardingRule2Network2.pscConnectionId())
                                .address(ip2Network2.address())
                                .forwardingRule(forwardingRule2Network2.id())
                                .network(network2.id())
                                .serviceAttachment(cluster_user_connCluster.pscServiceAttachments().applyValue(_pscServiceAttachments -> _pscServiceAttachments[1].serviceAttachment()))
                                .build())
                            .build())
                    .build())
            .build());

    }
}
Copy
resources:
  cluster-user-conn:
    type: gcp:redis:ClusterUserCreatedConnections
    properties:
      name: cluster-user-conn
      region: us-central1
      clusterEndpoints:
        - connections:
            - pscConnection:
                pscConnectionId: ${forwardingRule1Network1.pscConnectionId}
                address: ${ip1Network1.address}
                forwardingRule: ${forwardingRule1Network1.id}
                network: ${network1.id}
                projectId: ${project.projectId}
                serviceAttachment: ${["cluster-user-connCluster"].pscServiceAttachments[0].serviceAttachment}
            - pscConnection:
                pscConnectionId: ${forwardingRule2Network1.pscConnectionId}
                address: ${ip2Network1.address}
                forwardingRule: ${forwardingRule2Network1.id}
                network: ${network1.id}
                serviceAttachment: ${["cluster-user-connCluster"].pscServiceAttachments[1].serviceAttachment}
        - connections:
            - pscConnection:
                pscConnectionId: ${forwardingRule1Network2.pscConnectionId}
                address: ${ip1Network2.address}
                forwardingRule: ${forwardingRule1Network2.id}
                network: ${network2.id}
                serviceAttachment: ${["cluster-user-connCluster"].pscServiceAttachments[0].serviceAttachment}
            - pscConnection:
                pscConnectionId: ${forwardingRule2Network2.pscConnectionId}
                address: ${ip2Network2.address}
                forwardingRule: ${forwardingRule2Network2.id}
                network: ${network2.id}
                serviceAttachment: ${["cluster-user-connCluster"].pscServiceAttachments[1].serviceAttachment}
  forwardingRule1Network1:
    type: gcp:compute:ForwardingRule
    name: forwarding_rule1_network1
    properties:
      name: fwd1-net1
      region: us-central1
      ipAddress: ${ip1Network1.id}
      loadBalancingScheme: ""
      network: ${network1.id}
      target: ${["cluster-user-connCluster"].pscServiceAttachments[0].serviceAttachment}
  forwardingRule2Network1:
    type: gcp:compute:ForwardingRule
    name: forwarding_rule2_network1
    properties:
      name: fwd2-net1
      region: us-central1
      ipAddress: ${ip2Network1.id}
      loadBalancingScheme: ""
      network: ${network1.id}
      target: ${["cluster-user-connCluster"].pscServiceAttachments[1].serviceAttachment}
  ip1Network1:
    type: gcp:compute:Address
    name: ip1_network1
    properties:
      name: ip1-net1
      region: us-central1
      subnetwork: ${subnetNetwork1.id}
      addressType: INTERNAL
      purpose: GCE_ENDPOINT
  ip2Network1:
    type: gcp:compute:Address
    name: ip2_network1
    properties:
      name: ip2-net1
      region: us-central1
      subnetwork: ${subnetNetwork1.id}
      addressType: INTERNAL
      purpose: GCE_ENDPOINT
  subnetNetwork1:
    type: gcp:compute:Subnetwork
    name: subnet_network1
    properties:
      name: subnet-net1
      ipCidrRange: 10.0.0.248/29
      region: us-central1
      network: ${network1.id}
  network1:
    type: gcp:compute:Network
    properties:
      name: net1
      autoCreateSubnetworks: false
  forwardingRule1Network2:
    type: gcp:compute:ForwardingRule
    name: forwarding_rule1_network2
    properties:
      name: fwd1-net2
      region: us-central1
      ipAddress: ${ip1Network2.id}
      loadBalancingScheme: ""
      network: ${network2.id}
      target: ${["cluster-user-connCluster"].pscServiceAttachments[0].serviceAttachment}
  forwardingRule2Network2:
    type: gcp:compute:ForwardingRule
    name: forwarding_rule2_network2
    properties:
      name: fwd2-net2
      region: us-central1
      ipAddress: ${ip2Network2.id}
      loadBalancingScheme: ""
      network: ${network2.id}
      target: ${["cluster-user-connCluster"].pscServiceAttachments[1].serviceAttachment}
  ip1Network2:
    type: gcp:compute:Address
    name: ip1_network2
    properties:
      name: ip1-net2
      region: us-central1
      subnetwork: ${subnetNetwork2.id}
      addressType: INTERNAL
      purpose: GCE_ENDPOINT
  ip2Network2:
    type: gcp:compute:Address
    name: ip2_network2
    properties:
      name: ip2-net2
      region: us-central1
      subnetwork: ${subnetNetwork2.id}
      addressType: INTERNAL
      purpose: GCE_ENDPOINT
  subnetNetwork2:
    type: gcp:compute:Subnetwork
    name: subnet_network2
    properties:
      name: subnet-net2
      ipCidrRange: 10.0.0.248/29
      region: us-central1
      network: ${network2.id}
  network2:
    type: gcp:compute:Network
    properties:
      name: network2
      autoCreateSubnetworks: false
  # redis cluster without endpoint
  cluster-user-connCluster:
    type: gcp:redis:Cluster
    name: cluster-user-conn
    properties:
      name: cluster-user-conn
      shardCount: 3
      region: us-central1
      replicaCount: 0
      deletionProtectionEnabled: false
variables:
  project:
    fn::invoke:
      function: gcp:organizations:getProject
      arguments: {}
Copy

Redis Cluster User And Auto Created Connections

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

const network2 = new gcp.compute.Network("network2", {
    name: "network2",
    autoCreateSubnetworks: false,
});
const subnetNetwork2 = new gcp.compute.Subnetwork("subnet_network2", {
    name: "subnet-net2",
    ipCidrRange: "10.0.0.248/29",
    region: "us-central1",
    network: network2.id,
});
const ip1Network2 = new gcp.compute.Address("ip1_network2", {
    name: "ip1-net2",
    region: "us-central1",
    subnetwork: subnetNetwork2.id,
    addressType: "INTERNAL",
    purpose: "GCE_ENDPOINT",
});
const network1 = new gcp.compute.Network("network1", {
    name: "net1",
    autoCreateSubnetworks: false,
});
const subnetNetwork1 = new gcp.compute.Subnetwork("subnet_network1", {
    name: "subnet-net1",
    ipCidrRange: "10.0.0.248/29",
    region: "us-central1",
    network: network1.id,
});
const _default = new gcp.networkconnectivity.ServiceConnectionPolicy("default", {
    name: "scpolicy",
    location: "us-central1",
    serviceClass: "gcp-memorystore-redis",
    description: "my basic service connection policy",
    network: network1.id,
    pscConfig: {
        subnetworks: [subnetNetwork1.id],
    },
});
// redis cluster without endpoint
const cluster_user_auto_connCluster = new gcp.redis.Cluster("cluster-user-auto-conn", {
    name: "cluster-user-auto-conn",
    shardCount: 3,
    region: "us-central1",
    replicaCount: 0,
    deletionProtectionEnabled: false,
    pscConfigs: [{
        network: network1.id,
    }],
}, {
    dependsOn: [_default],
});
const forwardingRule1Network2 = new gcp.compute.ForwardingRule("forwarding_rule1_network2", {
    name: "fwd1-net2",
    region: "us-central1",
    ipAddress: ip1Network2.id,
    loadBalancingScheme: "",
    network: network2.id,
    target: cluster_user_auto_connCluster.pscServiceAttachments.apply(pscServiceAttachments => pscServiceAttachments[0].serviceAttachment),
});
const ip2Network2 = new gcp.compute.Address("ip2_network2", {
    name: "ip2-net2",
    region: "us-central1",
    subnetwork: subnetNetwork2.id,
    addressType: "INTERNAL",
    purpose: "GCE_ENDPOINT",
});
const forwardingRule2Network2 = new gcp.compute.ForwardingRule("forwarding_rule2_network2", {
    name: "fwd2-net2",
    region: "us-central1",
    ipAddress: ip2Network2.id,
    loadBalancingScheme: "",
    network: network2.id,
    target: cluster_user_auto_connCluster.pscServiceAttachments.apply(pscServiceAttachments => pscServiceAttachments[1].serviceAttachment),
});
const cluster_user_auto_conn = new gcp.redis.ClusterUserCreatedConnections("cluster-user-auto-conn", {
    name: "cluster-user-auto-conn",
    region: "us-central1",
    clusterEndpoints: [{
        connections: [
            {
                pscConnection: {
                    pscConnectionId: forwardingRule1Network2.pscConnectionId,
                    address: ip1Network2.address,
                    forwardingRule: forwardingRule1Network2.id,
                    network: network2.id,
                    serviceAttachment: cluster_user_auto_connCluster.pscServiceAttachments.apply(pscServiceAttachments => pscServiceAttachments[0].serviceAttachment),
                },
            },
            {
                pscConnection: {
                    pscConnectionId: forwardingRule2Network2.pscConnectionId,
                    address: ip2Network2.address,
                    forwardingRule: forwardingRule2Network2.id,
                    network: network2.id,
                    serviceAttachment: cluster_user_auto_connCluster.pscServiceAttachments.apply(pscServiceAttachments => pscServiceAttachments[1].serviceAttachment),
                },
            },
        ],
    }],
});
Copy
import pulumi
import pulumi_gcp as gcp

network2 = gcp.compute.Network("network2",
    name="network2",
    auto_create_subnetworks=False)
subnet_network2 = gcp.compute.Subnetwork("subnet_network2",
    name="subnet-net2",
    ip_cidr_range="10.0.0.248/29",
    region="us-central1",
    network=network2.id)
ip1_network2 = gcp.compute.Address("ip1_network2",
    name="ip1-net2",
    region="us-central1",
    subnetwork=subnet_network2.id,
    address_type="INTERNAL",
    purpose="GCE_ENDPOINT")
network1 = gcp.compute.Network("network1",
    name="net1",
    auto_create_subnetworks=False)
subnet_network1 = gcp.compute.Subnetwork("subnet_network1",
    name="subnet-net1",
    ip_cidr_range="10.0.0.248/29",
    region="us-central1",
    network=network1.id)
default = gcp.networkconnectivity.ServiceConnectionPolicy("default",
    name="scpolicy",
    location="us-central1",
    service_class="gcp-memorystore-redis",
    description="my basic service connection policy",
    network=network1.id,
    psc_config={
        "subnetworks": [subnet_network1.id],
    })
# redis cluster without endpoint
cluster_user_auto_conn_cluster = gcp.redis.Cluster("cluster-user-auto-conn",
    name="cluster-user-auto-conn",
    shard_count=3,
    region="us-central1",
    replica_count=0,
    deletion_protection_enabled=False,
    psc_configs=[{
        "network": network1.id,
    }],
    opts = pulumi.ResourceOptions(depends_on=[default]))
forwarding_rule1_network2 = gcp.compute.ForwardingRule("forwarding_rule1_network2",
    name="fwd1-net2",
    region="us-central1",
    ip_address=ip1_network2.id,
    load_balancing_scheme="",
    network=network2.id,
    target=cluster_user_auto_conn_cluster.psc_service_attachments[0].service_attachment)
ip2_network2 = gcp.compute.Address("ip2_network2",
    name="ip2-net2",
    region="us-central1",
    subnetwork=subnet_network2.id,
    address_type="INTERNAL",
    purpose="GCE_ENDPOINT")
forwarding_rule2_network2 = gcp.compute.ForwardingRule("forwarding_rule2_network2",
    name="fwd2-net2",
    region="us-central1",
    ip_address=ip2_network2.id,
    load_balancing_scheme="",
    network=network2.id,
    target=cluster_user_auto_conn_cluster.psc_service_attachments[1].service_attachment)
cluster_user_auto_conn = gcp.redis.ClusterUserCreatedConnections("cluster-user-auto-conn",
    name="cluster-user-auto-conn",
    region="us-central1",
    cluster_endpoints=[{
        "connections": [
            {
                "psc_connection": {
                    "psc_connection_id": forwarding_rule1_network2.psc_connection_id,
                    "address": ip1_network2.address,
                    "forwarding_rule": forwarding_rule1_network2.id,
                    "network": network2.id,
                    "service_attachment": cluster_user_auto_conn_cluster.psc_service_attachments[0].service_attachment,
                },
            },
            {
                "psc_connection": {
                    "psc_connection_id": forwarding_rule2_network2.psc_connection_id,
                    "address": ip2_network2.address,
                    "forwarding_rule": forwarding_rule2_network2.id,
                    "network": network2.id,
                    "service_attachment": cluster_user_auto_conn_cluster.psc_service_attachments[1].service_attachment,
                },
            },
        ],
    }])
Copy
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/compute"
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/networkconnectivity"
	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/redis"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		network2, err := compute.NewNetwork(ctx, "network2", &compute.NetworkArgs{
			Name:                  pulumi.String("network2"),
			AutoCreateSubnetworks: pulumi.Bool(false),
		})
		if err != nil {
			return err
		}
		subnetNetwork2, err := compute.NewSubnetwork(ctx, "subnet_network2", &compute.SubnetworkArgs{
			Name:        pulumi.String("subnet-net2"),
			IpCidrRange: pulumi.String("10.0.0.248/29"),
			Region:      pulumi.String("us-central1"),
			Network:     network2.ID(),
		})
		if err != nil {
			return err
		}
		ip1Network2, err := compute.NewAddress(ctx, "ip1_network2", &compute.AddressArgs{
			Name:        pulumi.String("ip1-net2"),
			Region:      pulumi.String("us-central1"),
			Subnetwork:  subnetNetwork2.ID(),
			AddressType: pulumi.String("INTERNAL"),
			Purpose:     pulumi.String("GCE_ENDPOINT"),
		})
		if err != nil {
			return err
		}
		network1, err := compute.NewNetwork(ctx, "network1", &compute.NetworkArgs{
			Name:                  pulumi.String("net1"),
			AutoCreateSubnetworks: pulumi.Bool(false),
		})
		if err != nil {
			return err
		}
		subnetNetwork1, err := compute.NewSubnetwork(ctx, "subnet_network1", &compute.SubnetworkArgs{
			Name:        pulumi.String("subnet-net1"),
			IpCidrRange: pulumi.String("10.0.0.248/29"),
			Region:      pulumi.String("us-central1"),
			Network:     network1.ID(),
		})
		if err != nil {
			return err
		}
		_default, err := networkconnectivity.NewServiceConnectionPolicy(ctx, "default", &networkconnectivity.ServiceConnectionPolicyArgs{
			Name:         pulumi.String("scpolicy"),
			Location:     pulumi.String("us-central1"),
			ServiceClass: pulumi.String("gcp-memorystore-redis"),
			Description:  pulumi.String("my basic service connection policy"),
			Network:      network1.ID(),
			PscConfig: &networkconnectivity.ServiceConnectionPolicyPscConfigArgs{
				Subnetworks: pulumi.StringArray{
					subnetNetwork1.ID(),
				},
			},
		})
		if err != nil {
			return err
		}
		// redis cluster without endpoint
		cluster_user_auto_connCluster, err := redis.NewCluster(ctx, "cluster-user-auto-conn", &redis.ClusterArgs{
			Name:                      pulumi.String("cluster-user-auto-conn"),
			ShardCount:                pulumi.Int(3),
			Region:                    pulumi.String("us-central1"),
			ReplicaCount:              pulumi.Int(0),
			DeletionProtectionEnabled: pulumi.Bool(false),
			PscConfigs: redis.ClusterPscConfigArray{
				&redis.ClusterPscConfigArgs{
					Network: network1.ID(),
				},
			},
		}, pulumi.DependsOn([]pulumi.Resource{
			_default,
		}))
		if err != nil {
			return err
		}
		forwardingRule1Network2, err := compute.NewForwardingRule(ctx, "forwarding_rule1_network2", &compute.ForwardingRuleArgs{
			Name:                pulumi.String("fwd1-net2"),
			Region:              pulumi.String("us-central1"),
			IpAddress:           ip1Network2.ID(),
			LoadBalancingScheme: pulumi.String(""),
			Network:             network2.ID(),
			Target: pulumi.String(cluster_user_auto_connCluster.PscServiceAttachments.ApplyT(func(pscServiceAttachments []redis.ClusterPscServiceAttachment) (*string, error) {
				return &pscServiceAttachments[0].ServiceAttachment, nil
			}).(pulumi.StringPtrOutput)),
		})
		if err != nil {
			return err
		}
		ip2Network2, err := compute.NewAddress(ctx, "ip2_network2", &compute.AddressArgs{
			Name:        pulumi.String("ip2-net2"),
			Region:      pulumi.String("us-central1"),
			Subnetwork:  subnetNetwork2.ID(),
			AddressType: pulumi.String("INTERNAL"),
			Purpose:     pulumi.String("GCE_ENDPOINT"),
		})
		if err != nil {
			return err
		}
		forwardingRule2Network2, err := compute.NewForwardingRule(ctx, "forwarding_rule2_network2", &compute.ForwardingRuleArgs{
			Name:                pulumi.String("fwd2-net2"),
			Region:              pulumi.String("us-central1"),
			IpAddress:           ip2Network2.ID(),
			LoadBalancingScheme: pulumi.String(""),
			Network:             network2.ID(),
			Target: pulumi.String(cluster_user_auto_connCluster.PscServiceAttachments.ApplyT(func(pscServiceAttachments []redis.ClusterPscServiceAttachment) (*string, error) {
				return &pscServiceAttachments[1].ServiceAttachment, nil
			}).(pulumi.StringPtrOutput)),
		})
		if err != nil {
			return err
		}
		_, err = redis.NewClusterUserCreatedConnections(ctx, "cluster-user-auto-conn", &redis.ClusterUserCreatedConnectionsArgs{
			Name:   pulumi.String("cluster-user-auto-conn"),
			Region: pulumi.String("us-central1"),
			ClusterEndpoints: redis.ClusterUserCreatedConnectionsClusterEndpointArray{
				&redis.ClusterUserCreatedConnectionsClusterEndpointArgs{
					Connections: redis.ClusterUserCreatedConnectionsClusterEndpointConnectionArray{
						&redis.ClusterUserCreatedConnectionsClusterEndpointConnectionArgs{
							PscConnection: &redis.ClusterUserCreatedConnectionsClusterEndpointConnectionPscConnectionArgs{
								PscConnectionId: forwardingRule1Network2.PscConnectionId,
								Address:         ip1Network2.Address,
								ForwardingRule:  forwardingRule1Network2.ID(),
								Network:         network2.ID(),
								ServiceAttachment: cluster_user_auto_connCluster.PscServiceAttachments.ApplyT(func(pscServiceAttachments []redis.ClusterPscServiceAttachment) (*string, error) {
									return &pscServiceAttachments[0].ServiceAttachment, nil
								}).(pulumi.StringPtrOutput),
							},
						},
						&redis.ClusterUserCreatedConnectionsClusterEndpointConnectionArgs{
							PscConnection: &redis.ClusterUserCreatedConnectionsClusterEndpointConnectionPscConnectionArgs{
								PscConnectionId: forwardingRule2Network2.PscConnectionId,
								Address:         ip2Network2.Address,
								ForwardingRule:  forwardingRule2Network2.ID(),
								Network:         network2.ID(),
								ServiceAttachment: cluster_user_auto_connCluster.PscServiceAttachments.ApplyT(func(pscServiceAttachments []redis.ClusterPscServiceAttachment) (*string, error) {
									return &pscServiceAttachments[1].ServiceAttachment, nil
								}).(pulumi.StringPtrOutput),
							},
						},
					},
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() => 
{
    var network2 = new Gcp.Compute.Network("network2", new()
    {
        Name = "network2",
        AutoCreateSubnetworks = false,
    });

    var subnetNetwork2 = new Gcp.Compute.Subnetwork("subnet_network2", new()
    {
        Name = "subnet-net2",
        IpCidrRange = "10.0.0.248/29",
        Region = "us-central1",
        Network = network2.Id,
    });

    var ip1Network2 = new Gcp.Compute.Address("ip1_network2", new()
    {
        Name = "ip1-net2",
        Region = "us-central1",
        Subnetwork = subnetNetwork2.Id,
        AddressType = "INTERNAL",
        Purpose = "GCE_ENDPOINT",
    });

    var network1 = new Gcp.Compute.Network("network1", new()
    {
        Name = "net1",
        AutoCreateSubnetworks = false,
    });

    var subnetNetwork1 = new Gcp.Compute.Subnetwork("subnet_network1", new()
    {
        Name = "subnet-net1",
        IpCidrRange = "10.0.0.248/29",
        Region = "us-central1",
        Network = network1.Id,
    });

    var @default = new Gcp.NetworkConnectivity.ServiceConnectionPolicy("default", new()
    {
        Name = "scpolicy",
        Location = "us-central1",
        ServiceClass = "gcp-memorystore-redis",
        Description = "my basic service connection policy",
        Network = network1.Id,
        PscConfig = new Gcp.NetworkConnectivity.Inputs.ServiceConnectionPolicyPscConfigArgs
        {
            Subnetworks = new[]
            {
                subnetNetwork1.Id,
            },
        },
    });

    // redis cluster without endpoint
    var cluster_user_auto_connCluster = new Gcp.Redis.Cluster("cluster-user-auto-conn", new()
    {
        Name = "cluster-user-auto-conn",
        ShardCount = 3,
        Region = "us-central1",
        ReplicaCount = 0,
        DeletionProtectionEnabled = false,
        PscConfigs = new[]
        {
            new Gcp.Redis.Inputs.ClusterPscConfigArgs
            {
                Network = network1.Id,
            },
        },
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            @default,
        },
    });

    var forwardingRule1Network2 = new Gcp.Compute.ForwardingRule("forwarding_rule1_network2", new()
    {
        Name = "fwd1-net2",
        Region = "us-central1",
        IpAddress = ip1Network2.Id,
        LoadBalancingScheme = "",
        Network = network2.Id,
        Target = cluster_user_auto_connCluster.PscServiceAttachments.Apply(pscServiceAttachments => pscServiceAttachments[0].ServiceAttachment),
    });

    var ip2Network2 = new Gcp.Compute.Address("ip2_network2", new()
    {
        Name = "ip2-net2",
        Region = "us-central1",
        Subnetwork = subnetNetwork2.Id,
        AddressType = "INTERNAL",
        Purpose = "GCE_ENDPOINT",
    });

    var forwardingRule2Network2 = new Gcp.Compute.ForwardingRule("forwarding_rule2_network2", new()
    {
        Name = "fwd2-net2",
        Region = "us-central1",
        IpAddress = ip2Network2.Id,
        LoadBalancingScheme = "",
        Network = network2.Id,
        Target = cluster_user_auto_connCluster.PscServiceAttachments.Apply(pscServiceAttachments => pscServiceAttachments[1].ServiceAttachment),
    });

    var cluster_user_auto_conn = new Gcp.Redis.ClusterUserCreatedConnections("cluster-user-auto-conn", new()
    {
        Name = "cluster-user-auto-conn",
        Region = "us-central1",
        ClusterEndpoints = new[]
        {
            new Gcp.Redis.Inputs.ClusterUserCreatedConnectionsClusterEndpointArgs
            {
                Connections = new[]
                {
                    new Gcp.Redis.Inputs.ClusterUserCreatedConnectionsClusterEndpointConnectionArgs
                    {
                        PscConnection = new Gcp.Redis.Inputs.ClusterUserCreatedConnectionsClusterEndpointConnectionPscConnectionArgs
                        {
                            PscConnectionId = forwardingRule1Network2.PscConnectionId,
                            Address = ip1Network2.IPAddress,
                            ForwardingRule = forwardingRule1Network2.Id,
                            Network = network2.Id,
                            ServiceAttachment = cluster_user_auto_connCluster.PscServiceAttachments.Apply(pscServiceAttachments => pscServiceAttachments[0].ServiceAttachment),
                        },
                    },
                    new Gcp.Redis.Inputs.ClusterUserCreatedConnectionsClusterEndpointConnectionArgs
                    {
                        PscConnection = new Gcp.Redis.Inputs.ClusterUserCreatedConnectionsClusterEndpointConnectionPscConnectionArgs
                        {
                            PscConnectionId = forwardingRule2Network2.PscConnectionId,
                            Address = ip2Network2.IPAddress,
                            ForwardingRule = forwardingRule2Network2.Id,
                            Network = network2.Id,
                            ServiceAttachment = cluster_user_auto_connCluster.PscServiceAttachments.Apply(pscServiceAttachments => pscServiceAttachments[1].ServiceAttachment),
                        },
                    },
                },
            },
        },
    });

});
Copy
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.compute.Subnetwork;
import com.pulumi.gcp.compute.SubnetworkArgs;
import com.pulumi.gcp.compute.Address;
import com.pulumi.gcp.compute.AddressArgs;
import com.pulumi.gcp.networkconnectivity.ServiceConnectionPolicy;
import com.pulumi.gcp.networkconnectivity.ServiceConnectionPolicyArgs;
import com.pulumi.gcp.networkconnectivity.inputs.ServiceConnectionPolicyPscConfigArgs;
import com.pulumi.gcp.redis.Cluster;
import com.pulumi.gcp.redis.ClusterArgs;
import com.pulumi.gcp.redis.inputs.ClusterPscConfigArgs;
import com.pulumi.gcp.compute.ForwardingRule;
import com.pulumi.gcp.compute.ForwardingRuleArgs;
import com.pulumi.gcp.redis.ClusterUserCreatedConnections;
import com.pulumi.gcp.redis.ClusterUserCreatedConnectionsArgs;
import com.pulumi.gcp.redis.inputs.ClusterUserCreatedConnectionsClusterEndpointArgs;
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 network2 = new Network("network2", NetworkArgs.builder()
            .name("network2")
            .autoCreateSubnetworks(false)
            .build());

        var subnetNetwork2 = new Subnetwork("subnetNetwork2", SubnetworkArgs.builder()
            .name("subnet-net2")
            .ipCidrRange("10.0.0.248/29")
            .region("us-central1")
            .network(network2.id())
            .build());

        var ip1Network2 = new Address("ip1Network2", AddressArgs.builder()
            .name("ip1-net2")
            .region("us-central1")
            .subnetwork(subnetNetwork2.id())
            .addressType("INTERNAL")
            .purpose("GCE_ENDPOINT")
            .build());

        var network1 = new Network("network1", NetworkArgs.builder()
            .name("net1")
            .autoCreateSubnetworks(false)
            .build());

        var subnetNetwork1 = new Subnetwork("subnetNetwork1", SubnetworkArgs.builder()
            .name("subnet-net1")
            .ipCidrRange("10.0.0.248/29")
            .region("us-central1")
            .network(network1.id())
            .build());

        var default_ = new ServiceConnectionPolicy("default", ServiceConnectionPolicyArgs.builder()
            .name("scpolicy")
            .location("us-central1")
            .serviceClass("gcp-memorystore-redis")
            .description("my basic service connection policy")
            .network(network1.id())
            .pscConfig(ServiceConnectionPolicyPscConfigArgs.builder()
                .subnetworks(subnetNetwork1.id())
                .build())
            .build());

        // redis cluster without endpoint
        var cluster_user_auto_connCluster = new Cluster("cluster-user-auto-connCluster", ClusterArgs.builder()
            .name("cluster-user-auto-conn")
            .shardCount(3)
            .region("us-central1")
            .replicaCount(0)
            .deletionProtectionEnabled(false)
            .pscConfigs(ClusterPscConfigArgs.builder()
                .network(network1.id())
                .build())
            .build(), CustomResourceOptions.builder()
                .dependsOn(default_)
                .build());

        var forwardingRule1Network2 = new ForwardingRule("forwardingRule1Network2", ForwardingRuleArgs.builder()
            .name("fwd1-net2")
            .region("us-central1")
            .ipAddress(ip1Network2.id())
            .loadBalancingScheme("")
            .network(network2.id())
            .target(cluster_user_auto_connCluster.pscServiceAttachments().applyValue(_pscServiceAttachments -> _pscServiceAttachments[0].serviceAttachment()))
            .build());

        var ip2Network2 = new Address("ip2Network2", AddressArgs.builder()
            .name("ip2-net2")
            .region("us-central1")
            .subnetwork(subnetNetwork2.id())
            .addressType("INTERNAL")
            .purpose("GCE_ENDPOINT")
            .build());

        var forwardingRule2Network2 = new ForwardingRule("forwardingRule2Network2", ForwardingRuleArgs.builder()
            .name("fwd2-net2")
            .region("us-central1")
            .ipAddress(ip2Network2.id())
            .loadBalancingScheme("")
            .network(network2.id())
            .target(cluster_user_auto_connCluster.pscServiceAttachments().applyValue(_pscServiceAttachments -> _pscServiceAttachments[1].serviceAttachment()))
            .build());

        var cluster_user_auto_conn = new ClusterUserCreatedConnections("cluster-user-auto-conn", ClusterUserCreatedConnectionsArgs.builder()
            .name("cluster-user-auto-conn")
            .region("us-central1")
            .clusterEndpoints(ClusterUserCreatedConnectionsClusterEndpointArgs.builder()
                .connections(                
                    ClusterUserCreatedConnectionsClusterEndpointConnectionArgs.builder()
                        .pscConnection(ClusterUserCreatedConnectionsClusterEndpointConnectionPscConnectionArgs.builder()
                            .pscConnectionId(forwardingRule1Network2.pscConnectionId())
                            .address(ip1Network2.address())
                            .forwardingRule(forwardingRule1Network2.id())
                            .network(network2.id())
                            .serviceAttachment(cluster_user_auto_connCluster.pscServiceAttachments().applyValue(_pscServiceAttachments -> _pscServiceAttachments[0].serviceAttachment()))
                            .build())
                        .build(),
                    ClusterUserCreatedConnectionsClusterEndpointConnectionArgs.builder()
                        .pscConnection(ClusterUserCreatedConnectionsClusterEndpointConnectionPscConnectionArgs.builder()
                            .pscConnectionId(forwardingRule2Network2.pscConnectionId())
                            .address(ip2Network2.address())
                            .forwardingRule(forwardingRule2Network2.id())
                            .network(network2.id())
                            .serviceAttachment(cluster_user_auto_connCluster.pscServiceAttachments().applyValue(_pscServiceAttachments -> _pscServiceAttachments[1].serviceAttachment()))
                            .build())
                        .build())
                .build())
            .build());

    }
}
Copy
resources:
  cluster-user-auto-conn:
    type: gcp:redis:ClusterUserCreatedConnections
    properties:
      name: cluster-user-auto-conn
      region: us-central1
      clusterEndpoints:
        - connections:
            - pscConnection:
                pscConnectionId: ${forwardingRule1Network2.pscConnectionId}
                address: ${ip1Network2.address}
                forwardingRule: ${forwardingRule1Network2.id}
                network: ${network2.id}
                serviceAttachment: ${["cluster-user-auto-connCluster"].pscServiceAttachments[0].serviceAttachment}
            - pscConnection:
                pscConnectionId: ${forwardingRule2Network2.pscConnectionId}
                address: ${ip2Network2.address}
                forwardingRule: ${forwardingRule2Network2.id}
                network: ${network2.id}
                serviceAttachment: ${["cluster-user-auto-connCluster"].pscServiceAttachments[1].serviceAttachment}
  forwardingRule1Network2:
    type: gcp:compute:ForwardingRule
    name: forwarding_rule1_network2
    properties:
      name: fwd1-net2
      region: us-central1
      ipAddress: ${ip1Network2.id}
      loadBalancingScheme: ""
      network: ${network2.id}
      target: ${["cluster-user-auto-connCluster"].pscServiceAttachments[0].serviceAttachment}
  forwardingRule2Network2:
    type: gcp:compute:ForwardingRule
    name: forwarding_rule2_network2
    properties:
      name: fwd2-net2
      region: us-central1
      ipAddress: ${ip2Network2.id}
      loadBalancingScheme: ""
      network: ${network2.id}
      target: ${["cluster-user-auto-connCluster"].pscServiceAttachments[1].serviceAttachment}
  ip1Network2:
    type: gcp:compute:Address
    name: ip1_network2
    properties:
      name: ip1-net2
      region: us-central1
      subnetwork: ${subnetNetwork2.id}
      addressType: INTERNAL
      purpose: GCE_ENDPOINT
  ip2Network2:
    type: gcp:compute:Address
    name: ip2_network2
    properties:
      name: ip2-net2
      region: us-central1
      subnetwork: ${subnetNetwork2.id}
      addressType: INTERNAL
      purpose: GCE_ENDPOINT
  subnetNetwork2:
    type: gcp:compute:Subnetwork
    name: subnet_network2
    properties:
      name: subnet-net2
      ipCidrRange: 10.0.0.248/29
      region: us-central1
      network: ${network2.id}
  network2:
    type: gcp:compute:Network
    properties:
      name: network2
      autoCreateSubnetworks: false
  # redis cluster without endpoint
  cluster-user-auto-connCluster:
    type: gcp:redis:Cluster
    name: cluster-user-auto-conn
    properties:
      name: cluster-user-auto-conn
      shardCount: 3
      region: us-central1
      replicaCount: 0
      deletionProtectionEnabled: false
      pscConfigs:
        - network: ${network1.id}
    options:
      dependsOn:
        - ${default}
  default:
    type: gcp:networkconnectivity:ServiceConnectionPolicy
    properties:
      name: scpolicy
      location: us-central1
      serviceClass: gcp-memorystore-redis
      description: my basic service connection policy
      network: ${network1.id}
      pscConfig:
        subnetworks:
          - ${subnetNetwork1.id}
  subnetNetwork1:
    type: gcp:compute:Subnetwork
    name: subnet_network1
    properties:
      name: subnet-net1
      ipCidrRange: 10.0.0.248/29
      region: us-central1
      network: ${network1.id}
  network1:
    type: gcp:compute:Network
    properties:
      name: net1
      autoCreateSubnetworks: false
Copy

Create ClusterUserCreatedConnections Resource

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

Constructor syntax

new ClusterUserCreatedConnections(name: string, args: ClusterUserCreatedConnectionsArgs, opts?: CustomResourceOptions);
@overload
def ClusterUserCreatedConnections(resource_name: str,
                                  args: ClusterUserCreatedConnectionsArgs,
                                  opts: Optional[ResourceOptions] = None)

@overload
def ClusterUserCreatedConnections(resource_name: str,
                                  opts: Optional[ResourceOptions] = None,
                                  region: Optional[str] = None,
                                  cluster_endpoints: Optional[Sequence[ClusterUserCreatedConnectionsClusterEndpointArgs]] = None,
                                  name: Optional[str] = None,
                                  project: Optional[str] = None)
func NewClusterUserCreatedConnections(ctx *Context, name string, args ClusterUserCreatedConnectionsArgs, opts ...ResourceOption) (*ClusterUserCreatedConnections, error)
public ClusterUserCreatedConnections(string name, ClusterUserCreatedConnectionsArgs args, CustomResourceOptions? opts = null)
public ClusterUserCreatedConnections(String name, ClusterUserCreatedConnectionsArgs args)
public ClusterUserCreatedConnections(String name, ClusterUserCreatedConnectionsArgs args, CustomResourceOptions options)
type: gcp:redis:ClusterUserCreatedConnections
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. ClusterUserCreatedConnectionsArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. ClusterUserCreatedConnectionsArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. ClusterUserCreatedConnectionsArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. ClusterUserCreatedConnectionsArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. ClusterUserCreatedConnectionsArgs
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 clusterUserCreatedConnectionsResource = new Gcp.Redis.ClusterUserCreatedConnections("clusterUserCreatedConnectionsResource", new()
{
    Region = "string",
    ClusterEndpoints = new[]
    {
        new Gcp.Redis.Inputs.ClusterUserCreatedConnectionsClusterEndpointArgs
        {
            Connections = new[]
            {
                new Gcp.Redis.Inputs.ClusterUserCreatedConnectionsClusterEndpointConnectionArgs
                {
                    PscConnection = new Gcp.Redis.Inputs.ClusterUserCreatedConnectionsClusterEndpointConnectionPscConnectionArgs
                    {
                        Address = "string",
                        ForwardingRule = "string",
                        Network = "string",
                        PscConnectionId = "string",
                        ServiceAttachment = "string",
                        ConnectionType = "string",
                        ProjectId = "string",
                        PscConnectionStatus = "string",
                    },
                },
            },
        },
    },
    Name = "string",
    Project = "string",
});
Copy
example, err := redis.NewClusterUserCreatedConnections(ctx, "clusterUserCreatedConnectionsResource", &redis.ClusterUserCreatedConnectionsArgs{
	Region: pulumi.String("string"),
	ClusterEndpoints: redis.ClusterUserCreatedConnectionsClusterEndpointArray{
		&redis.ClusterUserCreatedConnectionsClusterEndpointArgs{
			Connections: redis.ClusterUserCreatedConnectionsClusterEndpointConnectionArray{
				&redis.ClusterUserCreatedConnectionsClusterEndpointConnectionArgs{
					PscConnection: &redis.ClusterUserCreatedConnectionsClusterEndpointConnectionPscConnectionArgs{
						Address:             pulumi.String("string"),
						ForwardingRule:      pulumi.String("string"),
						Network:             pulumi.String("string"),
						PscConnectionId:     pulumi.String("string"),
						ServiceAttachment:   pulumi.String("string"),
						ConnectionType:      pulumi.String("string"),
						ProjectId:           pulumi.String("string"),
						PscConnectionStatus: pulumi.String("string"),
					},
				},
			},
		},
	},
	Name:    pulumi.String("string"),
	Project: pulumi.String("string"),
})
Copy
var clusterUserCreatedConnectionsResource = new ClusterUserCreatedConnections("clusterUserCreatedConnectionsResource", ClusterUserCreatedConnectionsArgs.builder()
    .region("string")
    .clusterEndpoints(ClusterUserCreatedConnectionsClusterEndpointArgs.builder()
        .connections(ClusterUserCreatedConnectionsClusterEndpointConnectionArgs.builder()
            .pscConnection(ClusterUserCreatedConnectionsClusterEndpointConnectionPscConnectionArgs.builder()
                .address("string")
                .forwardingRule("string")
                .network("string")
                .pscConnectionId("string")
                .serviceAttachment("string")
                .connectionType("string")
                .projectId("string")
                .pscConnectionStatus("string")
                .build())
            .build())
        .build())
    .name("string")
    .project("string")
    .build());
Copy
cluster_user_created_connections_resource = gcp.redis.ClusterUserCreatedConnections("clusterUserCreatedConnectionsResource",
    region="string",
    cluster_endpoints=[{
        "connections": [{
            "psc_connection": {
                "address": "string",
                "forwarding_rule": "string",
                "network": "string",
                "psc_connection_id": "string",
                "service_attachment": "string",
                "connection_type": "string",
                "project_id": "string",
                "psc_connection_status": "string",
            },
        }],
    }],
    name="string",
    project="string")
Copy
const clusterUserCreatedConnectionsResource = new gcp.redis.ClusterUserCreatedConnections("clusterUserCreatedConnectionsResource", {
    region: "string",
    clusterEndpoints: [{
        connections: [{
            pscConnection: {
                address: "string",
                forwardingRule: "string",
                network: "string",
                pscConnectionId: "string",
                serviceAttachment: "string",
                connectionType: "string",
                projectId: "string",
                pscConnectionStatus: "string",
            },
        }],
    }],
    name: "string",
    project: "string",
});
Copy
type: gcp:redis:ClusterUserCreatedConnections
properties:
    clusterEndpoints:
        - connections:
            - pscConnection:
                address: string
                connectionType: string
                forwardingRule: string
                network: string
                projectId: string
                pscConnectionId: string
                pscConnectionStatus: string
                serviceAttachment: string
    name: string
    project: string
    region: string
Copy

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

Region This property is required. string
The name of the region of the Redis cluster these endpoints should be added to.


ClusterEndpoints List<ClusterUserCreatedConnectionsClusterEndpoint>
A list of cluster endpoints Structure is documented below.
Name string
The name of the Redis cluster these endpoints should be added to.
Project Changes to this property will trigger replacement. string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
Region This property is required. string
The name of the region of the Redis cluster these endpoints should be added to.


ClusterEndpoints []ClusterUserCreatedConnectionsClusterEndpointArgs
A list of cluster endpoints Structure is documented below.
Name string
The name of the Redis cluster these endpoints should be added to.
Project Changes to this property will trigger replacement. string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
region This property is required. String
The name of the region of the Redis cluster these endpoints should be added to.


clusterEndpoints List<ClusterUserCreatedConnectionsClusterEndpoint>
A list of cluster endpoints Structure is documented below.
name String
The name of the Redis cluster these endpoints should be added to.
project Changes to this property will trigger replacement. String
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
region This property is required. string
The name of the region of the Redis cluster these endpoints should be added to.


clusterEndpoints ClusterUserCreatedConnectionsClusterEndpoint[]
A list of cluster endpoints Structure is documented below.
name string
The name of the Redis cluster these endpoints should be added to.
project Changes to this property will trigger replacement. string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
region This property is required. str
The name of the region of the Redis cluster these endpoints should be added to.


cluster_endpoints Sequence[ClusterUserCreatedConnectionsClusterEndpointArgs]
A list of cluster endpoints Structure is documented below.
name str
The name of the Redis cluster these endpoints should be added to.
project Changes to this property will trigger replacement. str
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
region This property is required. String
The name of the region of the Redis cluster these endpoints should be added to.


clusterEndpoints List<Property Map>
A list of cluster endpoints Structure is documented below.
name String
The name of the Redis cluster these endpoints should be added to.
project Changes to this property will trigger replacement. String
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Outputs

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

Get an existing ClusterUserCreatedConnections 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?: ClusterUserCreatedConnectionsState, opts?: CustomResourceOptions): ClusterUserCreatedConnections
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        cluster_endpoints: Optional[Sequence[ClusterUserCreatedConnectionsClusterEndpointArgs]] = None,
        name: Optional[str] = None,
        project: Optional[str] = None,
        region: Optional[str] = None) -> ClusterUserCreatedConnections
func GetClusterUserCreatedConnections(ctx *Context, name string, id IDInput, state *ClusterUserCreatedConnectionsState, opts ...ResourceOption) (*ClusterUserCreatedConnections, error)
public static ClusterUserCreatedConnections Get(string name, Input<string> id, ClusterUserCreatedConnectionsState? state, CustomResourceOptions? opts = null)
public static ClusterUserCreatedConnections get(String name, Output<String> id, ClusterUserCreatedConnectionsState state, CustomResourceOptions options)
resources:  _:    type: gcp:redis:ClusterUserCreatedConnections    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
ClusterEndpoints List<ClusterUserCreatedConnectionsClusterEndpoint>
A list of cluster endpoints Structure is documented below.
Name string
The name of the Redis cluster these endpoints should be added to.
Project Changes to this property will trigger replacement. string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
Region string
The name of the region of the Redis cluster these endpoints should be added to.


ClusterEndpoints []ClusterUserCreatedConnectionsClusterEndpointArgs
A list of cluster endpoints Structure is documented below.
Name string
The name of the Redis cluster these endpoints should be added to.
Project Changes to this property will trigger replacement. string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
Region string
The name of the region of the Redis cluster these endpoints should be added to.


clusterEndpoints List<ClusterUserCreatedConnectionsClusterEndpoint>
A list of cluster endpoints Structure is documented below.
name String
The name of the Redis cluster these endpoints should be added to.
project Changes to this property will trigger replacement. String
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
region String
The name of the region of the Redis cluster these endpoints should be added to.


clusterEndpoints ClusterUserCreatedConnectionsClusterEndpoint[]
A list of cluster endpoints Structure is documented below.
name string
The name of the Redis cluster these endpoints should be added to.
project Changes to this property will trigger replacement. string
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
region string
The name of the region of the Redis cluster these endpoints should be added to.


cluster_endpoints Sequence[ClusterUserCreatedConnectionsClusterEndpointArgs]
A list of cluster endpoints Structure is documented below.
name str
The name of the Redis cluster these endpoints should be added to.
project Changes to this property will trigger replacement. str
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
region str
The name of the region of the Redis cluster these endpoints should be added to.


clusterEndpoints List<Property Map>
A list of cluster endpoints Structure is documented below.
name String
The name of the Redis cluster these endpoints should be added to.
project Changes to this property will trigger replacement. String
The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
region String
The name of the region of the Redis cluster these endpoints should be added to.


Supporting Types

ClusterUserCreatedConnectionsClusterEndpoint
, ClusterUserCreatedConnectionsClusterEndpointArgs

connections List<Property Map>
Structure is documented below.

ClusterUserCreatedConnectionsClusterEndpointConnection
, ClusterUserCreatedConnectionsClusterEndpointConnectionArgs

PscConnection ClusterUserCreatedConnectionsClusterEndpointConnectionPscConnection
Detailed information of a PSC connection that is created by the customer who owns the cluster. Structure is documented below.
PscConnection ClusterUserCreatedConnectionsClusterEndpointConnectionPscConnection
Detailed information of a PSC connection that is created by the customer who owns the cluster. Structure is documented below.
pscConnection ClusterUserCreatedConnectionsClusterEndpointConnectionPscConnection
Detailed information of a PSC connection that is created by the customer who owns the cluster. Structure is documented below.
pscConnection ClusterUserCreatedConnectionsClusterEndpointConnectionPscConnection
Detailed information of a PSC connection that is created by the customer who owns the cluster. Structure is documented below.
psc_connection ClusterUserCreatedConnectionsClusterEndpointConnectionPscConnection
Detailed information of a PSC connection that is created by the customer who owns the cluster. Structure is documented below.
pscConnection Property Map
Detailed information of a PSC connection that is created by the customer who owns the cluster. Structure is documented below.

ClusterUserCreatedConnectionsClusterEndpointConnectionPscConnection
, ClusterUserCreatedConnectionsClusterEndpointConnectionPscConnectionArgs

Address This property is required. string
The IP allocated on the consumer network for the PSC forwarding rule.
ForwardingRule This property is required. string
The URI of the consumer side forwarding rule. Format: projects/{project}/regions/{region}/forwardingRules/{forwarding_rule}
Network This property is required. string
The consumer network where the IP address resides, in the form of projects/{project_id}/global/networks/{network_id}.
PscConnectionId This property is required. string
The PSC connection id of the forwarding rule connected to the service attachment.
ServiceAttachment This property is required. string
The service attachment which is the target of the PSC connection, in the form of projects/{project-id}/regions/{region}/serviceAttachments/{service-attachment-id}.
ConnectionType string
(Output) Output Only. Type of a PSC Connection. Possible values: CONNECTION_TYPE_DISCOVERY CONNECTION_TYPE_PRIMARY CONNECTION_TYPE_READER
ProjectId string
The consumer project_id where the forwarding rule is created from.
PscConnectionStatus string
(Output) Output Only. The status of the PSC connection: whether a connection exists and ACTIVE or it no longer exists. Possible values: ACTIVE NOT_FOUND
Address This property is required. string
The IP allocated on the consumer network for the PSC forwarding rule.
ForwardingRule This property is required. string
The URI of the consumer side forwarding rule. Format: projects/{project}/regions/{region}/forwardingRules/{forwarding_rule}
Network This property is required. string
The consumer network where the IP address resides, in the form of projects/{project_id}/global/networks/{network_id}.
PscConnectionId This property is required. string
The PSC connection id of the forwarding rule connected to the service attachment.
ServiceAttachment This property is required. string
The service attachment which is the target of the PSC connection, in the form of projects/{project-id}/regions/{region}/serviceAttachments/{service-attachment-id}.
ConnectionType string
(Output) Output Only. Type of a PSC Connection. Possible values: CONNECTION_TYPE_DISCOVERY CONNECTION_TYPE_PRIMARY CONNECTION_TYPE_READER
ProjectId string
The consumer project_id where the forwarding rule is created from.
PscConnectionStatus string
(Output) Output Only. The status of the PSC connection: whether a connection exists and ACTIVE or it no longer exists. Possible values: ACTIVE NOT_FOUND
address This property is required. String
The IP allocated on the consumer network for the PSC forwarding rule.
forwardingRule This property is required. String
The URI of the consumer side forwarding rule. Format: projects/{project}/regions/{region}/forwardingRules/{forwarding_rule}
network This property is required. String
The consumer network where the IP address resides, in the form of projects/{project_id}/global/networks/{network_id}.
pscConnectionId This property is required. String
The PSC connection id of the forwarding rule connected to the service attachment.
serviceAttachment This property is required. String
The service attachment which is the target of the PSC connection, in the form of projects/{project-id}/regions/{region}/serviceAttachments/{service-attachment-id}.
connectionType String
(Output) Output Only. Type of a PSC Connection. Possible values: CONNECTION_TYPE_DISCOVERY CONNECTION_TYPE_PRIMARY CONNECTION_TYPE_READER
projectId String
The consumer project_id where the forwarding rule is created from.
pscConnectionStatus String
(Output) Output Only. The status of the PSC connection: whether a connection exists and ACTIVE or it no longer exists. Possible values: ACTIVE NOT_FOUND
address This property is required. string
The IP allocated on the consumer network for the PSC forwarding rule.
forwardingRule This property is required. string
The URI of the consumer side forwarding rule. Format: projects/{project}/regions/{region}/forwardingRules/{forwarding_rule}
network This property is required. string
The consumer network where the IP address resides, in the form of projects/{project_id}/global/networks/{network_id}.
pscConnectionId This property is required. string
The PSC connection id of the forwarding rule connected to the service attachment.
serviceAttachment This property is required. string
The service attachment which is the target of the PSC connection, in the form of projects/{project-id}/regions/{region}/serviceAttachments/{service-attachment-id}.
connectionType string
(Output) Output Only. Type of a PSC Connection. Possible values: CONNECTION_TYPE_DISCOVERY CONNECTION_TYPE_PRIMARY CONNECTION_TYPE_READER
projectId string
The consumer project_id where the forwarding rule is created from.
pscConnectionStatus string
(Output) Output Only. The status of the PSC connection: whether a connection exists and ACTIVE or it no longer exists. Possible values: ACTIVE NOT_FOUND
address This property is required. str
The IP allocated on the consumer network for the PSC forwarding rule.
forwarding_rule This property is required. str
The URI of the consumer side forwarding rule. Format: projects/{project}/regions/{region}/forwardingRules/{forwarding_rule}
network This property is required. str
The consumer network where the IP address resides, in the form of projects/{project_id}/global/networks/{network_id}.
psc_connection_id This property is required. str
The PSC connection id of the forwarding rule connected to the service attachment.
service_attachment This property is required. str
The service attachment which is the target of the PSC connection, in the form of projects/{project-id}/regions/{region}/serviceAttachments/{service-attachment-id}.
connection_type str
(Output) Output Only. Type of a PSC Connection. Possible values: CONNECTION_TYPE_DISCOVERY CONNECTION_TYPE_PRIMARY CONNECTION_TYPE_READER
project_id str
The consumer project_id where the forwarding rule is created from.
psc_connection_status str
(Output) Output Only. The status of the PSC connection: whether a connection exists and ACTIVE or it no longer exists. Possible values: ACTIVE NOT_FOUND
address This property is required. String
The IP allocated on the consumer network for the PSC forwarding rule.
forwardingRule This property is required. String
The URI of the consumer side forwarding rule. Format: projects/{project}/regions/{region}/forwardingRules/{forwarding_rule}
network This property is required. String
The consumer network where the IP address resides, in the form of projects/{project_id}/global/networks/{network_id}.
pscConnectionId This property is required. String
The PSC connection id of the forwarding rule connected to the service attachment.
serviceAttachment This property is required. String
The service attachment which is the target of the PSC connection, in the form of projects/{project-id}/regions/{region}/serviceAttachments/{service-attachment-id}.
connectionType String
(Output) Output Only. Type of a PSC Connection. Possible values: CONNECTION_TYPE_DISCOVERY CONNECTION_TYPE_PRIMARY CONNECTION_TYPE_READER
projectId String
The consumer project_id where the forwarding rule is created from.
pscConnectionStatus String
(Output) Output Only. The status of the PSC connection: whether a connection exists and ACTIVE or it no longer exists. Possible values: ACTIVE NOT_FOUND

Import

ClusterUserCreatedConnections can be imported using any of these accepted formats:

  • projects/{{project}}/locations/{{region}}/clusters/{{name}}

  • {{project}}/{{region}}/{{name}}

  • {{region}}/{{name}}

  • {{name}}

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

$ pulumi import gcp:redis/clusterUserCreatedConnections:ClusterUserCreatedConnections default projects/{{project}}/locations/{{region}}/clusters/{{name}}
Copy
$ pulumi import gcp:redis/clusterUserCreatedConnections:ClusterUserCreatedConnections default {{project}}/{{region}}/{{name}}
Copy
$ pulumi import gcp:redis/clusterUserCreatedConnections:ClusterUserCreatedConnections default {{region}}/{{name}}
Copy
$ pulumi import gcp:redis/clusterUserCreatedConnections:ClusterUserCreatedConnections default {{name}}
Copy

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.