ServiceProjectAttachment class

Represents a Service project attachment to the Host Project.

Example Usage

Service Project Attachment Basic

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
import * as time from "@pulumiverse/time";

const serviceProject = new gcp.organizations.Project("service_project", {
    projectId: "project-1",
    name: "Service Project",
    orgId: "123456789",
    deletionPolicy: "DELETE",
});
const wait120s = new time.Sleep("wait_120s", {createDuration: "120s"}, {
    dependsOn: [serviceProject],
});
const example = new gcp.apphub.ServiceProjectAttachment("example", {serviceProjectAttachmentId: serviceProject.projectId}, {
    dependsOn: [wait120s],
});
import pulumi
import pulumi_gcp as gcp
import pulumiverse_time as time

service_project = gcp.organizations.Project("service_project",
    project_id="project-1",
    name="Service Project",
    org_id="123456789",
    deletion_policy="DELETE")
wait120s = time.Sleep("wait_120s", create_duration="120s",
opts = pulumi.ResourceOptions(depends_on=[service_project]))
example = gcp.apphub.ServiceProjectAttachment("example", service_project_attachment_id=service_project.project_id,
opts = pulumi.ResourceOptions(depends_on=[wait120s]))
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
using Time = Pulumiverse.Time;

return await Deployment.RunAsync(() =>
{
    var serviceProject = new Gcp.Organizations.Project("service_project", new()
    {
        ProjectId = "project-1",
        Name = "Service Project",
        OrgId = "123456789",
        DeletionPolicy = "DELETE",
    });

    var wait120s = new Time.Sleep("wait_120s", new()
    {
        CreateDuration = "120s",
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            serviceProject,
        },
    });

    var example = new Gcp.Apphub.ServiceProjectAttachment("example", new()
    {
        ServiceProjectAttachmentId = serviceProject.ProjectId,
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            wait120s,
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/apphub"
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/organizations"
	"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 {
		serviceProject, err := organizations.NewProject(ctx, "service_project", &organizations.ProjectArgs{
			ProjectId:      pulumi.String("project-1"),
			Name:           pulumi.String("Service Project"),
			OrgId:          pulumi.String("123456789"),
			DeletionPolicy: pulumi.String("DELETE"),
		})
		if err != nil {
			return err
		}
		wait120s, err := time.NewSleep(ctx, "wait_120s", &time.SleepArgs{
			CreateDuration: pulumi.String("120s"),
		}, pulumi.DependsOn([]pulumi.Resource{
			serviceProject,
		}))
		if err != nil {
			return err
		}
		_, err = apphub.NewServiceProjectAttachment(ctx, "example", &apphub.ServiceProjectAttachmentArgs{
			ServiceProjectAttachmentId: serviceProject.ProjectId,
		}, pulumi.DependsOn([]pulumi.Resource{
			wait120s,
		}))
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    gcp = {
      source = "pulumi/gcp"
    }
    time = {
      source = "pulumi/time"
    }
  }
}

resource "gcp_apphub_serviceprojectattachment" "example" {
  depends_on                    = [time_sleep.wait_120s]
  service_project_attachment_id = gcp_organizations_project.service_project.project_id
}
resource "gcp_organizations_project" "service_project" {
  project_id      = "project-1"
  name            = "Service Project"
  org_id          = "123456789"
  deletion_policy = "DELETE"
}
resource "time_sleep" "wait_120s" {
  depends_on      = [gcp_organizations_project.service_project]
  create_duration = "120s"
}
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.apphub.ServiceProjectAttachment;
import com.pulumi.gcp.apphub.ServiceProjectAttachmentArgs;
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 serviceProject = new Project("serviceProject", ProjectArgs.builder()
            .projectId("project-1")
            .name("Service Project")
            .orgId("123456789")
            .deletionPolicy("DELETE")
            .build());

        var wait120s = new Sleep("wait120s", SleepArgs.builder()
            .createDuration("120s")
            .build(), CustomResourceOptions.builder()
                .dependsOn(serviceProject)
                .build());

        var example = new ServiceProjectAttachment("example", ServiceProjectAttachmentArgs.builder()
            .serviceProjectAttachmentId(serviceProject.projectId())
            .build(), CustomResourceOptions.builder()
                .dependsOn(wait120s)
                .build());

    }
}
resources:
  example:
    type: gcp:apphub:ServiceProjectAttachment
    properties:
      serviceProjectAttachmentId: ${serviceProject.projectId}
    options:
      dependsOn:
        - ${wait120s}
  serviceProject:
    type: gcp:organizations:Project
    name: service_project
    properties:
      projectId: project-1
      name: Service Project
      orgId: '123456789'
      deletionPolicy: DELETE
  wait120s:
    type: time:Sleep
    name: wait_120s
    properties:
      createDuration: 120s
    options:
      dependsOn:
        - ${serviceProject}

