@pulumi/gcp
Version:
A Pulumi package for creating and managing Google Cloud Platform resources.
606 lines • 25.2 kB
TypeScript
import * as pulumi from "@pulumi/pulumi";
import * as inputs from "../types/input";
import * as outputs from "../types/output";
/**
* A UnitOperation encapsulates the intent to change or interact with a Unit. Operations such as provisioning, upgrading, or deprovisioning a Unit are triggered by creating a UnitOperation resource.
*
* ## Example Usage
*
* ### Saas Runtime Unit Operation Basic
*
* ```typescript
* import * as pulumi from "@pulumi/pulumi";
* import * as gcp from "@pulumi/gcp";
*
* const location = "us-east1";
* const tenantProjectId = "tenant";
* const exampleSaas = new gcp.saasruntime.SaaS("example_saas", {
* saasId: "example-saas",
* location: location,
* locations: [{
* name: location,
* }],
* });
* const clusterUnitKind = new gcp.saasruntime.UnitKind("cluster_unit_kind", {
* location: location,
* unitKindId: "vm-unitkind",
* saas: exampleSaas.id,
* defaultRelease: `projects/my-project-name/locations/${location}/releases/example-release`,
* });
* const exampleRelease = new gcp.saasruntime.Release("example_release", {
* location: location,
* releaseId: "example-release",
* unitKind: clusterUnitKind.id,
* blueprint: {
* "package": "us-central1-docker.pkg.dev/ci-test-project-188019/test-repo/tf-test-easysaas-alpha-image@sha256:7992fdbaeaf998ecd31a7f937bb26e38a781ecf49b24857a6176c1e9bfc299ee",
* },
* });
* const exampleUnit = new gcp.saasruntime.Unit("example_unit", {
* location: location,
* unitId: "example-unit",
* unitKind: clusterUnitKind.id,
* });
* const tenantProject = new gcp.organizations.Project("tenant_project", {
* projectId: tenantProjectId,
* name: tenantProjectId,
* billingAccount: "000000-0000000-0000000-000000",
* orgId: "123456789",
* deletionPolicy: "DELETE",
* });
* const saasServices = new gcp.projects.Service("saas_services", {
* project: tenantProject.projectId,
* service: "compute.googleapis.com",
* disableDependentServices: true,
* });
* const actuationServiceAccount = new gcp.serviceaccount.Account("actuation_service_account", {
* accountId: "actuator",
* displayName: "SaaS Actuation Service Account",
* });
* const tenantConfigAdmin = new gcp.projects.IAMMember("tenant_config_admin", {
* project: tenantProject.projectId,
* role: "roles/config.admin",
* member: pulumi.interpolate`serviceAccount:${actuationServiceAccount.email}`,
* });
* const tenantStorageAdmin = new gcp.projects.IAMMember("tenant_storage_admin", {
* project: tenantProject.projectId,
* role: "roles/storage.admin",
* member: pulumi.interpolate`serviceAccount:${actuationServiceAccount.email}`,
* });
* const tenantComputeAdmin = new gcp.projects.IAMMember("tenant_compute_admin", {
* project: tenantProject.projectId,
* role: "roles/compute.admin",
* member: pulumi.interpolate`serviceAccount:${actuationServiceAccount.email}`,
* });
* const actuationTokenCreator = new gcp.serviceaccount.IAMMember("actuation_token_creator", {
* serviceAccountId: actuationServiceAccount.name,
* role: "roles/iam.serviceAccountTokenCreator",
* member: "serviceAccount:service-1111111111111@gcp-sa-saasservicemgmt.iam.gserviceaccount.com",
* });
* const provisionUnitOperation = new gcp.saasruntime.UnitOperation("provision_unit_operation", {
* location: location,
* unitOperationId: "provision-unit-operation",
* unit: exampleUnit.id,
* waitForCompletion: true,
* provision: {
* release: exampleRelease.id,
* inputVariables: [
* {
* variable: "tenant_project_id",
* value: tenantProject.projectId,
* type: "STRING",
* },
* {
* variable: "tenant_project_number",
* value: tenantProject.number,
* type: "INT",
* },
* {
* variable: "zone",
* value: "us-central1-a",
* type: "STRING",
* },
* {
* variable: "instance_name",
* value: "terraform-test-instance",
* type: "STRING",
* },
* {
* variable: "actuation_sa",
* value: actuationServiceAccount.email,
* type: "STRING",
* },
* ],
* },
* labels: {
* "label-one": "foo",
* },
* annotations: {
* "annotation-one": "bar",
* },
* }, {
* dependsOn: [
* tenantConfigAdmin,
* tenantStorageAdmin,
* tenantComputeAdmin,
* actuationTokenCreator,
* saasServices,
* ],
* });
* const noopUpgradeUnitOperation = new gcp.saasruntime.UnitOperation("noop_upgrade_unit_operation", {
* location: location,
* unitOperationId: "upgrade-unit-operation",
* unit: exampleUnit.id,
* waitForCompletion: true,
* upgrade: {
* release: exampleRelease.id,
* inputVariables: [
* {
* variable: "tenant_project_id",
* value: tenantProject.projectId,
* type: "STRING",
* },
* {
* variable: "tenant_project_number",
* value: tenantProject.number,
* type: "INT",
* },
* {
* variable: "zone",
* value: "us-central1-a",
* type: "STRING",
* },
* {
* variable: "instance_name",
* value: "terraform-test-instance",
* type: "STRING",
* },
* {
* variable: "actuation_sa",
* value: actuationServiceAccount.email,
* type: "STRING",
* },
* ],
* },
* }, {
* dependsOn: [provisionUnitOperation],
* });
* const deprovisionOperation = new gcp.saasruntime.UnitOperation("deprovision_operation", {
* location: location,
* unitOperationId: "deprovision-unit-operation",
* unit: exampleUnit.id,
* waitForCompletion: true,
* deprovision: {},
* }, {
* dependsOn: [noopUpgradeUnitOperation],
* });
* ```
*
* ## Import
*
* UnitOperation can be imported using any of these accepted formats:
*
* * `projects/{{project}}/locations/{{location}}/unitOperations/{{unit_operation_id}}`
* * `{{project}}/{{location}}/{{unit_operation_id}}`
* * `{{location}}/{{unit_operation_id}}`
*
* When using the `pulumi import` command, UnitOperation can be imported using one of the formats above. For example:
*
* ```sh
* $ pulumi import gcp:saasruntime/unitOperation:UnitOperation default projects/{{project}}/locations/{{location}}/unitOperations/{{unit_operation_id}}
* $ pulumi import gcp:saasruntime/unitOperation:UnitOperation default {{project}}/{{location}}/{{unit_operation_id}}
* $ pulumi import gcp:saasruntime/unitOperation:UnitOperation default {{location}}/{{unit_operation_id}}
* ```
*/
export declare class UnitOperation extends pulumi.CustomResource {
/**
* Get an existing UnitOperation resource's state with the given name, ID, and optional extra
* properties used to qualify the lookup.
*
* @param name The _unique_ name of the resulting resource.
* @param id The _unique_ provider ID of the resource to lookup.
* @param state Any extra arguments used during the lookup.
* @param opts Optional settings to control the behavior of the CustomResource.
*/
static get(name: string, id: pulumi.Input<pulumi.ID>, state?: UnitOperationState, opts?: pulumi.CustomResourceOptions): UnitOperation;
/**
* Returns true if the given object is an instance of UnitOperation. This is designed to work even
* when multiple copies of the Pulumi SDK have been loaded into the same process.
*/
static isInstance(obj: any): obj is UnitOperation;
/**
* Annotations is an unstructured key-value map stored with a resource that
* may be set by external tools to store and retrieve arbitrary metadata.
* They are not queryable and should be preserved when modifying objects.
* More info: https://kubernetes.io/docs/user-guide/annotations
* **Note**: This field is non-authoritative, and will only manage the annotations present in your configuration.
* Please refer to the field `effectiveAnnotations` for all of the annotations present on the resource.
*/
readonly annotations: pulumi.Output<{
[key: string]: string;
} | undefined>;
/**
* A set of conditions which indicate the various conditions this resource can
* have.
* Structure is documented below.
*/
readonly conditions: pulumi.Output<outputs.saasruntime.UnitOperationCondition[]>;
/**
* The timestamp when the resource was created.
*/
readonly createTime: pulumi.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.
*/
readonly deletionPolicy: pulumi.Output<string>;
/**
* Deprovision is the unit operation that deprovision the underlying
* resources represented by a Unit. Can only execute if the Unit is currently
* provisioned.
*/
readonly deprovision: pulumi.Output<outputs.saasruntime.UnitOperationDeprovision | undefined>;
/**
* All of annotations (key/value pairs) present on the resource in GCP, including the annotations configured through Terraform, other clients and services.
*/
readonly effectiveAnnotations: pulumi.Output<{
[key: string]: string;
}>;
/**
* All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
*/
readonly effectiveLabels: pulumi.Output<{
[key: string]: string;
}>;
/**
* The engine state for on-going
* deployment engine operation(s).
* This field is opaque for external usage.
*/
readonly engineState: pulumi.Output<string>;
/**
* Possible values:
* NOT_APPLICABLE
* FATAL
* RETRIABLE
* IGNORABLE
* STANDARD
*/
readonly errorCategory: pulumi.Output<string>;
/**
* An opaque value that uniquely identifies a version or
* generation of a resource. It can be used to confirm that the client
* and server agree on the ordering of a resource being written.
*/
readonly etag: pulumi.Output<string>;
/**
* The labels on the resource, which can be used for categorization.
* similar to Kubernetes resource labels.
* **Note**: This field is non-authoritative, and will only manage the labels present in your configuration.
* Please refer to the field `effectiveLabels` for all of the labels present on the resource.
*/
readonly labels: pulumi.Output<{
[key: string]: string;
} | undefined>;
/**
* Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122.
*/
readonly location: pulumi.Output<string>;
/**
* Identifier. The resource name (full URI of the resource) following the standard naming
* scheme:
* "projects/{project}/locations/{location}/unitOperations/{unitOperation}"
*/
readonly name: pulumi.Output<string>;
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
readonly project: pulumi.Output<string>;
/**
* Provision is the unit operation that provision the underlying resources
* represented by a Unit. Can only execute if the Unit is not currently
* provisioned.
* Structure is documented below.
*/
readonly provision: pulumi.Output<outputs.saasruntime.UnitOperationProvision | undefined>;
/**
* The combination of labels configured directly on the resource
* and default labels configured on the provider.
*/
readonly pulumiLabels: pulumi.Output<{
[key: string]: string;
}>;
/**
* UnitOperationState describes the current state of the unit operation.
* Possible values:
* UNIT_OPERATION_STATE_UNKNOWN
* UNIT_OPERATION_STATE_PENDING
* UNIT_OPERATION_STATE_SCHEDULED
* UNIT_OPERATION_STATE_RUNNING
* UNIT_OPERATION_STATE_SUCCEEDED
* UNIT_OPERATION_STATE_FAILED
* UNIT_OPERATION_STATE_CANCELLED
*/
readonly state: pulumi.Output<string>;
/**
* The unique identifier of the resource. UID is unique in the time
* and space for this resource within the scope of the service. It is
* typically generated by the server on successful creation of a resource
* and must not be changed. UID is used to uniquely identify resources
* with resource name reuses. This should be a UUID4.
*/
readonly uid: pulumi.Output<string>;
/**
* The Unit a given UnitOperation will act upon.
*/
readonly unit: pulumi.Output<string>;
/**
* The ID value for the new unit operation.
*/
readonly unitOperationId: pulumi.Output<string>;
/**
* The timestamp when the resource was last updated. Any
* change to the resource made by users must refresh this value.
* Changes to a resource made by the service should refresh this value.
*/
readonly updateTime: pulumi.Output<string>;
/**
* Upgrade is the unit operation that upgrades a provisioned unit, which may
* also include the underlying resources represented by a Unit. Can only execute
* if the Unit is currently provisioned.
* Structure is documented below.
*/
readonly upgrade: pulumi.Output<outputs.saasruntime.UnitOperationUpgrade | undefined>;
/**
* If true, wait for the UnitOperation to reach a terminal state (SUCCEEDED, FAILED, CANCELLED)
* before completing the apply.
*/
readonly waitForCompletion: pulumi.Output<boolean | undefined>;
/**
* Create a UnitOperation resource with the given unique name, arguments, and options.
*
* @param name The _unique_ name of the resource.
* @param args The arguments to use to populate this resource's properties.
* @param opts A bag of options that control this resource's behavior.
*/
constructor(name: string, args: UnitOperationArgs, opts?: pulumi.CustomResourceOptions);
}
/**
* Input properties used for looking up and filtering UnitOperation resources.
*/
export interface UnitOperationState {
/**
* Annotations is an unstructured key-value map stored with a resource that
* may be set by external tools to store and retrieve arbitrary metadata.
* They are not queryable and should be preserved when modifying objects.
* More info: https://kubernetes.io/docs/user-guide/annotations
* **Note**: This field is non-authoritative, and will only manage the annotations present in your configuration.
* Please refer to the field `effectiveAnnotations` for all of the annotations present on the resource.
*/
annotations?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
} | undefined>;
/**
* A set of conditions which indicate the various conditions this resource can
* have.
* Structure is documented below.
*/
conditions?: pulumi.Input<pulumi.Input<inputs.saasruntime.UnitOperationCondition>[] | undefined>;
/**
* The timestamp when the resource was created.
*/
createTime?: pulumi.Input<string | undefined>;
/**
* 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.
*/
deletionPolicy?: pulumi.Input<string | undefined>;
/**
* Deprovision is the unit operation that deprovision the underlying
* resources represented by a Unit. Can only execute if the Unit is currently
* provisioned.
*/
deprovision?: pulumi.Input<inputs.saasruntime.UnitOperationDeprovision | undefined>;
/**
* All of annotations (key/value pairs) present on the resource in GCP, including the annotations configured through Terraform, other clients and services.
*/
effectiveAnnotations?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
} | undefined>;
/**
* All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
*/
effectiveLabels?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
} | undefined>;
/**
* The engine state for on-going
* deployment engine operation(s).
* This field is opaque for external usage.
*/
engineState?: pulumi.Input<string | undefined>;
/**
* Possible values:
* NOT_APPLICABLE
* FATAL
* RETRIABLE
* IGNORABLE
* STANDARD
*/
errorCategory?: pulumi.Input<string | undefined>;
/**
* An opaque value that uniquely identifies a version or
* generation of a resource. It can be used to confirm that the client
* and server agree on the ordering of a resource being written.
*/
etag?: pulumi.Input<string | undefined>;
/**
* The labels on the resource, which can be used for categorization.
* similar to Kubernetes resource labels.
* **Note**: This field is non-authoritative, and will only manage the labels present in your configuration.
* Please refer to the field `effectiveLabels` for all of the labels present on the resource.
*/
labels?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
} | undefined>;
/**
* Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122.
*/
location?: pulumi.Input<string | undefined>;
/**
* Identifier. The resource name (full URI of the resource) following the standard naming
* scheme:
* "projects/{project}/locations/{location}/unitOperations/{unitOperation}"
*/
name?: pulumi.Input<string | undefined>;
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
project?: pulumi.Input<string | undefined>;
/**
* Provision is the unit operation that provision the underlying resources
* represented by a Unit. Can only execute if the Unit is not currently
* provisioned.
* Structure is documented below.
*/
provision?: pulumi.Input<inputs.saasruntime.UnitOperationProvision | undefined>;
/**
* The combination of labels configured directly on the resource
* and default labels configured on the provider.
*/
pulumiLabels?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
} | undefined>;
/**
* UnitOperationState describes the current state of the unit operation.
* Possible values:
* UNIT_OPERATION_STATE_UNKNOWN
* UNIT_OPERATION_STATE_PENDING
* UNIT_OPERATION_STATE_SCHEDULED
* UNIT_OPERATION_STATE_RUNNING
* UNIT_OPERATION_STATE_SUCCEEDED
* UNIT_OPERATION_STATE_FAILED
* UNIT_OPERATION_STATE_CANCELLED
*/
state?: pulumi.Input<string | undefined>;
/**
* The unique identifier of the resource. UID is unique in the time
* and space for this resource within the scope of the service. It is
* typically generated by the server on successful creation of a resource
* and must not be changed. UID is used to uniquely identify resources
* with resource name reuses. This should be a UUID4.
*/
uid?: pulumi.Input<string | undefined>;
/**
* The Unit a given UnitOperation will act upon.
*/
unit?: pulumi.Input<string | undefined>;
/**
* The ID value for the new unit operation.
*/
unitOperationId?: pulumi.Input<string | undefined>;
/**
* The timestamp when the resource was last updated. Any
* change to the resource made by users must refresh this value.
* Changes to a resource made by the service should refresh this value.
*/
updateTime?: pulumi.Input<string | undefined>;
/**
* Upgrade is the unit operation that upgrades a provisioned unit, which may
* also include the underlying resources represented by a Unit. Can only execute
* if the Unit is currently provisioned.
* Structure is documented below.
*/
upgrade?: pulumi.Input<inputs.saasruntime.UnitOperationUpgrade | undefined>;
/**
* If true, wait for the UnitOperation to reach a terminal state (SUCCEEDED, FAILED, CANCELLED)
* before completing the apply.
*/
waitForCompletion?: pulumi.Input<boolean | undefined>;
}
/**
* The set of arguments for constructing a UnitOperation resource.
*/
export interface UnitOperationArgs {
/**
* Annotations is an unstructured key-value map stored with a resource that
* may be set by external tools to store and retrieve arbitrary metadata.
* They are not queryable and should be preserved when modifying objects.
* More info: https://kubernetes.io/docs/user-guide/annotations
* **Note**: This field is non-authoritative, and will only manage the annotations present in your configuration.
* Please refer to the field `effectiveAnnotations` for all of the annotations present on the resource.
*/
annotations?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
} | undefined>;
/**
* 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.
*/
deletionPolicy?: pulumi.Input<string | undefined>;
/**
* Deprovision is the unit operation that deprovision the underlying
* resources represented by a Unit. Can only execute if the Unit is currently
* provisioned.
*/
deprovision?: pulumi.Input<inputs.saasruntime.UnitOperationDeprovision | undefined>;
/**
* The labels on the resource, which can be used for categorization.
* similar to Kubernetes resource labels.
* **Note**: This field is non-authoritative, and will only manage the labels present in your configuration.
* Please refer to the field `effectiveLabels` for all of the labels present on the resource.
*/
labels?: pulumi.Input<{
[key: string]: pulumi.Input<string>;
} | undefined>;
/**
* Resource ID segment making up resource `name`. It identifies the resource within its parent collection as described in https://google.aip.dev/122.
*/
location: pulumi.Input<string>;
/**
* The ID of the project in which the resource belongs.
* If it is not provided, the provider project is used.
*/
project?: pulumi.Input<string | undefined>;
/**
* Provision is the unit operation that provision the underlying resources
* represented by a Unit. Can only execute if the Unit is not currently
* provisioned.
* Structure is documented below.
*/
provision?: pulumi.Input<inputs.saasruntime.UnitOperationProvision | undefined>;
/**
* The Unit a given UnitOperation will act upon.
*/
unit: pulumi.Input<string>;
/**
* The ID value for the new unit operation.
*/
unitOperationId: pulumi.Input<string>;
/**
* Upgrade is the unit operation that upgrades a provisioned unit, which may
* also include the underlying resources represented by a Unit. Can only execute
* if the Unit is currently provisioned.
* Structure is documented below.
*/
upgrade?: pulumi.Input<inputs.saasruntime.UnitOperationUpgrade | undefined>;
/**
* If true, wait for the UnitOperation to reach a terminal state (SUCCEEDED, FAILED, CANCELLED)
* before completing the apply.
*/
waitForCompletion?: pulumi.Input<boolean | undefined>;
}
//# sourceMappingURL=unitOperation.d.ts.map