RuntimeProjectAttachment class
Runtime project attachment represents an attachment from the runtime project to the host project. API Hub looks for deployments in the attached runtime projects and creates corresponding resources in API Hub for the discovered deployments.
Example Usage
Apihub Runtime Project Attachment Basic
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
import * as time from "@pulumiverse/time";
const hostProject = new gcp.organizations.Project("host_project", {
name: "h-ah-proj",
projectId: "h-ah-proj",
orgId: "123456789",
billingAccount: "000000-0000000-0000000-000000",
deletionPolicy: "DELETE",
});
const wait60Seconds = new time.Sleep("wait_60_seconds", {createDuration: "60s"}, {
dependsOn: [hostProject],
});
// Enable API hub API on host project
const apihubService = new gcp.projects.Service("apihub_service", {
project: hostProject.projectId,
service: "apihub.googleapis.com",
}, {
dependsOn: [wait60Seconds],
});
const hostProjectReg = new gcp.apihub.HostProjectRegistration("host_project_reg", {
project: hostProject.projectId,
location: "asia-south1",
hostProjectRegistrationId: hostProject.projectId,
gcpProject: pulumi.interpolate`projects/${hostProject.projectId}`,
}, {
dependsOn: [apihubService],
});
const runtimeProject = new gcp.organizations.Project("runtime_project", {
name: "r-ah-proj",
projectId: "r-ah-proj",
orgId: "123456789",
billingAccount: "000000-0000000-0000000-000000",
deletionPolicy: "DELETE",
});
// Enable API hub API on runtime project
const apihubServiceRuntime = new gcp.projects.Service("apihub_service_runtime", {
project: runtimeProject.projectId,
service: "apihub.googleapis.com",
}, {
dependsOn: [wait60Seconds],
});
const apihubRuntimeProjectAttachment = new gcp.apihub.RuntimeProjectAttachment("apihub_runtime_project_attachment", {
project: hostProject.projectId,
location: "asia-south1",
runtimeProjectAttachmentId: runtimeProject.projectId,
runtimeProject: pulumi.interpolate`projects/${runtimeProject.projectId}`,
}, {
dependsOn: [
hostProjectReg,
apihubServiceRuntime,
],
});
import pulumi
import pulumi_gcp as gcp
import pulumiverse_time as time
host_project = gcp.organizations.Project("host_project",
name="h-ah-proj",
project_id="h-ah-proj",
org_id="123456789",
billing_account="000000-0000000-0000000-000000",
deletion_policy="DELETE")
wait60_seconds = time.Sleep("wait_60_seconds", create_duration="60s",
opts = pulumi.ResourceOptions(depends_on=[host_project]))
# Enable API hub API on host project
apihub_service = gcp.projects.Service("apihub_service",
project=host_project.project_id,
service="apihub.googleapis.com",
opts = pulumi.ResourceOptions(depends_on=[wait60_seconds]))
host_project_reg = gcp.apihub.HostProjectRegistration("host_project_reg",
project=host_project.project_id,
location="asia-south1",
host_project_registration_id=host_project.project_id,
gcp_project=host_project.project_id.apply(lambda project_id: f"projects/{project_id}"),
opts = pulumi.ResourceOptions(depends_on=[apihub_service]))
runtime_project = gcp.organizations.Project("runtime_project",
name="r-ah-proj",
project_id="r-ah-proj",
org_id="123456789",
billing_account="000000-0000000-0000000-000000",
deletion_policy="DELETE")
# Enable API hub API on runtime project
apihub_service_runtime = gcp.projects.Service("apihub_service_runtime",
project=runtime_project.project_id,
service="apihub.googleapis.com",
opts = pulumi.ResourceOptions(depends_on=[wait60_seconds]))
apihub_runtime_project_attachment = gcp.apihub.RuntimeProjectAttachment("apihub_runtime_project_attachment",
project=host_project.project_id,
location="asia-south1",
runtime_project_attachment_id=runtime_project.project_id,
runtime_project=runtime_project.project_id.apply(lambda project_id: f"projects/{project_id}"),
opts = pulumi.ResourceOptions(depends_on=[
host_project_reg,
apihub_service_runtime,
]))
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
using Time = Pulumiverse.Time;
return await Deployment.RunAsync(() =>
{
var hostProject = new Gcp.Organizations.Project("host_project", new()
{
Name = "h-ah-proj",
ProjectId = "h-ah-proj",
OrgId = "123456789",
BillingAccount = "000000-0000000-0000000-000000",
DeletionPolicy = "DELETE",
});
var wait60Seconds = new Time.Sleep("wait_60_seconds", new()
{
CreateDuration = "60s",
}, new CustomResourceOptions
{
DependsOn =
{
hostProject,
},
});
// Enable API hub API on host project
var apihubService = new Gcp.Projects.Service("apihub_service", new()
{
Project = hostProject.ProjectId,
ServiceName = "apihub.googleapis.com",
}, new CustomResourceOptions
{
DependsOn =
{
wait60Seconds,
},
});
var hostProjectReg = new Gcp.ApiHub.HostProjectRegistration("host_project_reg", new()
{
Project = hostProject.ProjectId,
Location = "asia-south1",
HostProjectRegistrationId = hostProject.ProjectId,
GcpProject = hostProject.ProjectId.Apply(projectId => $"projects/{projectId}"),
}, new CustomResourceOptions
{
DependsOn =
{
apihubService,
},
});
var runtimeProject = new Gcp.Organizations.Project("runtime_project", new()
{
Name = "r-ah-proj",
ProjectId = "r-ah-proj",
OrgId = "123456789",
BillingAccount = "000000-0000000-0000000-000000",
DeletionPolicy = "DELETE",
});
// Enable API hub API on runtime project
var apihubServiceRuntime = new Gcp.Projects.Service("apihub_service_runtime", new()
{
Project = runtimeProject.ProjectId,
ServiceName = "apihub.googleapis.com",
}, new CustomResourceOptions
{
DependsOn =
{
wait60Seconds,
},
});
var apihubRuntimeProjectAttachment = new Gcp.ApiHub.RuntimeProjectAttachment("apihub_runtime_project_attachment", new()
{
Project = hostProject.ProjectId,
Location = "asia-south1",
RuntimeProjectAttachmentId = runtimeProject.ProjectId,
RuntimeProject = runtimeProject.ProjectId.Apply(projectId => $"projects/{projectId}"),
}, new CustomResourceOptions
{
DependsOn =
{
hostProjectReg,
apihubServiceRuntime,
},
});
});
package main
import (
"fmt"
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/apihub"
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/organizations"
"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/projects"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
"github.com/pulumiverse/pulumi-time/sdk/go/time"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
hostProject, err := organizations.NewProject(ctx, "host_project", &organizations.ProjectArgs{
Name: pulumi.String("h-ah-proj"),
ProjectId: pulumi.String("h-ah-proj"),
OrgId: pulumi.String("123456789"),
BillingAccount: pulumi.String("000000-0000000-0000000-000000"),
DeletionPolicy: pulumi.String("DELETE"),
})
if err != nil {
return err
}
wait60Seconds, err := time.NewSleep(ctx, "wait_60_seconds", &time.SleepArgs{
CreateDuration: pulumi.String("60s"),
}, pulumi.DependsOn([]pulumi.Resource{
hostProject,
}))
if err != nil {
return err
}
// Enable API hub API on host project
apihubService, err := projects.NewService(ctx, "apihub_service", &projects.ServiceArgs{
Project: hostProject.ProjectId,
Service: pulumi.String("apihub.googleapis.com"),
}, pulumi.DependsOn([]pulumi.Resource{
wait60Seconds,
}))
if err != nil {
return err
}
hostProjectReg, err := apihub.NewHostProjectRegistration(ctx, "host_project_reg", &apihub.HostProjectRegistrationArgs{
Project: hostProject.ProjectId,
Location: pulumi.String("asia-south1"),
HostProjectRegistrationId: hostProject.ProjectId,
GcpProject: hostProject.ProjectId.ApplyT(func(projectId string) (string, error) {
return fmt.Sprintf("projects/%v", projectId), nil
}).(pulumi.StringOutput),
}, pulumi.DependsOn([]pulumi.Resource{
apihubService,
}))
if err != nil {
return err
}
runtimeProject, err := organizations.NewProject(ctx, "runtime_project", &organizations.ProjectArgs{
Name: pulumi.String("r-ah-proj"),
ProjectId: pulumi.String("r-ah-proj"),
OrgId: pulumi.String("123456789"),
BillingAccount: pulumi.String("000000-0000000-0000000-000000"),
DeletionPolicy: pulumi.String("DELETE"),
})
if err != nil {
return err
}
// Enable API hub API on runtime project
apihubServiceRuntime, err := projects.NewService(ctx, "apihub_service_runtime", &projects.ServiceArgs{
Project: runtimeProject.ProjectId,
Service: pulumi.String("apihub.googleapis.com"),
}, pulumi.DependsOn([]pulumi.Resource{
wait60Seconds,
}))
if err != nil {
return err
}
_, err = apihub.NewRuntimeProjectAttachment(ctx, "apihub_runtime_project_attachment", &apihub.RuntimeProjectAttachmentArgs{
Project: hostProject.ProjectId,
Location: pulumi.String("asia-south1"),
RuntimeProjectAttachmentId: runtimeProject.ProjectId,
RuntimeProject: runtimeProject.ProjectId.ApplyT(func(projectId string) (string, error) {
return fmt.Sprintf("projects/%v", projectId), nil
}).(pulumi.StringOutput),
}, pulumi.DependsOn([]pulumi.Resource{
hostProjectReg,
apihubServiceRuntime,
}))
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
gcp = {
source = "pulumi/gcp"
}
time = {
source = "pulumi/time"
}
}
}
resource "gcp_organizations_project" "host_project" {
name = "h-ah-proj"
project_id = "h-ah-proj"
org_id = "123456789"
billing_account = "000000-0000000-0000000-000000"
deletion_policy = "DELETE"
}
resource "time_sleep" "wait_60_seconds" {
depends_on = [gcp_organizations_project.host_project]
create_duration = "60s"
}
# Enable API hub API on host project
resource "gcp_projects_service" "apihub_service" {
depends_on = [time_sleep.wait_60_seconds]
project = gcp_organizations_project.host_project.project_id
service = "apihub.googleapis.com"
}
resource "gcp_apihub_hostprojectregistration" "host_project_reg" {
depends_on = [gcp_projects_service.apihub_service]
project = gcp_organizations_project.host_project.project_id
location = "asia-south1"
host_project_registration_id = gcp_organizations_project.host_project.project_id
gcp_project ="projects/${gcp_organizations_project.host_project.project_id}"
}
resource "gcp_organizations_project" "runtime_project" {
name = "r-ah-proj"
project_id = "r-ah-proj"
org_id = "123456789"
billing_account = "000000-0000000-0000000-000000"
deletion_policy = "DELETE"
}
# Enable API hub API on runtime project
resource "gcp_projects_service" "apihub_service_runtime" {
depends_on = [time_sleep.wait_60_seconds]
project = gcp_organizations_project.runtime_project.project_id
service = "apihub.googleapis.com"
}
resource "gcp_apihub_runtimeprojectattachment" "apihub_runtime_project_attachment" {
depends_on = [gcp_apihub_hostprojectregistration.host_project_reg, gcp_projects_service.apihub_service_runtime]
project = gcp_organizations_project.host_project.project_id
location = "asia-south1"
runtime_project_attachment_id = gcp_organizations_project.runtime_project.project_id
runtime_project ="projects/${gcp_organizations_project.runtime_project.project_id}"
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.organizations.Project;
import com.pulumi.gcp.organizations.ProjectArgs;
import com.pulumiverse.time.Sleep;
import com.pulumiverse.time.SleepArgs;
import com.pulumi.gcp.projects.Service;
import com.pulumi.gcp.projects.ServiceArgs;
import com.pulumi.gcp.apihub.HostProjectRegistration;
import com.pulumi.gcp.apihub.HostProjectRegistrationArgs;
import com.pulumi.gcp.apihub.RuntimeProjectAttachment;
import com.pulumi.gcp.apihub.RuntimeProjectAttachmentArgs;
import com.pulumi.resources.CustomResourceOptions;
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 hostProject = new Project("hostProject", ProjectArgs.builder()
.name("h-ah-proj")
.projectId("h-ah-proj")
.orgId("123456789")
.billingAccount("000000-0000000-0000000-000000")
.deletionPolicy("DELETE")
.build());
var wait60Seconds = new Sleep("wait60Seconds", SleepArgs.builder()
.createDuration("60s")
.build(), CustomResourceOptions.builder()
.dependsOn(hostProject)
.build());
// Enable API hub API on host project
var apihubService = new Service("apihubService", ServiceArgs.builder()
.project(hostProject.projectId())
.service("apihub.googleapis.com")
.build(), CustomResourceOptions.builder()
.dependsOn(wait60Seconds)
.build());
var hostProjectReg = new HostProjectRegistration("hostProjectReg", HostProjectRegistrationArgs.builder()
.project(hostProject.projectId())
.location("asia-south1")
.hostProjectRegistrationId(hostProject.projectId())
.gcpProject(hostProject.projectId().applyValue(_projectId -> String.format("projects/%s", _projectId)))
.build(), CustomResourceOptions.builder()
.dependsOn(apihubService)
.build());
var runtimeProject = new Project("runtimeProject", ProjectArgs.builder()
.name("r-ah-proj")
.projectId("r-ah-proj")
.orgId("123456789")
.billingAccount("000000-0000000-0000000-000000")
.deletionPolicy("DELETE")
.build());
// Enable API hub API on runtime project
var apihubServiceRuntime = new Service("apihubServiceRuntime", ServiceArgs.builder()
.project(runtimeProject.projectId())
.service("apihub.googleapis.com")
.build(), CustomResourceOptions.builder()
.dependsOn(wait60Seconds)
.build());
var apihubRuntimeProjectAttachment = new RuntimeProjectAttachment("apihubRuntimeProjectAttachment", RuntimeProjectAttachmentArgs.builder()
.project(hostProject.projectId())
.location("asia-south1")
.runtimeProjectAttachmentId(runtimeProject.projectId())
.runtimeProject(runtimeProject.projectId().applyValue(_projectId -> String.format("projects/%s", _projectId)))
.build(), CustomResourceOptions.builder()
.dependsOn(
hostProjectReg,
apihubServiceRuntime)
.build());
}
}
resources:
hostProject:
type: gcp:organizations:Project
name: host_project
properties:
name: h-ah-proj
projectId: h-ah-proj
orgId: '123456789'
billingAccount: 000000-0000000-0000000-000000
deletionPolicy: DELETE
wait60Seconds:
type: time:Sleep
name: wait_60_seconds
properties:
createDuration: 60s
options:
dependsOn:
- ${hostProject}
# Enable API hub API on host project
apihubService:
type: gcp:projects:Service
name: apihub_service
properties:
project: ${hostProject.projectId}
service: apihub.googleapis.com
options:
dependsOn:
- ${wait60Seconds}
hostProjectReg:
type: gcp:apihub:HostProjectRegistration
name: host_project_reg
properties:
project: ${hostProject.projectId}
location: asia-south1
hostProjectRegistrationId: ${hostProject.projectId}
gcpProject: projects/${hostProject.projectId}
options:
dependsOn:
- ${apihubService}
runtimeProject:
type: gcp:organizations:Project
name: runtime_project
properties:
name: r-ah-proj
projectId: r-ah-proj
orgId: '123456789'
billingAccount: 000000-0000000-0000000-000000
deletionPolicy: DELETE
# Enable API hub API on runtime project
apihubServiceRuntime:
type: gcp:projects:Service
name: apihub_service_runtime
properties:
project: ${runtimeProject.projectId}
service: apihub.googleapis.com
options:
dependsOn:
- ${wait60Seconds}
apihubRuntimeProjectAttachment:
type: gcp:apihub:RuntimeProjectAttachment
name: apihub_runtime_project_attachment
properties:
project: ${hostProject.projectId}
location: asia-south1
runtimeProjectAttachmentId: ${runtimeProject.projectId}
runtimeProject: projects/${runtimeProject.projectId}
options:
dependsOn:
- ${hostProjectReg}
- ${apihubServiceRuntime}
Import
RuntimeProjectAttachment can be imported using any of these accepted formats:
projects/{{project}}/locations/{{location}}/runtimeProjectAttachments/{{runtime_project_attachment_id}}{{project}}/{{location}}/{{runtime_project_attachment_id}}{{location}}/{{runtime_project_attachment_id}}
When using the pulumi import command, RuntimeProjectAttachment can be imported using one of the formats above. For example:
$ pulumi import gcp:apihub/runtimeProjectAttachment:RuntimeProjectAttachment default projects/{{project}}/locations/{{location}}/runtimeProjectAttachments/{{runtime_project_attachment_id}}
$ pulumi import gcp:apihub/runtimeProjectAttachment:RuntimeProjectAttachment default {{project}}/{{location}}/{{runtime_project_attachment_id}}
$ pulumi import gcp:apihub/runtimeProjectAttachment:RuntimeProjectAttachment default {{location}}/{{runtime_project_attachment_id}}
Constructors
- RuntimeProjectAttachment(String name, {RuntimeProjectAttachmentArgs? args, CustomResourceOptions? options})
-
Creates a new RuntimeProjectAttachment.
nameThe Pulumi resource name.argsArguments used to configure this RuntimeProjectAttachment. The set of arguments for RuntimeProjectAttachment.optionsResource options controlling this resource's behavior. - RuntimeProjectAttachment.reference(String urn)
- Creates a typed reference to an existing RuntimeProjectAttachment resource.
Properties
-
childResources
→ Set<
Resource> -
finalinherited
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
-
createTime
↔ Output<
String> -
Output only. Create time.
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
- hashCode → int
-
The hash code for this object.
no setterinherited
-
id
↔ Output<
String> -
getter/setter pairinherited
- 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
-
location
↔ Output<
String> -
Part of
parent. See documentation ofprojectsId.latefinal -
name
↔ Output<
String> -
Identifier. The resource name of a runtime project attachment.
Format: "projects/{project}/locations/{location}/runtimeProjectAttachments/{runtime_project_attachment_id}"
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
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
-
runtimeProject
↔ Output<
String> -
Required. Immutable. Google cloud project name in the format: "projects/abc" or "projects/123".
As input, project name with either project id or number are accepted.
As output, this field will contain project number.
latefinal
-
runtimeProjectAttachmentId
↔ Output<
String> -
The ID to use for the Runtime Project Attachment, which will become the
final component of the Runtime Project Attachment's name. The ID must be the same
as the project ID of the Google cloud project specified in the
runtime_project_attachment.runtime_project field.
latefinal
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
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, {RuntimeProjectAttachmentState? state, CustomResourceOptions? options}) → RuntimeProjectAttachment -
Gets an existing RuntimeProjectAttachment resource's state with the given
nameandid.