ServiceConnectionPolicy class
Manage Service Connection Policies.
To get more information about ServiceConnectionPolicy, see:
- API documentation
- How-to Guides
- About Service Connection Policies
- About Service Connectivity Automation
Example Usage
Network Connectivity Policy Basic
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const producerNet = new gcp.compute.Network("producer_net", {
name: "producer-net",
autoCreateSubnetworks: false,
});
const producerSubnet = new gcp.compute.Subnetwork("producer_subnet", {
name: "producer-subnet",
ipCidrRange: "10.0.0.0/16",
region: "us-central1",
network: producerNet.id,
});
const _default = new gcp.networkconnectivity.ServiceConnectionPolicy("default", {
name: "my-network-connectivity-policy",
location: "us-central1",
serviceClass: "my-basic-service-class",
description: "my basic service connection policy",
network: producerNet.id,
pscConfig: {
subnetworks: [producerSubnet.id],
limit: "2",
},
});
import pulumi
import pulumi_gcp as gcp
producer_net = gcp.compute.Network("producer_net",
name="producer-net",
auto_create_subnetworks=False)
producer_subnet = gcp.compute.Subnetwork("producer_subnet",
name="producer-subnet",
ip_cidr_range="10.0.0.0/16",
region="us-central1",
network=producer_net.id)
default = gcp.networkconnectivity.ServiceConnectionPolicy("default",
name="my-network-connectivity-policy",
location="us-central1",
service_class="my-basic-service-class",
description="my basic service connection policy",
network=producer_net.id,
psc_config={
"subnetworks": [producer_subnet.id],
"limit": "2",
})
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var producerNet = new Gcp.Compute.Network("producer_net", new()
{
Name = "producer-net",
AutoCreateSubnetworks = false,
});
var producerSubnet = new Gcp.Compute.Subnetwork("producer_subnet", new()
{
Name = "producer-subnet",
IpCidrRange = "10.0.0.0/16",
Region = "us-central1",
Network = producerNet.Id,
});
var @default = new Gcp.NetworkConnectivity.ServiceConnectionPolicy("default", new()
{
Name = "my-network-connectivity-policy",
Location = "us-central1",
ServiceClass = "my-basic-service-class",
Description = "my basic service connection policy",
Network = producerNet.Id,
PscConfig = new Gcp.NetworkConnectivity.Inputs.ServiceConnectionPolicyPscConfigArgs
{
Subnetworks = new[]
{
producerSubnet.Id,
},
Limit = "2",
},
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/compute"
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/networkconnectivity"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
producerNet, err := compute.NewNetwork(ctx, "producer_net", &compute.NetworkArgs{
Name: pulumi.String("producer-net"),
AutoCreateSubnetworks: pulumi.Bool(false),
})
if err != nil {
return err
}
producerSubnet, err := compute.NewSubnetwork(ctx, "producer_subnet", &compute.SubnetworkArgs{
Name: pulumi.String("producer-subnet"),
IpCidrRange: pulumi.String("10.0.0.0/16"),
Region: pulumi.String("us-central1"),
Network: producerNet.ID().ToIDOutput().ToStringOutput(),
})
if err != nil {
return err
}
_, err = networkconnectivity.NewServiceConnectionPolicy(ctx, "default", &networkconnectivity.ServiceConnectionPolicyArgs{
Name: pulumi.String("my-network-connectivity-policy"),
Location: pulumi.String("us-central1"),
ServiceClass: pulumi.String("my-basic-service-class"),
Description: pulumi.String("my basic service connection policy"),
Network: producerNet.ID().ToIDOutput().ToStringOutput(),
PscConfig: &networkconnectivity.ServiceConnectionPolicyPscConfigArgs{
Subnetworks: pulumi.StringArray{
producerSubnet.ID().ToIDOutput().ToStringOutput(),
},
Limit: pulumi.String("2"),
},
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
gcp = {
source = "pulumi/gcp"
}
}
}
resource "gcp_compute_network" "producer_net" {
name = "producer-net"
auto_create_subnetworks = false
}
resource "gcp_compute_subnetwork" "producer_subnet" {
name = "producer-subnet"
ip_cidr_range = "10.0.0.0/16"
region = "us-central1"
network = gcp_compute_network.producer_net.id
}
resource "gcp_networkconnectivity_serviceconnectionpolicy" "default" {
name = "my-network-connectivity-policy"
location = "us-central1"
service_class = "my-basic-service-class"
description = "my basic service connection policy"
network = gcp_compute_network.producer_net.id
psc_config = {
subnetworks = [gcp_compute_subnetwork.producer_subnet.id]
limit = 2
}
}
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.networkconnectivity.ServiceConnectionPolicy;
import com.pulumi.gcp.networkconnectivity.ServiceConnectionPolicyArgs;
import com.pulumi.gcp.networkconnectivity.inputs.ServiceConnectionPolicyPscConfigArgs;
import java.util.ArrayList;
import java.util.Arrays;
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 producerNet = new Network("producerNet", NetworkArgs.builder()
.name("producer-net")
.autoCreateSubnetworks(false)
.build());
var producerSubnet = new Subnetwork("producerSubnet", SubnetworkArgs.builder()
.name("producer-subnet")
.ipCidrRange("10.0.0.0/16")
.region("us-central1")
.network(producerNet.id())
.build());
var default_ = new ServiceConnectionPolicy("default", ServiceConnectionPolicyArgs.builder()
.name("my-network-connectivity-policy")
.location("us-central1")
.serviceClass("my-basic-service-class")
.description("my basic service connection policy")
.network(producerNet.id())
.pscConfig(ServiceConnectionPolicyPscConfigArgs.builder()
.subnetworks(producerSubnet.id())
.limit("2")
.build())
.build());
}
}
resources:
producerNet:
type: gcp:compute:Network
name: producer_net
properties:
name: producer-net
autoCreateSubnetworks: false
producerSubnet:
type: gcp:compute:Subnetwork
name: producer_subnet
properties:
name: producer-subnet
ipCidrRange: 10.0.0.0/16
region: us-central1
network: ${producerNet.id}
default:
type: gcp:networkconnectivity:ServiceConnectionPolicy
properties:
name: my-network-connectivity-policy
location: us-central1
serviceClass: my-basic-service-class
description: my basic service connection policy
network: ${producerNet.id}
pscConfig:
subnetworks:
- ${producerSubnet.id}
limit: 2
Import
ServiceConnectionPolicy can be imported using any of these accepted formats:
projects/{{project}}/locations/{{location}}/serviceConnectionPolicies/{{name}}{{project}}/{{location}}/{{name}}{{location}}/{{name}}
When using the pulumi import command, ServiceConnectionPolicy can be imported using one of the formats above. For example:
$ pulumi import gcp:networkconnectivity/serviceConnectionPolicy:ServiceConnectionPolicy default projects/{{project}}/locations/{{location}}/serviceConnectionPolicies/{{name}}
$ pulumi import gcp:networkconnectivity/serviceConnectionPolicy:ServiceConnectionPolicy default {{project}}/{{location}}/{{name}}
$ pulumi import gcp:networkconnectivity/serviceConnectionPolicy:ServiceConnectionPolicy default {{location}}/{{name}}
Constructors
- ServiceConnectionPolicy(String name, {ServiceConnectionPolicyArgs? args, CustomResourceOptions? options})
-
Creates a new ServiceConnectionPolicy.
nameThe Pulumi resource name.argsArguments used to configure this ServiceConnectionPolicy. The set of arguments for ServiceConnectionPolicy.optionsResource options controlling this resource's behavior. - ServiceConnectionPolicy.reference(String urn)
- Creates a typed reference to an existing ServiceConnectionPolicy resource.
Properties
-
childResources
→ Set<
Resource> -
finalinherited
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
-
createTime
↔ Output<
String> -
The timestamp when the resource was created.
latefinal
-
deletionPolicy
↔ Output<
String> -
Whether Terraform will be prevented from destroying the resource. Defaults to DELETE.
When a 'terraform destroy' or 'pulumi up' would delete the resource,
the command will fail if this field is set to "PREVENT" in Terraform state.
When set to "ABANDON", the command will remove the resource from Terraform
management without updating or deleting the resource in the API.
When set to "DELETE", deleting the resource is allowed.
latefinal
-
description
↔ Output<
String?> -
Free-text description of the resource.
latefinal
-
effectiveLabels
↔ Output<
Map< String, String> > -
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
latefinal
-
etag
↔ Output<
String> -
The etag is computed by the server, and may be sent on update and delete requests to ensure the client has an up-to-date value before proceeding.
latefinal
- hashCode → int
-
The hash code for this object.
no setterinherited
-
id
↔ Output<
String> -
getter/setter pairinherited
-
infrastructure
↔ Output<
String> -
The type of underlying resources used to create the connection.
latefinal
- isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
labels
↔ Output<
Map< String, String> ?> -
User-defined labels.
latefinal
-
location
↔ Output<
String> -
The location of the ServiceConnectionPolicy.
latefinal
-
name
↔ Output<
String> -
The name of a ServiceConnectionPolicy. Format: projects/{project}/locations/{location}/serviceConnectionPolicies/{service_connection_policy} See: https://google.aip.dev/122#fields-representing-resource-names
latefinal
-
network
↔ Output<
String> -
The resource path of the consumer network. Example: - projects/{projectNumOrId}/global/networks/{resourceId}.
latefinal
-
project
↔ Output<
String> -
The ID of the project in which the resource belongs.
If it is not provided, the provider project is used.
latefinal
-
pscConfig
↔ Output<
ServiceConnectionPolicyPscConfig?> -
Configuration used for Private Service Connect connections. Used when Infrastructure is PSC.
Structure is documented below.
latefinal
-
pscConnections
↔ Output<
List< ServiceConnectionPolicyPscConnection> > -
Information about each Private Service Connect connection.
Structure is documented below.
latefinal
-
pulumiLabels
↔ Output<
Map< String, String> > -
The combination of labels configured directly on the resource
and default labels configured on the provider.
latefinal
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
serviceClass
↔ Output<
String> -
The service class identifier for which this ServiceConnectionPolicy is for. The service class identifier is a unique, symbolic representation of a ServiceClass.
It is provided by the Service Producer. Google services have a prefix of gcp. For example, google-cloud-sql. 3rd party services do not. For example, test-service-a3dfcx.
For a list of supported services, see Supported Services.
latefinal
-
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
updateTime
↔ Output<
String> -
The timestamp when the resource was updated.
latefinal
-
urn
↔ Output<
String> -
latefinalinherited
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
get(
String name, Input< String> id, {ServiceConnectionPolicyState? state, CustomResourceOptions? options}) → ServiceConnectionPolicy -
Gets an existing ServiceConnectionPolicy resource's state with the given
nameandid.