Service Project Attachment Full

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
import * as time from "@pulumiverse/time";

const serviceProjectFull = new gcp.organizations.Project("service_project_full", {
    projectId: "project-1",
    name: "Service Project Full",
    orgId: "123456789",
    deletionPolicy: "DELETE",
});
const wait120s = new time.Sleep("wait_120s", {createDuration: "120s"}, {
    dependsOn: [serviceProjectFull],
});
const example2 = new gcp.apphub.ServiceProjectAttachment("example2", {
    serviceProjectAttachmentId: serviceProjectFull.projectId,
    serviceProject: serviceProjectFull.projectId,
}, {
    dependsOn: [wait120s],
});
import pulumi
import pulumi_gcp as gcp
import pulumiverse_time as time

service_project_full = gcp.organizations.Project("service_project_full",
    project_id="project-1",
    name="Service Project Full",
    org_id="123456789",
    deletion_policy="DELETE")
wait120s = time.Sleep("wait_120s", create_duration="120s",
opts = pulumi.ResourceOptions(depends_on=[service_project_full]))
example2 = gcp.apphub.ServiceProjectAttachment("example2",
    service_project_attachment_id=service_project_full.project_id,
    service_project=service_project_full.project_id,
    opts = pulumi.ResourceOptions(depends_on=[wait120s]))
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
using Time = Pulumiverse.Time;

return await Deployment.RunAsync(() =>
{
    var serviceProjectFull = new Gcp.Organizations.Project("service_project_full", new()
    {
        ProjectId = "project-1",
        Name = "Service Project Full",
        OrgId = "123456789",
        DeletionPolicy = "DELETE",
    });

    var wait120s = new Time.Sleep("wait_120s", new()
    {
        CreateDuration = "120s",
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            serviceProjectFull,
        },
    });

    var example2 = new Gcp.Apphub.ServiceProjectAttachment("example2", new()
    {
        ServiceProjectAttachmentId = serviceProjectFull.ProjectId,
        ServiceProject = serviceProjectFull.ProjectId,
    }, new CustomResourceOptions
    {
        DependsOn =
        {
            wait120s,
        },
    });

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/apphub"
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/organizations"
	"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 {
		serviceProjectFull, err := organizations.NewProject(ctx, "service_project_full", &organizations.ProjectArgs{
			ProjectId:      pulumi.String("project-1"),
			Name:           pulumi.String("Service Project Full"),
			OrgId:          pulumi.String("123456789"),
			DeletionPolicy: pulumi.String("DELETE"),
		})
		if err != nil {
			return err
		}
		wait120s, err := time.NewSleep(ctx, "wait_120s", &time.SleepArgs{
			CreateDuration: pulumi.String("120s"),
		}, pulumi.DependsOn([]pulumi.Resource{
			serviceProjectFull,
		}))
		if err != nil {
			return err
		}
		_, err = apphub.NewServiceProjectAttachment(ctx, "example2", &apphub.ServiceProjectAttachmentArgs{
			ServiceProjectAttachmentId: serviceProjectFull.ProjectId,
			ServiceProject:             serviceProjectFull.ProjectId,
		}, pulumi.DependsOn([]pulumi.Resource{
			wait120s,
		}))
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    gcp = {
      source = "pulumi/gcp"
    }
    time = {
      source = "pulumi/time"
    }
  }
}

