gcp.compute.SharedVPCHostProject
Explore with Pulumi AI
Enables the Google Compute Engine Shared VPC feature for a project, assigning it as a Shared VPC host project.
For more information, see, the Project API documentation, where the Shared VPC feature is referred to by its former name “XPN”.
Example Usage
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
// A host project provides network resources to associated service projects.
var host = new Gcp.Compute.SharedVPCHostProject("host", new()
{
Project = "host-project-id",
});
// A service project gains access to network resources provided by its
// associated host project.
var service1 = new Gcp.Compute.SharedVPCServiceProject("service1", new()
{
HostProject = host.Project,
ServiceProject = "service-project-id-1",
});
var service2 = new Gcp.Compute.SharedVPCServiceProject("service2", new()
{
HostProject = host.Project,
ServiceProject = "service-project-id-2",
});
});
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 {
host, err := compute.NewSharedVPCHostProject(ctx, "host", &compute.SharedVPCHostProjectArgs{
Project: pulumi.String("host-project-id"),
})
if err != nil {
return err
}
_, err = compute.NewSharedVPCServiceProject(ctx, "service1", &compute.SharedVPCServiceProjectArgs{
HostProject: host.Project,
ServiceProject: pulumi.String("service-project-id-1"),
})
if err != nil {
return err
}
_, err = compute.NewSharedVPCServiceProject(ctx, "service2", &compute.SharedVPCServiceProjectArgs{
HostProject: host.Project,
ServiceProject: pulumi.String("service-project-id-2"),
})
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.gcp.compute.SharedVPCHostProject;
import com.pulumi.gcp.compute.SharedVPCHostProjectArgs;
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 host = new SharedVPCHostProject("host", SharedVPCHostProjectArgs.builder()
.project("host-project-id")
.build());
var service1 = new SharedVPCServiceProject("service1", SharedVPCServiceProjectArgs.builder()
.hostProject(host.project())
.serviceProject("service-project-id-1")
.build());
var service2 = new SharedVPCServiceProject("service2", SharedVPCServiceProjectArgs.builder()
.hostProject(host.project())
.serviceProject("service-project-id-2")
.build());
}
}
import pulumi
import pulumi_gcp as gcp
# A host project provides network resources to associated service projects.
host = gcp.compute.SharedVPCHostProject("host", project="host-project-id")
# A service project gains access to network resources provided by its
# associated host project.
service1 = gcp.compute.SharedVPCServiceProject("service1",
host_project=host.project,
service_project="service-project-id-1")
service2 = gcp.compute.SharedVPCServiceProject("service2",
host_project=host.project,
service_project="service-project-id-2")
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
// A host project provides network resources to associated service projects.
const host = new gcp.compute.SharedVPCHostProject("host", {project: "host-project-id"});
// A service project gains access to network resources provided by its
// associated host project.
const service1 = new gcp.compute.SharedVPCServiceProject("service1", {
hostProject: host.project,
serviceProject: "service-project-id-1",
});
const service2 = new gcp.compute.SharedVPCServiceProject("service2", {
hostProject: host.project,
serviceProject: "service-project-id-2",
});
resources:
# A host project provides network resources to associated service projects.
host:
type: gcp:compute:SharedVPCHostProject
properties:
project: host-project-id
# A service project gains access to network resources provided by its
# associated host project.
service1:
type: gcp:compute:SharedVPCServiceProject
properties:
hostProject: ${host.project}
serviceProject: service-project-id-1
service2:
type: gcp:compute:SharedVPCServiceProject
properties:
hostProject: ${host.project}
serviceProject: service-project-id-2
Create SharedVPCHostProject Resource
new SharedVPCHostProject(name: string, args: SharedVPCHostProjectArgs, opts?: CustomResourceOptions);
@overload
def SharedVPCHostProject(resource_name: str,
opts: Optional[ResourceOptions] = None,
project: Optional[str] = None)
@overload
def SharedVPCHostProject(resource_name: str,
args: SharedVPCHostProjectArgs,
opts: Optional[ResourceOptions] = None)
func NewSharedVPCHostProject(ctx *Context, name string, args SharedVPCHostProjectArgs, opts ...ResourceOption) (*SharedVPCHostProject, error)
public SharedVPCHostProject(string name, SharedVPCHostProjectArgs args, CustomResourceOptions? opts = null)
public SharedVPCHostProject(String name, SharedVPCHostProjectArgs args)
public SharedVPCHostProject(String name, SharedVPCHostProjectArgs args, CustomResourceOptions options)
type: gcp:compute:SharedVPCHostProject
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args SharedVPCHostProjectArgs
- 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 SharedVPCHostProjectArgs
- 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 SharedVPCHostProjectArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args SharedVPCHostProjectArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args SharedVPCHostProjectArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
SharedVPCHostProject 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 SharedVPCHostProject resource accepts the following input properties:
- Project string
The ID of the project that will serve as a Shared VPC host project
- Project string
The ID of the project that will serve as a Shared VPC host project
- project String
The ID of the project that will serve as a Shared VPC host project
- project string
The ID of the project that will serve as a Shared VPC host project
- project str
The ID of the project that will serve as a Shared VPC host project
- project String
The ID of the project that will serve as a Shared VPC host project
Outputs
All input properties are implicitly available as output properties. Additionally, the SharedVPCHostProject 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 SharedVPCHostProject Resource
Get an existing SharedVPCHostProject 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?: SharedVPCHostProjectState, opts?: CustomResourceOptions): SharedVPCHostProject
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
project: Optional[str] = None) -> SharedVPCHostProject
func GetSharedVPCHostProject(ctx *Context, name string, id IDInput, state *SharedVPCHostProjectState, opts ...ResourceOption) (*SharedVPCHostProject, error)
public static SharedVPCHostProject Get(string name, Input<string> id, SharedVPCHostProjectState? state, CustomResourceOptions? opts = null)
public static SharedVPCHostProject get(String name, Output<String> id, SharedVPCHostProjectState 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.
- Project string
The ID of the project that will serve as a Shared VPC host project
- Project string
The ID of the project that will serve as a Shared VPC host project
- project String
The ID of the project that will serve as a Shared VPC host project
- project string
The ID of the project that will serve as a Shared VPC host project
- project str
The ID of the project that will serve as a Shared VPC host project
- project String
The ID of the project that will serve as a Shared VPC host project
Import
Google Compute Engine Shared VPC host project feature can be imported using project
, e.g. * {{project_id}}
In Terraform v1.5.0 and later, use an import
block to import Google Compute Engine Shared VPC host projects using one of the formats above. For exampletf import {
id = “{{project_id}}”
to = google_compute_shared_vpc_host_project.default }
$ pulumi import gcp:compute/sharedVPCHostProject:SharedVPCHostProject When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), Google Compute Engine Shared VPC host projects can be imported using one of the formats above. For example
$ pulumi import gcp:compute/sharedVPCHostProject:SharedVPCHostProject default {{project_id}}
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.