astra.PrivateLinkEndpoint
Explore with Pulumi AI
astra.PrivateLinkEndpoint
completes the creation of a private link endpoint by associating it with your endpoint.
Example Usage
using System.Collections.Generic;
using Pulumi;
using Astra = Pulumiverse.Astra;
using Aws = Pulumi.Aws;
using Azure = Pulumi.Azure;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
// AWS example
var exampleAstraIndex_privateLinkPrivateLink = new Astra.PrivateLink("exampleAstraIndex/privateLinkPrivateLink", new()
{
AllowedPrincipals = new[]
{
"arn:aws:iam::445559476293:user/Sebastian",
},
DatabaseId = "a6bc9c26-e7ce-424f-84c7-0a00afb12588",
DatacenterId = "a6bc9c26-e7ce-424f-84c7-0a00afb12588-1",
});
var exampleVpcEndpoint = new Aws.Ec2.VpcEndpoint("exampleVpcEndpoint", new()
{
VpcId = "vpc-f939e884",
ServiceName = exampleAstraIndex / privateLinkPrivateLink.ServiceName,
VpcEndpointType = "Interface",
SubnetIds = new[]
{
"subnet-4d376300",
"subnet-4d85066c",
"subnet-030e8b65",
},
SecurityGroupIds = new[]
{
"sg-74ae4d41",
},
});
var examplePrivateLinkEndpoint = new Astra.PrivateLinkEndpoint("examplePrivateLinkEndpoint", new()
{
DatabaseId = "a6bc9c26-e7ce-424f-84c7-0a00afb12588",
DatacenterId = "a6bc9c26-e7ce-424f-84c7-0a00afb12588-1",
EndpointId = exampleVpcEndpoint.Id,
});
var examplePrivateLink = new Astra.PrivateLink("examplePrivateLink", new()
{
AllowedPrincipals = new[]
{
"my-project",
},
DatabaseId = "a6bc9c26-e7ce-424f-84c7-0a00afb12588",
DatacenterId = "a6bc9c26-e7ce-424f-84c7-0a00afb12588-1",
});
var exampleNetwork = new Gcp.Compute.Network("exampleNetwork", new()
{
AutoCreateSubnetworks = false,
});
var exampleSubnetwork = new Gcp.Compute.Subnetwork("exampleSubnetwork", new()
{
IpCidrRange = "10.142.0.0/20",
Region = "us-east1",
Network = exampleNetwork.Id,
});
var exampleAddress = new Gcp.Compute.Address("exampleAddress", new()
{
Subnetwork = exampleSubnetwork.Id,
AddressType = "INTERNAL",
Region = "us-east1",
});
var exampleForwardingRule = new Gcp.Compute.ForwardingRule("exampleForwardingRule", new()
{
Target = $"https://www.googleapis.com/compute/v1/{exampleAstraIndex / privateLinkPrivateLink.ServiceName}",
Project = exampleNetwork.Project,
IpAddress = exampleAddress.Id,
Network = exampleNetwork.Id,
Region = "us-east1",
LoadBalancingScheme = "",
});
// The endpoint ID (PSC Connection ID) is not currently accessible from the google_compute_forwarding_rule terraform object.
// It must be retrieved via the GCP UI (https://console.cloud.google.com/net-services/psc/list) or via the gcloud CLI:
// gcloud compute forwarding-rules describe psc-endpoint --region=us-east1
var endpoint = new Astra.PrivateLinkEndpoint("endpoint", new()
{
DatabaseId = "a6bc9c26-e7ce-424f-84c7-0a00afb12588",
DatacenterId = "a6bc9c26-e7ce-424f-84c7-0a00afb12588-1",
EndpointId = "13585698993864708",
});
var current = Azure.Core.GetSubscription.Invoke();
var exampleResourceGroup = Azure.Core.GetResourceGroup.Invoke(new()
{
Name = "example-rg",
});
var exampleVirtualNetwork = Azure.Network.GetVirtualNetwork.Invoke(new()
{
Name = "example-virtual-network",
ResourceGroupName = exampleResourceGroup.Apply(getResourceGroupResult => getResourceGroupResult.Name),
});
var exampleSubnet = Azure.Network.GetSubnet.Invoke(new()
{
Name = "example-subnet",
VirtualNetworkName = exampleVirtualNetwork.Apply(getVirtualNetworkResult => getVirtualNetworkResult.Name),
ResourceGroupName = exampleResourceGroup.Apply(getResourceGroupResult => getResourceGroupResult.Name),
});
var exampleIndex_privateLinkPrivateLink = new Astra.PrivateLink("exampleIndex/privateLinkPrivateLink", new()
{
AllowedPrincipals = new[]
{
current.Apply(getSubscriptionResult => getSubscriptionResult.SubscriptionId),
},
DatabaseId = "a6bc9c26-e7ce-424f-84c7-0a00afb12588",
DatacenterId = "a6bc9c26-e7ce-424f-84c7-0a00afb12588-1",
});
var exampleEndpoint = new Azure.PrivateLink.Endpoint("exampleEndpoint", new()
{
Location = exampleResourceGroup.Apply(getResourceGroupResult => getResourceGroupResult.Location),
ResourceGroupName = exampleResourceGroup.Apply(getResourceGroupResult => getResourceGroupResult.Name),
SubnetId = exampleSubnet.Apply(getSubnetResult => getSubnetResult.Id),
PrivateServiceConnection = new Azure.PrivateLink.Inputs.EndpointPrivateServiceConnectionArgs
{
Name = "example-private-connection",
PrivateConnectionResourceAlias = exampleAstraIndex / privateLinkPrivateLink.ServiceName,
IsManualConnection = true,
RequestMessage = "Private connection from AKS subnet to Astra DB",
},
});
// NOTE: If you destroy the astra_private_link_endpoint resource for an Azure private endpoint,
// you will have to destroy and recreate the azurerm_private_endpoint resource in order to
// reconnect and Astra private link endpoint.
var azPrivateLinkEndpoint = new Astra.PrivateLinkEndpoint("azPrivateLinkEndpoint", new()
{
DatabaseId = "a6bc9c26-e7ce-424f-84c7-0a00afb12588",
DatacenterId = "a6bc9c26-e7ce-424f-84c7-0a00afb12588-1",
EndpointId = Output.Tuple(exampleResourceGroup.Apply(getResourceGroupResult => getResourceGroupResult), exampleEndpoint.Name).Apply(values =>
{
var exampleResourceGroup = values.Item1;
var name = values.Item2;
return $"{exampleResourceGroup.Apply(getResourceGroupResult => getResourceGroupResult.Id)}/providers/Microsoft.Network/privateEndpoints/{name}";
}),
});
});
package main
import (
"fmt"
"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/ec2"
"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/core"
"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/network"
"github.com/pulumi/pulumi-azure/sdk/v4/go/azure/privatelink"
"github.com/pulumi/pulumi-gcp/sdk/v5/go/gcp/compute"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumiverse/pulumi-astra/sdk/go/astra"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := astra.NewPrivateLink(ctx, "exampleAstraIndex/privateLinkPrivateLink", &astra.PrivateLinkArgs{
AllowedPrincipals: pulumi.StringArray{
pulumi.String("arn:aws:iam::445559476293:user/Sebastian"),
},
DatabaseId: pulumi.String("a6bc9c26-e7ce-424f-84c7-0a00afb12588"),
DatacenterId: pulumi.String("a6bc9c26-e7ce-424f-84c7-0a00afb12588-1"),
})
if err != nil {
return err
}
exampleVpcEndpoint, err := ec2.NewVpcEndpoint(ctx, "exampleVpcEndpoint", &ec2.VpcEndpointArgs{
VpcId: pulumi.String("vpc-f939e884"),
ServiceName: exampleAstraIndex / privateLinkPrivateLink.ServiceName,
VpcEndpointType: pulumi.String("Interface"),
SubnetIds: pulumi.StringArray{
pulumi.String("subnet-4d376300"),
pulumi.String("subnet-4d85066c"),
pulumi.String("subnet-030e8b65"),
},
SecurityGroupIds: pulumi.StringArray{
pulumi.String("sg-74ae4d41"),
},
})
if err != nil {
return err
}
_, err = astra.NewPrivateLinkEndpoint(ctx, "examplePrivateLinkEndpoint", &astra.PrivateLinkEndpointArgs{
DatabaseId: pulumi.String("a6bc9c26-e7ce-424f-84c7-0a00afb12588"),
DatacenterId: pulumi.String("a6bc9c26-e7ce-424f-84c7-0a00afb12588-1"),
EndpointId: exampleVpcEndpoint.ID(),
})
if err != nil {
return err
}
_, err = astra.NewPrivateLink(ctx, "examplePrivateLink", &astra.PrivateLinkArgs{
AllowedPrincipals: pulumi.StringArray{
pulumi.String("my-project"),
},
DatabaseId: pulumi.String("a6bc9c26-e7ce-424f-84c7-0a00afb12588"),
DatacenterId: pulumi.String("a6bc9c26-e7ce-424f-84c7-0a00afb12588-1"),
})
if err != nil {
return err
}
exampleNetwork, err := compute.NewNetwork(ctx, "exampleNetwork", &compute.NetworkArgs{
AutoCreateSubnetworks: pulumi.Bool(false),
})
if err != nil {
return err
}
exampleSubnetwork, err := compute.NewSubnetwork(ctx, "exampleSubnetwork", &compute.SubnetworkArgs{
IpCidrRange: pulumi.String("10.142.0.0/20"),
Region: pulumi.String("us-east1"),
Network: exampleNetwork.ID(),
})
if err != nil {
return err
}
exampleAddress, err := compute.NewAddress(ctx, "exampleAddress", &compute.AddressArgs{
Subnetwork: exampleSubnetwork.ID(),
AddressType: pulumi.String("INTERNAL"),
Region: pulumi.String("us-east1"),
})
if err != nil {
return err
}
_, err = compute.NewForwardingRule(ctx, "exampleForwardingRule", &compute.ForwardingRuleArgs{
Target: pulumi.String(fmt.Sprintf("https://www.googleapis.com/compute/v1/%v", exampleAstraIndex/privateLinkPrivateLink.ServiceName)),
Project: exampleNetwork.Project,
IpAddress: exampleAddress.ID(),
Network: exampleNetwork.ID(),
Region: pulumi.String("us-east1"),
LoadBalancingScheme: pulumi.String(""),
})
if err != nil {
return err
}
_, err = astra.NewPrivateLinkEndpoint(ctx, "endpoint", &astra.PrivateLinkEndpointArgs{
DatabaseId: pulumi.String("a6bc9c26-e7ce-424f-84c7-0a00afb12588"),
DatacenterId: pulumi.String("a6bc9c26-e7ce-424f-84c7-0a00afb12588-1"),
EndpointId: pulumi.String("13585698993864708"),
})
if err != nil {
return err
}
current, err := core.LookupSubscription(ctx, nil, nil)
if err != nil {
return err
}
exampleResourceGroup, err := core.LookupResourceGroup(ctx, &core.LookupResourceGroupArgs{
Name: "example-rg",
}, nil)
if err != nil {
return err
}
exampleVirtualNetwork, err := network.LookupVirtualNetwork(ctx, &network.LookupVirtualNetworkArgs{
Name: "example-virtual-network",
ResourceGroupName: exampleResourceGroup.Name,
}, nil)
if err != nil {
return err
}
exampleSubnet, err := network.LookupSubnet(ctx, &network.LookupSubnetArgs{
Name: "example-subnet",
VirtualNetworkName: exampleVirtualNetwork.Name,
ResourceGroupName: exampleResourceGroup.Name,
}, nil)
if err != nil {
return err
}
_, err = astra.NewPrivateLink(ctx, "exampleIndex/privateLinkPrivateLink", &astra.PrivateLinkArgs{
AllowedPrincipals: pulumi.StringArray{
pulumi.String(current.SubscriptionId),
},
DatabaseId: pulumi.String("a6bc9c26-e7ce-424f-84c7-0a00afb12588"),
DatacenterId: pulumi.String("a6bc9c26-e7ce-424f-84c7-0a00afb12588-1"),
})
if err != nil {
return err
}
exampleEndpoint, err := privatelink.NewEndpoint(ctx, "exampleEndpoint", &privatelink.EndpointArgs{
Location: pulumi.String(exampleResourceGroup.Location),
ResourceGroupName: pulumi.String(exampleResourceGroup.Name),
SubnetId: pulumi.String(exampleSubnet.Id),
PrivateServiceConnection: &privatelink.EndpointPrivateServiceConnectionArgs{
Name: pulumi.String("example-private-connection"),
PrivateConnectionResourceAlias: exampleAstraIndex / privateLinkPrivateLink.ServiceName,
IsManualConnection: pulumi.Bool(true),
RequestMessage: pulumi.String("Private connection from AKS subnet to Astra DB"),
},
})
if err != nil {
return err
}
_, err = astra.NewPrivateLinkEndpoint(ctx, "azPrivateLinkEndpoint", &astra.PrivateLinkEndpointArgs{
DatabaseId: pulumi.String("a6bc9c26-e7ce-424f-84c7-0a00afb12588"),
DatacenterId: pulumi.String("a6bc9c26-e7ce-424f-84c7-0a00afb12588-1"),
EndpointId: exampleEndpoint.Name.ApplyT(func(name string) (string, error) {
return fmt.Sprintf("%v/providers/Microsoft.Network/privateEndpoints/%v", exampleResourceGroup.Id, name), nil
}).(pulumi.StringOutput),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.astra.PrivateLink;
import com.pulumi.astra.PrivateLinkArgs;
import com.pulumi.aws.ec2.VpcEndpoint;
import com.pulumi.aws.ec2.VpcEndpointArgs;
import com.pulumi.astra.PrivateLinkEndpoint;
import com.pulumi.astra.PrivateLinkEndpointArgs;
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.compute.ForwardingRule;
import com.pulumi.gcp.compute.ForwardingRuleArgs;
import com.pulumi.azure.core.CoreFunctions;
import com.pulumi.azure.core.inputs.GetSubscriptionArgs;
import com.pulumi.azure.core.inputs.GetResourceGroupArgs;
import com.pulumi.azure.network.NetworkFunctions;
import com.pulumi.azure.devtest.inputs.GetVirtualNetworkArgs;
import com.pulumi.aws.ec2.inputs.GetSubnetArgs;
import com.pulumi.azure.privatelink.Endpoint;
import com.pulumi.azure.privatelink.EndpointArgs;
import com.pulumi.azure.privatelink.inputs.EndpointPrivateServiceConnectionArgs;
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 exampleAstraIndex_privateLinkPrivateLink = new PrivateLink("exampleAstraIndex/privateLinkPrivateLink", PrivateLinkArgs.builder()
.allowedPrincipals("arn:aws:iam::445559476293:user/Sebastian")
.databaseId("a6bc9c26-e7ce-424f-84c7-0a00afb12588")
.datacenterId("a6bc9c26-e7ce-424f-84c7-0a00afb12588-1")
.build());
var exampleVpcEndpoint = new VpcEndpoint("exampleVpcEndpoint", VpcEndpointArgs.builder()
.vpcId("vpc-f939e884")
.serviceName(exampleAstraIndex / privateLinkPrivateLink.serviceName())
.vpcEndpointType("Interface")
.subnetIds(
"subnet-4d376300",
"subnet-4d85066c",
"subnet-030e8b65")
.securityGroupIds("sg-74ae4d41")
.build());
var examplePrivateLinkEndpoint = new PrivateLinkEndpoint("examplePrivateLinkEndpoint", PrivateLinkEndpointArgs.builder()
.databaseId("a6bc9c26-e7ce-424f-84c7-0a00afb12588")
.datacenterId("a6bc9c26-e7ce-424f-84c7-0a00afb12588-1")
.endpointId(exampleVpcEndpoint.id())
.build());
var examplePrivateLink = new PrivateLink("examplePrivateLink", PrivateLinkArgs.builder()
.allowedPrincipals("my-project")
.databaseId("a6bc9c26-e7ce-424f-84c7-0a00afb12588")
.datacenterId("a6bc9c26-e7ce-424f-84c7-0a00afb12588-1")
.build());
var exampleNetwork = new Network("exampleNetwork", NetworkArgs.builder()
.autoCreateSubnetworks(false)
.build());
var exampleSubnetwork = new Subnetwork("exampleSubnetwork", SubnetworkArgs.builder()
.ipCidrRange("10.142.0.0/20")
.region("us-east1")
.network(exampleNetwork.id())
.build());
var exampleAddress = new Address("exampleAddress", AddressArgs.builder()
.subnetwork(exampleSubnetwork.id())
.addressType("INTERNAL")
.region("us-east1")
.build());
var exampleForwardingRule = new ForwardingRule("exampleForwardingRule", ForwardingRuleArgs.builder()
.target(String.format("https://www.googleapis.com/compute/v1/%s", exampleAstraIndex / privateLinkPrivateLink.serviceName()))
.project(exampleNetwork.project())
.ipAddress(exampleAddress.id())
.network(exampleNetwork.id())
.region("us-east1")
.loadBalancingScheme("")
.build());
var endpoint = new PrivateLinkEndpoint("endpoint", PrivateLinkEndpointArgs.builder()
.databaseId("a6bc9c26-e7ce-424f-84c7-0a00afb12588")
.datacenterId("a6bc9c26-e7ce-424f-84c7-0a00afb12588-1")
.endpointId("13585698993864708")
.build());
final var current = CoreFunctions.getSubscription();
final var exampleResourceGroup = CoreFunctions.getResourceGroup(GetResourceGroupArgs.builder()
.name("example-rg")
.build());
final var exampleVirtualNetwork = NetworkFunctions.getVirtualNetwork(GetVirtualNetworkArgs.builder()
.name("example-virtual-network")
.resourceGroupName(exampleResourceGroup.applyValue(getResourceGroupResult -> getResourceGroupResult.name()))
.build());
final var exampleSubnet = NetworkFunctions.getSubnet(GetSubnetArgs.builder()
.name("example-subnet")
.virtualNetworkName(exampleVirtualNetwork.applyValue(getVirtualNetworkResult -> getVirtualNetworkResult.name()))
.resourceGroupName(exampleResourceGroup.applyValue(getResourceGroupResult -> getResourceGroupResult.name()))
.build());
var exampleIndex_privateLinkPrivateLink = new PrivateLink("exampleIndex/privateLinkPrivateLink", PrivateLinkArgs.builder()
.allowedPrincipals(current.applyValue(getSubscriptionResult -> getSubscriptionResult.subscriptionId()))
.databaseId("a6bc9c26-e7ce-424f-84c7-0a00afb12588")
.datacenterId("a6bc9c26-e7ce-424f-84c7-0a00afb12588-1")
.build());
var exampleEndpoint = new Endpoint("exampleEndpoint", EndpointArgs.builder()
.location(exampleResourceGroup.applyValue(getResourceGroupResult -> getResourceGroupResult.location()))
.resourceGroupName(exampleResourceGroup.applyValue(getResourceGroupResult -> getResourceGroupResult.name()))
.subnetId(exampleSubnet.applyValue(getSubnetResult -> getSubnetResult.id()))
.privateServiceConnection(EndpointPrivateServiceConnectionArgs.builder()
.name("example-private-connection")
.privateConnectionResourceAlias(exampleAstraIndex / privateLinkPrivateLink.serviceName())
.isManualConnection(true)
.requestMessage("Private connection from AKS subnet to Astra DB")
.build())
.build());
var azPrivateLinkEndpoint = new PrivateLinkEndpoint("azPrivateLinkEndpoint", PrivateLinkEndpointArgs.builder()
.databaseId("a6bc9c26-e7ce-424f-84c7-0a00afb12588")
.datacenterId("a6bc9c26-e7ce-424f-84c7-0a00afb12588-1")
.endpointId(exampleEndpoint.name().applyValue(name -> String.format("%s/providers/Microsoft.Network/privateEndpoints/%s", exampleResourceGroup.applyValue(getResourceGroupResult -> getResourceGroupResult.id()),name)))
.build());
}
}
import pulumi
import pulumi_aws as aws
import pulumi_azure as azure
import pulumi_gcp as gcp
import pulumiverse_astra as astra
# AWS example
example_astra_index_private_link_private_link = astra.PrivateLink("exampleAstraIndex/privateLinkPrivateLink",
allowed_principals=["arn:aws:iam::445559476293:user/Sebastian"],
database_id="a6bc9c26-e7ce-424f-84c7-0a00afb12588",
datacenter_id="a6bc9c26-e7ce-424f-84c7-0a00afb12588-1")
example_vpc_endpoint = aws.ec2.VpcEndpoint("exampleVpcEndpoint",
vpc_id="vpc-f939e884",
service_name=example_astra_index / private_link_private_link["serviceName"],
vpc_endpoint_type="Interface",
subnet_ids=[
"subnet-4d376300",
"subnet-4d85066c",
"subnet-030e8b65",
],
security_group_ids=["sg-74ae4d41"])
example_private_link_endpoint = astra.PrivateLinkEndpoint("examplePrivateLinkEndpoint",
database_id="a6bc9c26-e7ce-424f-84c7-0a00afb12588",
datacenter_id="a6bc9c26-e7ce-424f-84c7-0a00afb12588-1",
endpoint_id=example_vpc_endpoint.id)
example_private_link = astra.PrivateLink("examplePrivateLink",
allowed_principals=["my-project"],
database_id="a6bc9c26-e7ce-424f-84c7-0a00afb12588",
datacenter_id="a6bc9c26-e7ce-424f-84c7-0a00afb12588-1")
example_network = gcp.compute.Network("exampleNetwork", auto_create_subnetworks=False)
example_subnetwork = gcp.compute.Subnetwork("exampleSubnetwork",
ip_cidr_range="10.142.0.0/20",
region="us-east1",
network=example_network.id)
example_address = gcp.compute.Address("exampleAddress",
subnetwork=example_subnetwork.id,
address_type="INTERNAL",
region="us-east1")
example_forwarding_rule = gcp.compute.ForwardingRule("exampleForwardingRule",
target=f"https://www.googleapis.com/compute/v1/{example_astra_index / private_link_private_link['serviceName']}",
project=example_network.project,
ip_address=example_address.id,
network=example_network.id,
region="us-east1",
load_balancing_scheme="")
# The endpoint ID (PSC Connection ID) is not currently accessible from the google_compute_forwarding_rule terraform object.
# It must be retrieved via the GCP UI (https://console.cloud.google.com/net-services/psc/list) or via the gcloud CLI:
# gcloud compute forwarding-rules describe psc-endpoint --region=us-east1
endpoint = astra.PrivateLinkEndpoint("endpoint",
database_id="a6bc9c26-e7ce-424f-84c7-0a00afb12588",
datacenter_id="a6bc9c26-e7ce-424f-84c7-0a00afb12588-1",
endpoint_id="13585698993864708")
current = azure.core.get_subscription()
example_resource_group = azure.core.get_resource_group(name="example-rg")
example_virtual_network = azure.network.get_virtual_network(name="example-virtual-network",
resource_group_name=example_resource_group.name)
example_subnet = azure.network.get_subnet(name="example-subnet",
virtual_network_name=example_virtual_network.name,
resource_group_name=example_resource_group.name)
example_index_private_link_private_link = astra.PrivateLink("exampleIndex/privateLinkPrivateLink",
allowed_principals=[current.subscription_id],
database_id="a6bc9c26-e7ce-424f-84c7-0a00afb12588",
datacenter_id="a6bc9c26-e7ce-424f-84c7-0a00afb12588-1")
example_endpoint = azure.privatelink.Endpoint("exampleEndpoint",
location=example_resource_group.location,
resource_group_name=example_resource_group.name,
subnet_id=example_subnet.id,
private_service_connection=azure.privatelink.EndpointPrivateServiceConnectionArgs(
name="example-private-connection",
private_connection_resource_alias=example_astra_index / private_link_private_link["serviceName"],
is_manual_connection=True,
request_message="Private connection from AKS subnet to Astra DB",
))
# NOTE: If you destroy the astra_private_link_endpoint resource for an Azure private endpoint,
# you will have to destroy and recreate the azurerm_private_endpoint resource in order to
# reconnect and Astra private link endpoint.
az_private_link_endpoint = astra.PrivateLinkEndpoint("azPrivateLinkEndpoint",
database_id="a6bc9c26-e7ce-424f-84c7-0a00afb12588",
datacenter_id="a6bc9c26-e7ce-424f-84c7-0a00afb12588-1",
endpoint_id=example_endpoint.name.apply(lambda name: f"{example_resource_group.id}/providers/Microsoft.Network/privateEndpoints/{name}"))
import * as pulumi from "@pulumi/pulumi";
import * as astra from "@pulumiverse/astra";
import * as aws from "@pulumi/aws";
import * as azure from "@pulumi/azure";
import * as gcp from "@pulumi/gcp";
// AWS example
const exampleAstraIndex_privateLinkPrivateLink = new astra.PrivateLink("exampleAstraIndex/privateLinkPrivateLink", {
allowedPrincipals: ["arn:aws:iam::445559476293:user/Sebastian"],
databaseId: "a6bc9c26-e7ce-424f-84c7-0a00afb12588",
datacenterId: "a6bc9c26-e7ce-424f-84c7-0a00afb12588-1",
});
const exampleVpcEndpoint = new aws.ec2.VpcEndpoint("exampleVpcEndpoint", {
vpcId: "vpc-f939e884",
serviceName: exampleAstraIndex / privateLinkPrivateLink.serviceName,
vpcEndpointType: "Interface",
subnetIds: [
"subnet-4d376300",
"subnet-4d85066c",
"subnet-030e8b65",
],
securityGroupIds: ["sg-74ae4d41"],
});
const examplePrivateLinkEndpoint = new astra.PrivateLinkEndpoint("examplePrivateLinkEndpoint", {
databaseId: "a6bc9c26-e7ce-424f-84c7-0a00afb12588",
datacenterId: "a6bc9c26-e7ce-424f-84c7-0a00afb12588-1",
endpointId: exampleVpcEndpoint.id,
});
const examplePrivateLink = new astra.PrivateLink("examplePrivateLink", {
allowedPrincipals: ["my-project"],
databaseId: "a6bc9c26-e7ce-424f-84c7-0a00afb12588",
datacenterId: "a6bc9c26-e7ce-424f-84c7-0a00afb12588-1",
});
const exampleNetwork = new gcp.compute.Network("exampleNetwork", {autoCreateSubnetworks: false});
const exampleSubnetwork = new gcp.compute.Subnetwork("exampleSubnetwork", {
ipCidrRange: "10.142.0.0/20",
region: "us-east1",
network: exampleNetwork.id,
});
const exampleAddress = new gcp.compute.Address("exampleAddress", {
subnetwork: exampleSubnetwork.id,
addressType: "INTERNAL",
region: "us-east1",
});
const exampleForwardingRule = new gcp.compute.ForwardingRule("exampleForwardingRule", {
target: `https://www.googleapis.com/compute/v1/${exampleAstraIndex / privateLinkPrivateLink.serviceName}`,
project: exampleNetwork.project,
ipAddress: exampleAddress.id,
network: exampleNetwork.id,
region: "us-east1",
loadBalancingScheme: "",
});
// The endpoint ID (PSC Connection ID) is not currently accessible from the google_compute_forwarding_rule terraform object.
// It must be retrieved via the GCP UI (https://console.cloud.google.com/net-services/psc/list) or via the gcloud CLI:
// gcloud compute forwarding-rules describe psc-endpoint --region=us-east1
const endpoint = new astra.PrivateLinkEndpoint("endpoint", {
databaseId: "a6bc9c26-e7ce-424f-84c7-0a00afb12588",
datacenterId: "a6bc9c26-e7ce-424f-84c7-0a00afb12588-1",
endpointId: "13585698993864708",
});
const current = azure.core.getSubscription({});
const exampleResourceGroup = azure.core.getResourceGroup({
name: "example-rg",
});
const exampleVirtualNetwork = exampleResourceGroup.then(exampleResourceGroup => azure.network.getVirtualNetwork({
name: "example-virtual-network",
resourceGroupName: exampleResourceGroup.name,
}));
const exampleSubnet = Promise.all([exampleVirtualNetwork, exampleResourceGroup]).then(([exampleVirtualNetwork, exampleResourceGroup]) => azure.network.getSubnet({
name: "example-subnet",
virtualNetworkName: exampleVirtualNetwork.name,
resourceGroupName: exampleResourceGroup.name,
}));
const exampleIndex_privateLinkPrivateLink = new astra.PrivateLink("exampleIndex/privateLinkPrivateLink", {
allowedPrincipals: [current.then(current => current.subscriptionId)],
databaseId: "a6bc9c26-e7ce-424f-84c7-0a00afb12588",
datacenterId: "a6bc9c26-e7ce-424f-84c7-0a00afb12588-1",
});
const exampleEndpoint = new azure.privatelink.Endpoint("exampleEndpoint", {
location: exampleResourceGroup.then(exampleResourceGroup => exampleResourceGroup.location),
resourceGroupName: exampleResourceGroup.then(exampleResourceGroup => exampleResourceGroup.name),
subnetId: exampleSubnet.then(exampleSubnet => exampleSubnet.id),
privateServiceConnection: {
name: "example-private-connection",
privateConnectionResourceAlias: exampleAstraIndex / privateLinkPrivateLink.serviceName,
isManualConnection: true,
requestMessage: "Private connection from AKS subnet to Astra DB",
},
});
// NOTE: If you destroy the astra_private_link_endpoint resource for an Azure private endpoint,
// you will have to destroy and recreate the azurerm_private_endpoint resource in order to
// reconnect and Astra private link endpoint.
const azPrivateLinkEndpoint = new astra.PrivateLinkEndpoint("azPrivateLinkEndpoint", {
databaseId: "a6bc9c26-e7ce-424f-84c7-0a00afb12588",
datacenterId: "a6bc9c26-e7ce-424f-84c7-0a00afb12588-1",
endpointId: pulumi.all([exampleResourceGroup, exampleEndpoint.name]).apply(([exampleResourceGroup, name]) => `${exampleResourceGroup.id}/providers/Microsoft.Network/privateEndpoints/${name}`),
});
Coming soon!
Create PrivateLinkEndpoint Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new PrivateLinkEndpoint(name: string, args: PrivateLinkEndpointArgs, opts?: CustomResourceOptions);
@overload
def PrivateLinkEndpoint(resource_name: str,
args: PrivateLinkEndpointArgs,
opts: Optional[ResourceOptions] = None)
@overload
def PrivateLinkEndpoint(resource_name: str,
opts: Optional[ResourceOptions] = None,
database_id: Optional[str] = None,
datacenter_id: Optional[str] = None,
endpoint_id: Optional[str] = None)
func NewPrivateLinkEndpoint(ctx *Context, name string, args PrivateLinkEndpointArgs, opts ...ResourceOption) (*PrivateLinkEndpoint, error)
public PrivateLinkEndpoint(string name, PrivateLinkEndpointArgs args, CustomResourceOptions? opts = null)
public PrivateLinkEndpoint(String name, PrivateLinkEndpointArgs args)
public PrivateLinkEndpoint(String name, PrivateLinkEndpointArgs args, CustomResourceOptions options)
type: astra:PrivateLinkEndpoint
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args PrivateLinkEndpointArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args PrivateLinkEndpointArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args PrivateLinkEndpointArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args PrivateLinkEndpointArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args PrivateLinkEndpointArgs
- 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 privateLinkEndpointResource = new Astra.PrivateLinkEndpoint("privateLinkEndpointResource", new()
{
DatabaseId = "string",
DatacenterId = "string",
EndpointId = "string",
});
example, err := astra.NewPrivateLinkEndpoint(ctx, "privateLinkEndpointResource", &astra.PrivateLinkEndpointArgs{
DatabaseId: pulumi.String("string"),
DatacenterId: pulumi.String("string"),
EndpointId: pulumi.String("string"),
})
var privateLinkEndpointResource = new PrivateLinkEndpoint("privateLinkEndpointResource", PrivateLinkEndpointArgs.builder()
.databaseId("string")
.datacenterId("string")
.endpointId("string")
.build());
private_link_endpoint_resource = astra.PrivateLinkEndpoint("privateLinkEndpointResource",
database_id="string",
datacenter_id="string",
endpoint_id="string")
const privateLinkEndpointResource = new astra.PrivateLinkEndpoint("privateLinkEndpointResource", {
databaseId: "string",
datacenterId: "string",
endpointId: "string",
});
type: astra:PrivateLinkEndpoint
properties:
databaseId: string
datacenterId: string
endpointId: string
PrivateLinkEndpoint 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 PrivateLinkEndpoint resource accepts the following input properties:
- Database
Id string - The ID of the Astra database.
- Datacenter
Id string - Astra datacenter in the region where the private link will be created.
- Endpoint
Id string - Endpoint created in your cloud provider account example: "vpce-svc-1148ea04af8675309"
- Database
Id string - The ID of the Astra database.
- Datacenter
Id string - Astra datacenter in the region where the private link will be created.
- Endpoint
Id string - Endpoint created in your cloud provider account example: "vpce-svc-1148ea04af8675309"
- database
Id String - The ID of the Astra database.
- datacenter
Id String - Astra datacenter in the region where the private link will be created.
- endpoint
Id String - Endpoint created in your cloud provider account example: "vpce-svc-1148ea04af8675309"
- database
Id string - The ID of the Astra database.
- datacenter
Id string - Astra datacenter in the region where the private link will be created.
- endpoint
Id string - Endpoint created in your cloud provider account example: "vpce-svc-1148ea04af8675309"
- database_
id str - The ID of the Astra database.
- datacenter_
id str - Astra datacenter in the region where the private link will be created.
- endpoint_
id str - Endpoint created in your cloud provider account example: "vpce-svc-1148ea04af8675309"
- database
Id String - The ID of the Astra database.
- datacenter
Id String - Astra datacenter in the region where the private link will be created.
- endpoint
Id String - Endpoint created in your cloud provider account example: "vpce-svc-1148ea04af8675309"
Outputs
All input properties are implicitly available as output properties. Additionally, the PrivateLinkEndpoint resource produces the following output properties:
- Astra
Endpoint stringId - Endpoint ID for referencing within Astra. May be different than the endpoint_id of this resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- Astra
Endpoint stringId - Endpoint ID for referencing within Astra. May be different than the endpoint_id of this resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- astra
Endpoint StringId - Endpoint ID for referencing within Astra. May be different than the endpoint_id of this resource.
- id String
- The provider-assigned unique ID for this managed resource.
- astra
Endpoint stringId - Endpoint ID for referencing within Astra. May be different than the endpoint_id of this resource.
- id string
- The provider-assigned unique ID for this managed resource.
- astra_
endpoint_ strid - Endpoint ID for referencing within Astra. May be different than the endpoint_id of this resource.
- id str
- The provider-assigned unique ID for this managed resource.
- astra
Endpoint StringId - Endpoint ID for referencing within Astra. May be different than the endpoint_id of this resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing PrivateLinkEndpoint Resource
Get an existing PrivateLinkEndpoint 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?: PrivateLinkEndpointState, opts?: CustomResourceOptions): PrivateLinkEndpoint
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
astra_endpoint_id: Optional[str] = None,
database_id: Optional[str] = None,
datacenter_id: Optional[str] = None,
endpoint_id: Optional[str] = None) -> PrivateLinkEndpoint
func GetPrivateLinkEndpoint(ctx *Context, name string, id IDInput, state *PrivateLinkEndpointState, opts ...ResourceOption) (*PrivateLinkEndpoint, error)
public static PrivateLinkEndpoint Get(string name, Input<string> id, PrivateLinkEndpointState? state, CustomResourceOptions? opts = null)
public static PrivateLinkEndpoint get(String name, Output<String> id, PrivateLinkEndpointState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Astra
Endpoint stringId - Endpoint ID for referencing within Astra. May be different than the endpoint_id of this resource.
- Database
Id string - The ID of the Astra database.
- Datacenter
Id string - Astra datacenter in the region where the private link will be created.
- Endpoint
Id string - Endpoint created in your cloud provider account example: "vpce-svc-1148ea04af8675309"
- Astra
Endpoint stringId - Endpoint ID for referencing within Astra. May be different than the endpoint_id of this resource.
- Database
Id string - The ID of the Astra database.
- Datacenter
Id string - Astra datacenter in the region where the private link will be created.
- Endpoint
Id string - Endpoint created in your cloud provider account example: "vpce-svc-1148ea04af8675309"
- astra
Endpoint StringId - Endpoint ID for referencing within Astra. May be different than the endpoint_id of this resource.
- database
Id String - The ID of the Astra database.
- datacenter
Id String - Astra datacenter in the region where the private link will be created.
- endpoint
Id String - Endpoint created in your cloud provider account example: "vpce-svc-1148ea04af8675309"
- astra
Endpoint stringId - Endpoint ID for referencing within Astra. May be different than the endpoint_id of this resource.
- database
Id string - The ID of the Astra database.
- datacenter
Id string - Astra datacenter in the region where the private link will be created.
- endpoint
Id string - Endpoint created in your cloud provider account example: "vpce-svc-1148ea04af8675309"
- astra_
endpoint_ strid - Endpoint ID for referencing within Astra. May be different than the endpoint_id of this resource.
- database_
id str - The ID of the Astra database.
- datacenter_
id str - Astra datacenter in the region where the private link will be created.
- endpoint_
id str - Endpoint created in your cloud provider account example: "vpce-svc-1148ea04af8675309"
- astra
Endpoint StringId - Endpoint ID for referencing within Astra. May be different than the endpoint_id of this resource.
- database
Id String - The ID of the Astra database.
- datacenter
Id String - Astra datacenter in the region where the private link will be created.
- endpoint
Id String - Endpoint created in your cloud provider account example: "vpce-svc-1148ea04af8675309"
Import
Amazon AWS example
$ pulumi import astra:index/privateLinkEndpoint:PrivateLinkEndpoint example a6bc9c26-e7ce-424f-84c7-0a00afb12588/datacenter/a6bc9c26-e7ce-424f-84c7-0a00afb12588-1/endpoint/vpce-0f7aed6e7a18a1791
Google GCP example
$ pulumi import astra:index/privateLinkEndpoint:PrivateLinkEndpoint example a6bc9c26-e7ce-424f-84c7-0a00afb12588/datacenter/a6bc9c26-e7ce-424f-84c7-0a00afb12588-1/endpoint/13585698993864708
Azure EKS example
$ pulumi import astra:index/privateLinkEndpoint:PrivateLinkEndpoint example a6bc9c26-e7ce-424f-84c7-0a00afb12588/datacenter/a6bc9c26-e7ce-424f-84c7-0a00afb12588-1/endpoint/dc5ee5b1-4fc2-463e-a56b-ff54dd38b879/providers/Microsoft.Network/privateEndpoints/private-endpoint-example
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- astra pulumiverse/pulumi-astra
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
astra
Terraform Provider.