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
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",
});
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")
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/compute"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
// A host project provides network resources to associated service projects.
host, err := compute.NewSharedVPCHostProject(ctx, "host", &compute.SharedVPCHostProjectArgs{
Project: pulumi.String("host-project-id"),
})
if err != nil {
return err
}
// A service project gains access to network resources provided by its
// associated host project.
_, 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
})
}
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 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) {
// A host project provides network resources to associated service projects.
var host = new SharedVPCHostProject("host", SharedVPCHostProjectArgs.builder()
.project("host-project-id")
.build());
// A service project gains access to network resources provided by its
// associated host project.
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());
}
}
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
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new SharedVPCHostProject(name: string, args: SharedVPCHostProjectArgs, opts?: CustomResourceOptions);
@overload
def SharedVPCHostProject(resource_name: str,
args: SharedVPCHostProjectArgs,
opts: Optional[ResourceOptions] = None)
@overload
def SharedVPCHostProject(resource_name: str,
opts: Optional[ResourceOptions] = None,
project: Optional[str] = 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.
Parameters
- 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var sharedVPCHostProjectResource = new Gcp.Compute.SharedVPCHostProject("sharedVPCHostProjectResource", new()
{
Project = "string",
});
example, err := compute.NewSharedVPCHostProject(ctx, "sharedVPCHostProjectResource", &compute.SharedVPCHostProjectArgs{
Project: pulumi.String("string"),
})
var sharedVPCHostProjectResource = new SharedVPCHostProject("sharedVPCHostProjectResource", SharedVPCHostProjectArgs.builder()
.project("string")
.build());
shared_vpc_host_project_resource = gcp.compute.SharedVPCHostProject("sharedVPCHostProjectResource", project="string")
const sharedVPCHostProjectResource = new gcp.compute.SharedVPCHostProject("sharedVPCHostProjectResource", {project: "string"});
type: gcp:compute:SharedVPCHostProject
properties:
project: string
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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
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}}
When using the pulumi import
command, 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}}
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.