UNPKG

@pulumi/gcp

Version:

A Pulumi package for creating and managing Google Cloud Platform resources.

457 lines (456 loc) • 19.4 kB
import * as pulumi from "@pulumi/pulumi"; /** * Workflow program to be executed by Workflows. * * To get more information about Workflow, see: * * * [API documentation](https://cloud.google.com/workflows/docs/reference/rest/v1/projects.locations.workflows) * * How-to Guides * * [Managing Workflows](https://cloud.google.com/workflows/docs/creating-updating-workflow) * * ## Example Usage * * ### Workflow Basic * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const testAccount = new gcp.serviceaccount.Account("test_account", { * accountId: "my-account", * displayName: "Test Service Account", * }); * const example = new gcp.workflows.Workflow("example", { * name: "workflow", * region: "us-central1", * description: "Magic", * serviceAccount: testAccount.id, * callLogLevel: "LOG_ERRORS_ONLY", * labels: { * env: "test", * }, * userEnvVars: { * url: "https://timeapi.io/api/Time/current/zone?timeZone=Europe/Amsterdam", * }, * deletionProtection: false, * sourceContents: `# This is a sample workflow. You can replace it with your source code. * # * # This workflow does the following: * # - reads current time and date information from an external API and stores * # the response in currentTime variable * # - retrieves a list of Wikipedia articles related to the day of the week * # from currentTime * # - returns the list of articles as an output of the workflow * # * # Note: In Terraform you need to escape the or it will cause errors. * * - getCurrentTime: * call: http.get * args: * url: \${sys.get_env("url")} * result: currentTime * - readWikipedia: * call: http.get * args: * url: https://en.wikipedia.org/w/api.php * query: * action: opensearch * search: \${currentTime.body.dayOfWeek} * result: wikiResult * - returnOutput: * return: \${wikiResult.body[1]} * `, * }); * ``` * ### Workflow Tags * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as gcp from "@pulumi/gcp"; * * const project = gcp.organizations.getProject({}); * const tagKey = new gcp.tags.TagKey("tag_key", { * parent: project.then(project => `projects/${project.number}`), * shortName: "tag_key", * }); * const tagValue = new gcp.tags.TagValue("tag_value", { * parent: pulumi.interpolate`tagKeys/${tagKey.name}`, * shortName: "tag_value", * }); * const testAccount = new gcp.serviceaccount.Account("test_account", { * accountId: "my-account", * displayName: "Test Service Account", * }); * const example = new gcp.workflows.Workflow("example", { * name: "workflow", * region: "us-central1", * description: "Magic", * serviceAccount: testAccount.id, * deletionProtection: false, * tags: pulumi.all([project, tagKey.shortName, tagValue.shortName]).apply(([project, tagKeyShortName, tagValueShortName]) => { * [`${project.projectId}/${tagKeyShortName}`]: tagValueShortName, * }), * sourceContents: `# This is a sample workflow. You can replace it with your source code. * # * # This workflow does the following: * # - reads current time and date information from an external API and stores * # the response in currentTime variable * # - retrieves a list of Wikipedia articles related to the day of the week * # from currentTime * # - returns the list of articles as an output of the workflow * # * # Note: In Terraform you need to escape the or it will cause errors. * * - getCurrentTime: * call: http.get * args: * url: \${sys.get_env("url")} * result: currentTime * - readWikipedia: * call: http.get * args: * url: https://en.wikipedia.org/w/api.php * query: * action: opensearch * search: \${currentTime.body.dayOfWeek} * result: wikiResult * - returnOutput: * return: \${wikiResult.body[1]} * `, * }); * ``` * * ## Import * * This resource does not support import. */ export declare class Workflow extends pulumi.CustomResource { /** * Get an existing Workflow 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?: WorkflowState, opts?: pulumi.CustomResourceOptions): Workflow; /** * Returns true if the given object is an instance of Workflow. 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 Workflow; /** * Describes the level of platform logging to apply to calls and call responses during * executions of this workflow. If both the workflow and the execution specify a logging level, * the execution level takes precedence. * Possible values are: `CALL_LOG_LEVEL_UNSPECIFIED`, `LOG_ALL_CALLS`, `LOG_ERRORS_ONLY`, `LOG_NONE`. */ readonly callLogLevel: pulumi.Output<string | undefined>; /** * The timestamp of when the workflow was created in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. */ readonly createTime: pulumi.Output<string>; /** * The KMS key used to encrypt workflow and execution data. * Format: projects/{project}/locations/{location}/keyRings/{keyRing}/cryptoKeys/{cryptoKey} */ readonly cryptoKeyName: pulumi.Output<string | undefined>; readonly deletionProtection: pulumi.Output<boolean | undefined>; /** * Description of the workflow provided by the user. Must be at most 1000 unicode characters long. */ readonly description: pulumi.Output<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; }>; /** * Describes the level of execution history to be stored for this workflow. This configuration * determines how much information about workflow executions is preserved. If not specified, * defaults to EXECUTION_HISTORY_LEVEL_UNSPECIFIED. * Possible values are: `EXECUTION_HISTORY_LEVEL_UNSPECIFIED`, `EXECUTION_HISTORY_BASIC`, `EXECUTION_HISTORY_DETAILED`. */ readonly executionHistoryLevel: pulumi.Output<string | undefined>; /** * A set of key/value label pairs to assign to this Workflow. * * **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>; /** * Name of the Workflow. */ readonly name: pulumi.Output<string>; /** * Creates a unique name beginning with the * specified prefix. If this and name are unspecified, a random value is chosen for the name. */ readonly namePrefix: 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>; /** * The combination of labels configured directly on the resource * and default labels configured on the provider. */ readonly pulumiLabels: pulumi.Output<{ [key: string]: string; }>; /** * The region of the workflow. */ readonly region: pulumi.Output<string | undefined>; /** * The revision of the workflow. A new one is generated if the service account or source contents is changed. */ readonly revisionId: pulumi.Output<string>; /** * Name of the service account associated with the latest workflow version. This service * account represents the identity of the workflow and determines what permissions the workflow has. * Format: projects/{project}/serviceAccounts/{account} or {account}. * Using - as a wildcard for the {project} or not providing one at all will infer the project from the account. * The {account} value can be the email address or the uniqueId of the service account. * If not provided, workflow will use the project's default service account. * Modifying this field for an existing workflow results in a new workflow revision. */ readonly serviceAccount: pulumi.Output<string>; /** * Workflow code to be executed. The size limit is 128KB. */ readonly sourceContents: pulumi.Output<string | undefined>; /** * State of the workflow deployment. */ readonly state: pulumi.Output<string>; /** * A map of resource manager tags. Resource manager tag keys and values have the same definition * as resource manager tags. Keys must be in the format tagKeys/{tag_key_id}, and values are in * the format tagValues/456. The field is ignored (both PUT & PATCH) when empty. */ readonly tags: pulumi.Output<{ [key: string]: string; } | undefined>; /** * The timestamp of when the workflow was last updated in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. */ readonly updateTime: pulumi.Output<string>; /** * User-defined environment variables associated with this workflow revision. This map has a maximum length of 20. Each string can take up to 4KiB. Keys cannot be empty strings and cannot start with "GOOGLE" or "WORKFLOWS". */ readonly userEnvVars: pulumi.Output<{ [key: string]: string; } | undefined>; /** * Create a Workflow 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?: WorkflowArgs, opts?: pulumi.CustomResourceOptions); } /** * Input properties used for looking up and filtering Workflow resources. */ export interface WorkflowState { /** * Describes the level of platform logging to apply to calls and call responses during * executions of this workflow. If both the workflow and the execution specify a logging level, * the execution level takes precedence. * Possible values are: `CALL_LOG_LEVEL_UNSPECIFIED`, `LOG_ALL_CALLS`, `LOG_ERRORS_ONLY`, `LOG_NONE`. */ callLogLevel?: pulumi.Input<string>; /** * The timestamp of when the workflow was created in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. */ createTime?: pulumi.Input<string>; /** * The KMS key used to encrypt workflow and execution data. * Format: projects/{project}/locations/{location}/keyRings/{keyRing}/cryptoKeys/{cryptoKey} */ cryptoKeyName?: pulumi.Input<string>; deletionProtection?: pulumi.Input<boolean>; /** * Description of the workflow provided by the user. Must be at most 1000 unicode characters long. */ description?: pulumi.Input<string>; /** * 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>; }>; /** * Describes the level of execution history to be stored for this workflow. This configuration * determines how much information about workflow executions is preserved. If not specified, * defaults to EXECUTION_HISTORY_LEVEL_UNSPECIFIED. * Possible values are: `EXECUTION_HISTORY_LEVEL_UNSPECIFIED`, `EXECUTION_HISTORY_BASIC`, `EXECUTION_HISTORY_DETAILED`. */ executionHistoryLevel?: pulumi.Input<string>; /** * A set of key/value label pairs to assign to this Workflow. * * **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>; }>; /** * Name of the Workflow. */ name?: pulumi.Input<string>; /** * Creates a unique name beginning with the * specified prefix. If this and name are unspecified, a random value is chosen for the name. */ namePrefix?: 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>; /** * The combination of labels configured directly on the resource * and default labels configured on the provider. */ pulumiLabels?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * The region of the workflow. */ region?: pulumi.Input<string>; /** * The revision of the workflow. A new one is generated if the service account or source contents is changed. */ revisionId?: pulumi.Input<string>; /** * Name of the service account associated with the latest workflow version. This service * account represents the identity of the workflow and determines what permissions the workflow has. * Format: projects/{project}/serviceAccounts/{account} or {account}. * Using - as a wildcard for the {project} or not providing one at all will infer the project from the account. * The {account} value can be the email address or the uniqueId of the service account. * If not provided, workflow will use the project's default service account. * Modifying this field for an existing workflow results in a new workflow revision. */ serviceAccount?: pulumi.Input<string>; /** * Workflow code to be executed. The size limit is 128KB. */ sourceContents?: pulumi.Input<string>; /** * State of the workflow deployment. */ state?: pulumi.Input<string>; /** * A map of resource manager tags. Resource manager tag keys and values have the same definition * as resource manager tags. Keys must be in the format tagKeys/{tag_key_id}, and values are in * the format tagValues/456. The field is ignored (both PUT & PATCH) when empty. */ tags?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * The timestamp of when the workflow was last updated in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits. */ updateTime?: pulumi.Input<string>; /** * User-defined environment variables associated with this workflow revision. This map has a maximum length of 20. Each string can take up to 4KiB. Keys cannot be empty strings and cannot start with "GOOGLE" or "WORKFLOWS". */ userEnvVars?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; } /** * The set of arguments for constructing a Workflow resource. */ export interface WorkflowArgs { /** * Describes the level of platform logging to apply to calls and call responses during * executions of this workflow. If both the workflow and the execution specify a logging level, * the execution level takes precedence. * Possible values are: `CALL_LOG_LEVEL_UNSPECIFIED`, `LOG_ALL_CALLS`, `LOG_ERRORS_ONLY`, `LOG_NONE`. */ callLogLevel?: pulumi.Input<string>; /** * The KMS key used to encrypt workflow and execution data. * Format: projects/{project}/locations/{location}/keyRings/{keyRing}/cryptoKeys/{cryptoKey} */ cryptoKeyName?: pulumi.Input<string>; deletionProtection?: pulumi.Input<boolean>; /** * Description of the workflow provided by the user. Must be at most 1000 unicode characters long. */ description?: pulumi.Input<string>; /** * Describes the level of execution history to be stored for this workflow. This configuration * determines how much information about workflow executions is preserved. If not specified, * defaults to EXECUTION_HISTORY_LEVEL_UNSPECIFIED. * Possible values are: `EXECUTION_HISTORY_LEVEL_UNSPECIFIED`, `EXECUTION_HISTORY_BASIC`, `EXECUTION_HISTORY_DETAILED`. */ executionHistoryLevel?: pulumi.Input<string>; /** * A set of key/value label pairs to assign to this Workflow. * * **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>; }>; /** * Name of the Workflow. */ name?: pulumi.Input<string>; /** * Creates a unique name beginning with the * specified prefix. If this and name are unspecified, a random value is chosen for the name. */ namePrefix?: 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>; /** * The region of the workflow. */ region?: pulumi.Input<string>; /** * Name of the service account associated with the latest workflow version. This service * account represents the identity of the workflow and determines what permissions the workflow has. * Format: projects/{project}/serviceAccounts/{account} or {account}. * Using - as a wildcard for the {project} or not providing one at all will infer the project from the account. * The {account} value can be the email address or the uniqueId of the service account. * If not provided, workflow will use the project's default service account. * Modifying this field for an existing workflow results in a new workflow revision. */ serviceAccount?: pulumi.Input<string>; /** * Workflow code to be executed. The size limit is 128KB. */ sourceContents?: pulumi.Input<string>; /** * A map of resource manager tags. Resource manager tag keys and values have the same definition * as resource manager tags. Keys must be in the format tagKeys/{tag_key_id}, and values are in * the format tagValues/456. The field is ignored (both PUT & PATCH) when empty. */ tags?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; /** * User-defined environment variables associated with this workflow revision. This map has a maximum length of 20. Each string can take up to 4KiB. Keys cannot be empty strings and cannot start with "GOOGLE" or "WORKFLOWS". */ userEnvVars?: pulumi.Input<{ [key: string]: pulumi.Input<string>; }>; }