resource "gcp_apphub_serviceprojectattachment" "example2" {
  depends_on                    = [time_sleep.wait_120s]
  service_project_attachment_id = gcp_organizations_project.service_project_full.project_id
  service_project               = gcp_organizations_project.service_project_full.project_id
}
resource "gcp_organizations_project" "service_project_full" {
  project_id      = "project-1"
  name            = "Service Project Full"
  org_id          = "123456789"
  deletion_policy = "DELETE"
}
resource "time_sleep" "wait_120s" {
  depends_on      = [gcp_organizations_project.service_project_full]
  create_duration = "120s"
}
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.apphub.ServiceProjectAttachment;
import com.pulumi.gcp.apphub.ServiceProjectAttachmentArgs;
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 serviceProjectFull = new Project("serviceProjectFull", ProjectArgs.builder()
            .projectId("project-1")
            .name("Service Project Full")
            .orgId("123456789")
            .deletionPolicy("DELETE")
            .build());

        var wait120s = new Sleep("wait120s", SleepArgs.builder()
            .createDuration("120s")
            .build(), CustomResourceOptions.builder()
                .dependsOn(serviceProjectFull)
                .build());

        var example2 = new ServiceProjectAttachment("example2", ServiceProjectAttachmentArgs.builder()
            .serviceProjectAttachmentId(serviceProjectFull.projectId())
            .serviceProject(serviceProjectFull.projectId())
            .build(), CustomResourceOptions.builder()
                .dependsOn(wait120s)
                .build());

    }
}
resources:
  example2:
    type: gcp:apphub:ServiceProjectAttachment
    properties:
      serviceProjectAttachmentId: ${serviceProjectFull.projectId}
      serviceProject: ${serviceProjectFull.projectId}
    options:
      dependsOn:
        - ${wait120s}
  serviceProjectFull:
    type: gcp:organizations:Project
    name: service_project_full
    properties:
      projectId: project-1
      name: Service Project Full
      orgId: '123456789'
      deletionPolicy: DELETE
  wait120s:
    type: time:Sleep
    name: wait_120s
    properties:
      createDuration: 120s
    options:
      dependsOn:
        - ${serviceProjectFull}

Import

ServiceProjectAttachment can be imported using any of these accepted formats:

  • projects/{{project}}/locations/global/serviceProjectAttachments/{{service_project_attachment_id}}
  • {{project}}/{{service_project_attachment_id}}
  • {{service_project_attachment_id}}

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

$ pulumi import gcp:apphub/serviceProjectAttachment:ServiceProjectAttachment default projects/{{project}}/locations/global/serviceProjectAttachments/{{service_project_attachment_id}}
$ pulumi import gcp:apphub/serviceProjectAttachment:ServiceProjectAttachment default {{project}}/{{service_project_attachment_id}}
$ pulumi import gcp:apphub/serviceProjectAttachment:ServiceProjectAttachment default {{service_project_attachment_id}}

Constructors

ServiceProjectAttachment(String name, {ServiceProjectAttachmentArgs? args, CustomResourceOptions? options})
Creates a new ServiceProjectAttachment. name The Pulumi resource name. args Arguments used to configure this ServiceProjectAttachment. The set of arguments for ServiceProjectAttachment. options Resource options controlling this resource's behavior.
ServiceProjectAttachment.reference(String urn)
Creates a typed reference to an existing ServiceProjectAttachment 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
name ↔ Output<String>
"Identifier. The resource name of a ServiceProjectAttachment. Format:"projects/{host-project-id}/locations/global/serviceProjectAttachments/{service-project-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
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
serviceProject ↔ Output<String?>
"Immutable. Service 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
serviceProjectAttachmentId ↔ Output<String>
Required. The service project attachment identifier must contain the projectId of the service project specified in the service_project_attachment.service_project field. Hint: "projects/{project_id}"
latefinal
state ↔ Output<String>
ServiceProjectAttachment state.
latefinal
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
uid ↔ Output<String>
Output only. A globally unique identifier (in UUID4 format) for the ServiceProjectAttachment.
latefinal
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, {ServiceProjectAttachmentState? state, CustomResourceOptions? options}) → ServiceProjectAttachment
Gets an existing ServiceProjectAttachment resource's state with the given name and id.