1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. networkservices
  5. ServiceBinding
Google Cloud Classic v8.9.3 published on Monday, Nov 18, 2024 by Pulumi

gcp.networkservices.ServiceBinding

Explore with Pulumi AI

gcp logo
Google Cloud Classic v8.9.3 published on Monday, Nov 18, 2024 by Pulumi

    Example Usage

    Network Services Service Binding Basic

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const _default = new gcp.servicedirectory.Namespace("default", {
        namespaceId: "my-namespace",
        location: "us-central1",
    });
    const defaultService = new gcp.servicedirectory.Service("default", {
        serviceId: "my-service",
        namespace: _default.id,
        metadata: {
            stage: "prod",
            region: "us-central1",
        },
    });
    const defaultServiceBinding = new gcp.networkservices.ServiceBinding("default", {
        name: "my-service-binding",
        labels: {
            foo: "bar",
        },
        description: "my description",
        service: defaultService.id,
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    default = gcp.servicedirectory.Namespace("default",
        namespace_id="my-namespace",
        location="us-central1")
    default_service = gcp.servicedirectory.Service("default",
        service_id="my-service",
        namespace=default.id,
        metadata={
            "stage": "prod",
            "region": "us-central1",
        })
    default_service_binding = gcp.networkservices.ServiceBinding("default",
        name="my-service-binding",
        labels={
            "foo": "bar",
        },
        description="my description",
        service=default_service.id)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/networkservices"
    	"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/servicedirectory"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := servicedirectory.NewNamespace(ctx, "default", &servicedirectory.NamespaceArgs{
    			NamespaceId: pulumi.String("my-namespace"),
    			Location:    pulumi.String("us-central1"),
    		})
    		if err != nil {
    			return err
    		}
    		defaultService, err := servicedirectory.NewService(ctx, "default", &servicedirectory.ServiceArgs{
    			ServiceId: pulumi.String("my-service"),
    			Namespace: _default.ID(),
    			Metadata: pulumi.StringMap{
    				"stage":  pulumi.String("prod"),
    				"region": pulumi.String("us-central1"),
    			},
    		})
    		if err != nil {
    			return err
    		}
    		_, err = networkservices.NewServiceBinding(ctx, "default", &networkservices.ServiceBindingArgs{
    			Name: pulumi.String("my-service-binding"),
    			Labels: pulumi.StringMap{
    				"foo": pulumi.String("bar"),
    			},
    			Description: pulumi.String("my description"),
    			Service:     defaultService.ID(),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var @default = new Gcp.ServiceDirectory.Namespace("default", new()
        {
            NamespaceId = "my-namespace",
            Location = "us-central1",
        });
    
        var defaultService = new Gcp.ServiceDirectory.Service("default", new()
        {
            ServiceId = "my-service",
            Namespace = @default.Id,
            Metadata = 
            {
                { "stage", "prod" },
                { "region", "us-central1" },
            },
        });
    
        var defaultServiceBinding = new Gcp.NetworkServices.ServiceBinding("default", new()
        {
            Name = "my-service-binding",
            Labels = 
            {
                { "foo", "bar" },
            },
            Description = "my description",
            Service = defaultService.Id,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.servicedirectory.Namespace;
    import com.pulumi.gcp.servicedirectory.NamespaceArgs;
    import com.pulumi.gcp.servicedirectory.Service;
    import com.pulumi.gcp.servicedirectory.ServiceArgs;
    import com.pulumi.gcp.networkservices.ServiceBinding;
    import com.pulumi.gcp.networkservices.ServiceBindingArgs;
    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 default_ = new Namespace("default", NamespaceArgs.builder()
                .namespaceId("my-namespace")
                .location("us-central1")
                .build());
    
            var defaultService = new Service("defaultService", ServiceArgs.builder()
                .serviceId("my-service")
                .namespace(default_.id())
                .metadata(Map.ofEntries(
                    Map.entry("stage", "prod"),
                    Map.entry("region", "us-central1")
                ))
                .build());
    
            var defaultServiceBinding = new ServiceBinding("defaultServiceBinding", ServiceBindingArgs.builder()
                .name("my-service-binding")
                .labels(Map.of("foo", "bar"))
                .description("my description")
                .service(defaultService.id())
                .build());
    
        }
    }
    
    resources:
      default:
        type: gcp:servicedirectory:Namespace
        properties:
          namespaceId: my-namespace
          location: us-central1
      defaultService:
        type: gcp:servicedirectory:Service
        name: default
        properties:
          serviceId: my-service
          namespace: ${default.id}
          metadata:
            stage: prod
            region: us-central1
      defaultServiceBinding:
        type: gcp:networkservices:ServiceBinding
        name: default
        properties:
          name: my-service-binding
          labels:
            foo: bar
          description: my description
          service: ${defaultService.id}
    

    Create ServiceBinding Resource

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

    Constructor syntax

    new ServiceBinding(name: string, args: ServiceBindingArgs, opts?: CustomResourceOptions);
    @overload
    def ServiceBinding(resource_name: str,
                       args: ServiceBindingArgs,
                       opts: Optional[ResourceOptions] = None)
    
    @overload
    def ServiceBinding(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       service: Optional[str] = None,
                       description: Optional[str] = None,
                       labels: Optional[Mapping[str, str]] = None,
                       name: Optional[str] = None,
                       project: Optional[str] = None)
    func NewServiceBinding(ctx *Context, name string, args ServiceBindingArgs, opts ...ResourceOption) (*ServiceBinding, error)
    public ServiceBinding(string name, ServiceBindingArgs args, CustomResourceOptions? opts = null)
    public ServiceBinding(String name, ServiceBindingArgs args)
    public ServiceBinding(String name, ServiceBindingArgs args, CustomResourceOptions options)
    
    type: gcp:networkservices:ServiceBinding
    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 ServiceBindingArgs
    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 ServiceBindingArgs
    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 ServiceBindingArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ServiceBindingArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ServiceBindingArgs
    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 serviceBindingResource = new Gcp.NetworkServices.ServiceBinding("serviceBindingResource", new()
    {
        Service = "string",
        Description = "string",
        Labels = 
        {
            { "string", "string" },
        },
        Name = "string",
        Project = "string",
    });
    
    example, err := networkservices.NewServiceBinding(ctx, "serviceBindingResource", &networkservices.ServiceBindingArgs{
    	Service:     pulumi.String("string"),
    	Description: pulumi.String("string"),
    	Labels: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    	Name:    pulumi.String("string"),
    	Project: pulumi.String("string"),
    })
    
    var serviceBindingResource = new ServiceBinding("serviceBindingResource", ServiceBindingArgs.builder()
        .service("string")
        .description("string")
        .labels(Map.of("string", "string"))
        .name("string")
        .project("string")
        .build());
    
    service_binding_resource = gcp.networkservices.ServiceBinding("serviceBindingResource",
        service="string",
        description="string",
        labels={
            "string": "string",
        },
        name="string",
        project="string")
    
    const serviceBindingResource = new gcp.networkservices.ServiceBinding("serviceBindingResource", {
        service: "string",
        description: "string",
        labels: {
            string: "string",
        },
        name: "string",
        project: "string",
    });
    
    type: gcp:networkservices:ServiceBinding
    properties:
        description: string
        labels:
            string: string
        name: string
        project: string
        service: string
    

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

    Service string
    The full Service Directory Service name of the format projects//locations//namespaces//services/
    Description string
    A free-text description of the resource. Max length 1024 characters.
    Labels Dictionary<string, string>
    Set of label tags associated with the ServiceBinding resource. Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field effective_labels for all of the labels present on the resource.
    Name string
    Name of the ServiceBinding resource.


    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    Service string
    The full Service Directory Service name of the format projects//locations//namespaces//services/
    Description string
    A free-text description of the resource. Max length 1024 characters.
    Labels map[string]string
    Set of label tags associated with the ServiceBinding resource. Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field effective_labels for all of the labels present on the resource.
    Name string
    Name of the ServiceBinding resource.


    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    service String
    The full Service Directory Service name of the format projects//locations//namespaces//services/
    description String
    A free-text description of the resource. Max length 1024 characters.
    labels Map<String,String>
    Set of label tags associated with the ServiceBinding resource. Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field effective_labels for all of the labels present on the resource.
    name String
    Name of the ServiceBinding resource.


    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    service string
    The full Service Directory Service name of the format projects//locations//namespaces//services/
    description string
    A free-text description of the resource. Max length 1024 characters.
    labels {[key: string]: string}
    Set of label tags associated with the ServiceBinding resource. Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field effective_labels for all of the labels present on the resource.
    name string
    Name of the ServiceBinding resource.


    project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    service str
    The full Service Directory Service name of the format projects//locations//namespaces//services/
    description str
    A free-text description of the resource. Max length 1024 characters.
    labels Mapping[str, str]
    Set of label tags associated with the ServiceBinding resource. Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field effective_labels for all of the labels present on the resource.
    name str
    Name of the ServiceBinding resource.


    project str
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    service String
    The full Service Directory Service name of the format projects//locations//namespaces//services/
    description String
    A free-text description of the resource. Max length 1024 characters.
    labels Map<String>
    Set of label tags associated with the ServiceBinding resource. Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field effective_labels for all of the labels present on the resource.
    name String
    Name of the ServiceBinding resource.


    project 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 ServiceBinding resource produces the following output properties:

    CreateTime string
    Time the ServiceBinding was created in UTC.
    EffectiveLabels Dictionary<string, string>
    All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
    Id string
    The provider-assigned unique ID for this managed resource.
    PulumiLabels Dictionary<string, string>
    The combination of labels configured directly on the resource and default labels configured on the provider.
    UpdateTime string
    Time the ServiceBinding was updated in UTC.
    CreateTime string
    Time the ServiceBinding was created in UTC.
    EffectiveLabels 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.
    Id string
    The provider-assigned unique ID for this managed resource.
    PulumiLabels map[string]string
    The combination of labels configured directly on the resource and default labels configured on the provider.
    UpdateTime string
    Time the ServiceBinding was updated in UTC.
    createTime String
    Time the ServiceBinding was created in UTC.
    effectiveLabels 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.
    id String
    The provider-assigned unique ID for this managed resource.
    pulumiLabels Map<String,String>
    The combination of labels configured directly on the resource and default labels configured on the provider.
    updateTime String
    Time the ServiceBinding was updated in UTC.
    createTime string
    Time the ServiceBinding was created in UTC.
    effectiveLabels {[key: string]: string}
    All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
    id string
    The provider-assigned unique ID for this managed resource.
    pulumiLabels {[key: string]: string}
    The combination of labels configured directly on the resource and default labels configured on the provider.
    updateTime string
    Time the ServiceBinding was updated in UTC.
    create_time str
    Time the ServiceBinding was created in UTC.
    effective_labels Mapping[str, str]
    All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
    id str
    The provider-assigned unique ID for this managed resource.
    pulumi_labels Mapping[str, str]
    The combination of labels configured directly on the resource and default labels configured on the provider.
    update_time str
    Time the ServiceBinding was updated in UTC.
    createTime String
    Time the ServiceBinding was created in UTC.
    effectiveLabels Map<String>
    All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
    id String
    The provider-assigned unique ID for this managed resource.
    pulumiLabels Map<String>
    The combination of labels configured directly on the resource and default labels configured on the provider.
    updateTime String
    Time the ServiceBinding was updated in UTC.

    Look up Existing ServiceBinding Resource

    Get an existing ServiceBinding 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?: ServiceBindingState, opts?: CustomResourceOptions): ServiceBinding
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            create_time: Optional[str] = None,
            description: Optional[str] = None,
            effective_labels: Optional[Mapping[str, str]] = None,
            labels: Optional[Mapping[str, str]] = None,
            name: Optional[str] = None,
            project: Optional[str] = None,
            pulumi_labels: Optional[Mapping[str, str]] = None,
            service: Optional[str] = None,
            update_time: Optional[str] = None) -> ServiceBinding
    func GetServiceBinding(ctx *Context, name string, id IDInput, state *ServiceBindingState, opts ...ResourceOption) (*ServiceBinding, error)
    public static ServiceBinding Get(string name, Input<string> id, ServiceBindingState? state, CustomResourceOptions? opts = null)
    public static ServiceBinding get(String name, Output<String> id, ServiceBindingState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    CreateTime string
    Time the ServiceBinding was created in UTC.
    Description string
    A free-text description of the resource. Max length 1024 characters.
    EffectiveLabels Dictionary<string, string>
    All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
    Labels Dictionary<string, string>
    Set of label tags associated with the ServiceBinding resource. Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field effective_labels for all of the labels present on the resource.
    Name string
    Name of the ServiceBinding resource.


    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    PulumiLabels Dictionary<string, string>
    The combination of labels configured directly on the resource and default labels configured on the provider.
    Service string
    The full Service Directory Service name of the format projects//locations//namespaces//services/
    UpdateTime string
    Time the ServiceBinding was updated in UTC.
    CreateTime string
    Time the ServiceBinding was created in UTC.
    Description string
    A free-text description of the resource. Max length 1024 characters.
    EffectiveLabels 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.
    Labels map[string]string
    Set of label tags associated with the ServiceBinding resource. Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field effective_labels for all of the labels present on the resource.
    Name string
    Name of the ServiceBinding resource.


    Project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    PulumiLabels map[string]string
    The combination of labels configured directly on the resource and default labels configured on the provider.
    Service string
    The full Service Directory Service name of the format projects//locations//namespaces//services/
    UpdateTime string
    Time the ServiceBinding was updated in UTC.
    createTime String
    Time the ServiceBinding was created in UTC.
    description String
    A free-text description of the resource. Max length 1024 characters.
    effectiveLabels 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.
    labels Map<String,String>
    Set of label tags associated with the ServiceBinding resource. Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field effective_labels for all of the labels present on the resource.
    name String
    Name of the ServiceBinding resource.


    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    pulumiLabels Map<String,String>
    The combination of labels configured directly on the resource and default labels configured on the provider.
    service String
    The full Service Directory Service name of the format projects//locations//namespaces//services/
    updateTime String
    Time the ServiceBinding was updated in UTC.
    createTime string
    Time the ServiceBinding was created in UTC.
    description string
    A free-text description of the resource. Max length 1024 characters.
    effectiveLabels {[key: string]: string}
    All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
    labels {[key: string]: string}
    Set of label tags associated with the ServiceBinding resource. Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field effective_labels for all of the labels present on the resource.
    name string
    Name of the ServiceBinding resource.


    project string
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    pulumiLabels {[key: string]: string}
    The combination of labels configured directly on the resource and default labels configured on the provider.
    service string
    The full Service Directory Service name of the format projects//locations//namespaces//services/
    updateTime string
    Time the ServiceBinding was updated in UTC.
    create_time str
    Time the ServiceBinding was created in UTC.
    description str
    A free-text description of the resource. Max length 1024 characters.
    effective_labels Mapping[str, str]
    All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
    labels Mapping[str, str]
    Set of label tags associated with the ServiceBinding resource. Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field effective_labels for all of the labels present on the resource.
    name str
    Name of the ServiceBinding resource.


    project str
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    pulumi_labels Mapping[str, str]
    The combination of labels configured directly on the resource and default labels configured on the provider.
    service str
    The full Service Directory Service name of the format projects//locations//namespaces//services/
    update_time str
    Time the ServiceBinding was updated in UTC.
    createTime String
    Time the ServiceBinding was created in UTC.
    description String
    A free-text description of the resource. Max length 1024 characters.
    effectiveLabels Map<String>
    All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
    labels Map<String>
    Set of label tags associated with the ServiceBinding resource. Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field effective_labels for all of the labels present on the resource.
    name String
    Name of the ServiceBinding resource.


    project String
    The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
    pulumiLabels Map<String>
    The combination of labels configured directly on the resource and default labels configured on the provider.
    service String
    The full Service Directory Service name of the format projects//locations//namespaces//services/
    updateTime String
    Time the ServiceBinding was updated in UTC.

    Import

    ServiceBinding can be imported using any of these accepted formats:

    • projects/{{project}}/locations/global/serviceBindings/{{name}}

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

    • {{name}}

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

    $ pulumi import gcp:networkservices/serviceBinding:ServiceBinding default projects/{{project}}/locations/global/serviceBindings/{{name}}
    
    $ pulumi import gcp:networkservices/serviceBinding:ServiceBinding default {{project}}/{{name}}
    
    $ pulumi import gcp:networkservices/serviceBinding:ServiceBinding default {{name}}
    

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

    Package Details

    Repository
    Google Cloud (GCP) Classic pulumi/pulumi-gcp
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the google-beta Terraform Provider.
    gcp logo
    Google Cloud Classic v8.9.3 published on Monday, Nov 18, 2024 by Pulumi