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

gcp.compute.SharedVPCServiceProject

Explore with Pulumi AI

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

    Enables the Google Compute Engine Shared VPC feature for a project, assigning it as a Shared VPC service project associated with a given host project.

    For more information, see, the Project API documentation, where the Shared VPC feature is referred to by its former name “XPN”.

    Note: If Shared VPC Admin role is set at the folder level, use the google-beta provider. The google provider only supports this permission at project or organizational level currently. [0]

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const service1 = new gcp.compute.SharedVPCServiceProject("service1", {
        hostProject: "host-project-id",
        serviceProject: "service-project-id-1",
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    service1 = gcp.compute.SharedVPCServiceProject("service1",
        host_project="host-project-id",
        service_project="service-project-id-1")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := compute.NewSharedVPCServiceProject(ctx, "service1", &compute.SharedVPCServiceProjectArgs{
    			HostProject:    pulumi.String("host-project-id"),
    			ServiceProject: pulumi.String("service-project-id-1"),
    		})
    		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 service1 = new Gcp.Compute.SharedVPCServiceProject("service1", new()
        {
            HostProject = "host-project-id",
            ServiceProject = "service-project-id-1",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.compute.SharedVPCServiceProject;
    import com.pulumi.gcp.compute.SharedVPCServiceProjectArgs;
    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 service1 = new SharedVPCServiceProject("service1", SharedVPCServiceProjectArgs.builder()
                .hostProject("host-project-id")
                .serviceProject("service-project-id-1")
                .build());
    
        }
    }
    
    resources:
      service1:
        type: gcp:compute:SharedVPCServiceProject
        properties:
          hostProject: host-project-id
          serviceProject: service-project-id-1
    

    For a complete Shared VPC example with both host and service projects, see gcp.compute.SharedVPCHostProject.

    Create SharedVPCServiceProject Resource

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

    Constructor syntax

    new SharedVPCServiceProject(name: string, args: SharedVPCServiceProjectArgs, opts?: CustomResourceOptions);
    @overload
    def SharedVPCServiceProject(resource_name: str,
                                args: SharedVPCServiceProjectArgs,
                                opts: Optional[ResourceOptions] = None)
    
    @overload
    def SharedVPCServiceProject(resource_name: str,
                                opts: Optional[ResourceOptions] = None,
                                host_project: Optional[str] = None,
                                service_project: Optional[str] = None,
                                deletion_policy: Optional[str] = None)
    func NewSharedVPCServiceProject(ctx *Context, name string, args SharedVPCServiceProjectArgs, opts ...ResourceOption) (*SharedVPCServiceProject, error)
    public SharedVPCServiceProject(string name, SharedVPCServiceProjectArgs args, CustomResourceOptions? opts = null)
    public SharedVPCServiceProject(String name, SharedVPCServiceProjectArgs args)
    public SharedVPCServiceProject(String name, SharedVPCServiceProjectArgs args, CustomResourceOptions options)
    
    type: gcp:compute:SharedVPCServiceProject
    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 SharedVPCServiceProjectArgs
    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 SharedVPCServiceProjectArgs
    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 SharedVPCServiceProjectArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args SharedVPCServiceProjectArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args SharedVPCServiceProjectArgs
    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 sharedVPCServiceProjectResource = new Gcp.Compute.SharedVPCServiceProject("sharedVPCServiceProjectResource", new()
    {
        HostProject = "string",
        ServiceProject = "string",
        DeletionPolicy = "string",
    });
    
    example, err := compute.NewSharedVPCServiceProject(ctx, "sharedVPCServiceProjectResource", &compute.SharedVPCServiceProjectArgs{
    	HostProject:    pulumi.String("string"),
    	ServiceProject: pulumi.String("string"),
    	DeletionPolicy: pulumi.String("string"),
    })
    
    var sharedVPCServiceProjectResource = new SharedVPCServiceProject("sharedVPCServiceProjectResource", SharedVPCServiceProjectArgs.builder()
        .hostProject("string")
        .serviceProject("string")
        .deletionPolicy("string")
        .build());
    
    shared_vpc_service_project_resource = gcp.compute.SharedVPCServiceProject("sharedVPCServiceProjectResource",
        host_project="string",
        service_project="string",
        deletion_policy="string")
    
    const sharedVPCServiceProjectResource = new gcp.compute.SharedVPCServiceProject("sharedVPCServiceProjectResource", {
        hostProject: "string",
        serviceProject: "string",
        deletionPolicy: "string",
    });
    
    type: gcp:compute:SharedVPCServiceProject
    properties:
        deletionPolicy: string
        hostProject: string
        serviceProject: string
    

    SharedVPCServiceProject Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The SharedVPCServiceProject resource accepts the following input properties:

    HostProject string
    The ID of a host project to associate.
    ServiceProject string
    The ID of the project that will serve as a Shared VPC service project.
    DeletionPolicy string
    The deletion policy for the shared VPC service. Setting ABANDON allows the resource to be abandoned rather than deleted. Possible values are: "ABANDON".
    HostProject string
    The ID of a host project to associate.
    ServiceProject string
    The ID of the project that will serve as a Shared VPC service project.
    DeletionPolicy string
    The deletion policy for the shared VPC service. Setting ABANDON allows the resource to be abandoned rather than deleted. Possible values are: "ABANDON".
    hostProject String
    The ID of a host project to associate.
    serviceProject String
    The ID of the project that will serve as a Shared VPC service project.
    deletionPolicy String
    The deletion policy for the shared VPC service. Setting ABANDON allows the resource to be abandoned rather than deleted. Possible values are: "ABANDON".
    hostProject string
    The ID of a host project to associate.
    serviceProject string
    The ID of the project that will serve as a Shared VPC service project.
    deletionPolicy string
    The deletion policy for the shared VPC service. Setting ABANDON allows the resource to be abandoned rather than deleted. Possible values are: "ABANDON".
    host_project str
    The ID of a host project to associate.
    service_project str
    The ID of the project that will serve as a Shared VPC service project.
    deletion_policy str
    The deletion policy for the shared VPC service. Setting ABANDON allows the resource to be abandoned rather than deleted. Possible values are: "ABANDON".
    hostProject String
    The ID of a host project to associate.
    serviceProject String
    The ID of the project that will serve as a Shared VPC service project.
    deletionPolicy String
    The deletion policy for the shared VPC service. Setting ABANDON allows the resource to be abandoned rather than deleted. Possible values are: "ABANDON".

    Outputs

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

    Get an existing SharedVPCServiceProject 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?: SharedVPCServiceProjectState, opts?: CustomResourceOptions): SharedVPCServiceProject
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            deletion_policy: Optional[str] = None,
            host_project: Optional[str] = None,
            service_project: Optional[str] = None) -> SharedVPCServiceProject
    func GetSharedVPCServiceProject(ctx *Context, name string, id IDInput, state *SharedVPCServiceProjectState, opts ...ResourceOption) (*SharedVPCServiceProject, error)
    public static SharedVPCServiceProject Get(string name, Input<string> id, SharedVPCServiceProjectState? state, CustomResourceOptions? opts = null)
    public static SharedVPCServiceProject get(String name, Output<String> id, SharedVPCServiceProjectState 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:
    DeletionPolicy string
    The deletion policy for the shared VPC service. Setting ABANDON allows the resource to be abandoned rather than deleted. Possible values are: "ABANDON".
    HostProject string
    The ID of a host project to associate.
    ServiceProject string
    The ID of the project that will serve as a Shared VPC service project.
    DeletionPolicy string
    The deletion policy for the shared VPC service. Setting ABANDON allows the resource to be abandoned rather than deleted. Possible values are: "ABANDON".
    HostProject string
    The ID of a host project to associate.
    ServiceProject string
    The ID of the project that will serve as a Shared VPC service project.
    deletionPolicy String
    The deletion policy for the shared VPC service. Setting ABANDON allows the resource to be abandoned rather than deleted. Possible values are: "ABANDON".
    hostProject String
    The ID of a host project to associate.
    serviceProject String
    The ID of the project that will serve as a Shared VPC service project.
    deletionPolicy string
    The deletion policy for the shared VPC service. Setting ABANDON allows the resource to be abandoned rather than deleted. Possible values are: "ABANDON".
    hostProject string
    The ID of a host project to associate.
    serviceProject string
    The ID of the project that will serve as a Shared VPC service project.
    deletion_policy str
    The deletion policy for the shared VPC service. Setting ABANDON allows the resource to be abandoned rather than deleted. Possible values are: "ABANDON".
    host_project str
    The ID of a host project to associate.
    service_project str
    The ID of the project that will serve as a Shared VPC service project.
    deletionPolicy String
    The deletion policy for the shared VPC service. Setting ABANDON allows the resource to be abandoned rather than deleted. Possible values are: "ABANDON".
    hostProject String
    The ID of a host project to associate.
    serviceProject String
    The ID of the project that will serve as a Shared VPC service project.

    Import

    Google Compute Engine Shared VPC service project feature can be imported using the host_project and service_project, e.g.

    • {{host_project}/{{service_project}}

    When using the pulumi import command, Google Compute Engine Shared VPC service project can be imported using one of the formats above. For example:

    $ pulumi import gcp:compute/sharedVPCServiceProject:SharedVPCServiceProject default {{host_project}/{{service_project}}
    

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

    Package Details

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