Workflow class

Workflow program to be executed by Workflows.

To get more information about Workflow, see:

Example Usage

Workflow Basic

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]}
`,
});
import pulumi
import pulumi_gcp as gcp

test_account = gcp.serviceaccount.Account("test_account",
    account_id="my-account",
    display_name="Test Service Account")
example = gcp.workflows.Workflow("example",
    name="workflow",
    region="us-central1",
    description="Magic",
    service_account=test_account.id,
    call_log_level="LOG_ERRORS_ONLY",
    labels={
        "env": "test",
    },
    user_env_vars={
        "url": "https://timeapi.io/api/Time/current/zone?timeZone=Europe/Amsterdam",
    },
    deletion_protection=False,
    source_contents="""# 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]}
""")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() =>
{
    var testAccount = new Gcp.ServiceAccount.Account("test_account", new()
    {
        AccountId = "my-account",
        DisplayName = "Test Service Account",
    });

    var example = new Gcp.Workflows.Workflow("example", new()
    {
        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]}
",
    });

});
package main

import (
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/serviceaccount"
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/workflows"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		testAccount, err := serviceaccount.NewAccount(ctx, "test_account", &serviceaccount.AccountArgs{
			AccountId:   pulumi.String("my-account"),
			DisplayName: pulumi.String("Test Service Account"),
		})
		if err != nil {
			return err
		}
		_, err = workflows.NewWorkflow(ctx, "example", &workflows.WorkflowArgs{
			Name:           pulumi.String("workflow"),
			Region:         pulumi.String("us-central1"),
			Description:    pulumi.String("Magic"),
			ServiceAccount: testAccount.ID().ToIDOutput().ToStringOutput(),
			CallLogLevel:   pulumi.String("LOG_ERRORS_ONLY"),
			Labels: pulumi.StringMap{
				"env": pulumi.String("test"),
			},
			UserEnvVars: pulumi.StringMap{
				"url": pulumi.String("https://timeapi.io/api/Time/current/zone?timeZone=Europe/Amsterdam"),
			},
			DeletionProtection: pulumi.Bool(false),
			SourceContents: pulumi.String(`# 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]}
`),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
pulumi {
  required_providers {
    gcp = {
      source = "pulumi/gcp"
    }
  }
}

resource "gcp_serviceaccount_account" "test_account" {
  account_id   = "my-account"
  display_name = "Test Service Account"
}
resource "gcp_workflows_workflow" "example" {
  name            = "workflow"
  region          = "us-central1"
  description     = "Magic"
  service_account = gcp_serviceaccount_account.test_account.id
  call_log_level  = "LOG_ERRORS_ONLY"
  labels = {
    "env" = "test"
  }
  user_env_vars = {
    "url" = "https://timeapi.io/api/Time/current/zone?timeZone=Europe/Amsterdam"
  }
  deletion_protection = false
  source_contents     = "# This is a sample workflow. You can replace it with your source code.\n#\n# This workflow does the following:\n# - reads current time and date information from an external API and stores\n#   the response in currentTime variable\n# - retrieves a list of Wikipedia articles related to the day of the week\n#   from currentTime\n# - returns the list of articles as an output of the workflow\n#\n# Note: In Terraform you need to escape the $$ or it will cause errors.\n\n- getCurrentTime:\n    call: http.get\n    args:\n        url: $${sys.get_env(\\\"url\\\")}\n    result: currentTime\n- readWikipedia:\n    call: http.get\n    args:\n        url: https://en.wikipedia.org/w/api.php\n        query:\n            action: opensearch\n            search: $${currentTime.body.dayOfWeek}\n    result: wikiResult\n- returnOutput:\n    return: $${wikiResult.body[1]}\n"
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.serviceaccount.Account;
import com.pulumi.gcp.serviceaccount.AccountArgs;
import com.pulumi.gcp.workflows.Workflow;
import com.pulumi.gcp.workflows.WorkflowArgs;
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 testAccount = new Account("testAccount", AccountArgs.builder()
            .accountId("my-account")
            .displayName("Test Service Account")
            .build());

        var example = new Workflow("example", WorkflowArgs.builder()
            .name("workflow")
            .region("us-central1")
            .description("Magic")
            .serviceAccount(testAccount.id())
            .callLogLevel("LOG_ERRORS_ONLY")
            .labels(Map.of("env", "test"))
            .userEnvVars(Map.of("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]}
            """)
            .build());

    }
}
resources:
  testAccount:
    type: gcp:serviceaccount:Account
    name: test_account
    properties:
      accountId: my-account
      displayName: Test Service Account
  example:
    type: gcp:workflows:Workflow
    properties:
      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

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 pulumi
import pulumi_gcp as gcp

project = gcp.organizations.get_project()
tag_key = gcp.tags.TagKey("tag_key",
    parent=f"projects/{project.number}",
    short_name="tag_key")
tag_value = gcp.tags.TagValue("tag_value",
    parent=tag_key.name.apply(lambda name: f"tagKeys/{name}"),
    short_name="tag_value")
test_account = gcp.serviceaccount.Account("test_account",
    account_id="my-account",
    display_name="Test Service Account")
example = gcp.workflows.Workflow("example",
    name="workflow",
    region="us-central1",
    description="Magic",
    service_account=test_account.id,
    deletion_protection=False,
    tags=pulumi.Output.all(
        tagKeyShort_name=tag_key.short_name,
        tagValueShort_name=tag_value.short_name
).apply(lambda resolved_outputs: {
        f"{project.project_id}/{resolved_outputs['tagKeyShort_name']}": resolved_outputs['tagValueShort_name'],
    })
,
    source_contents="""# 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]}
""")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;

return await Deployment.RunAsync(() =>
{
    var project = Gcp.Organizations.GetProject.Invoke();

    var tagKey = new Gcp.Tags.TagKey("tag_key", new()
    {
        Parent = $"projects/{project.Apply(getProjectResult => getProjectResult.Number)}",
        ShortName = "tag_key",
    });

    var tagValue = new Gcp.Tags.TagValue("tag_value", new()
    {
        Parent = tagKey.Name.Apply(name => $"tagKeys/{name}"),
        ShortName = "tag_value",
    });

    var testAccount = new Gcp.ServiceAccount.Account("test_account", new()
    {
        AccountId = "my-account",
        DisplayName = "Test Service Account",
    });

    var example = new Gcp.Workflows.Workflow("example", new()
    {
        Name = "workflow",
        Region = "us-central1",
        Description = "Magic",
        ServiceAccount = testAccount.Id,
        DeletionProtection = false,
        Tags = Output.Tuple(project, tagKey.ShortName, tagValue.ShortName).Apply(values =>
        {
            var project = values.Item1;
            var tagKeyShortName = values.Item2;
            var tagValueShortName = values.Item3;
            return
            {
                { $"{project.Apply(getProjectResult => getProjectResult.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]}
",
    });

});
package main

import (
	"fmt"

	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/organizations"
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/serviceaccount"
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/tags"
	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/workflows"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
project, err := organizations.LookupProject(ctx, &organizations.LookupProjectArgs{
}, nil);
if err != nil {
return err
}
tagKey, err := tags.NewTagKey(ctx, "tag_key", &tags.TagKeyArgs{
Parent: pulumi.Sprintf("projects/%v", project.Number),
ShortName: pulumi.String("tag_key"),
})
if err != nil {
return err
}
tagValue, err := tags.NewTagValue(ctx, "tag_value", &tags.TagValueArgs{
Parent: tagKey.Name.ApplyT(func(name string) (string, error) {
return fmt.Sprintf("tagKeys/%v", name), nil
}).(pulumi.StringOutput),
ShortName: pulumi.String("tag_value"),
})
if err != nil {
return err
}
testAccount, err := serviceaccount.NewAccount(ctx, "test_account", &serviceaccount.AccountArgs{
AccountId: pulumi.String("my-account"),
DisplayName: pulumi.String("Test Service Account"),
})
if err != nil {
return err
}
_, err = workflows.NewWorkflow(ctx, "example", &workflows.WorkflowArgs{
Name: pulumi.String("workflow"),
Region: pulumi.String("us-central1"),
Description: pulumi.String("Magic"),
ServiceAccount: testAccount.ID().ToIDOutput().ToStringOutput(),
DeletionProtection: pulumi.Bool(false),
Tags: pulumi.All(tagKey.ShortName,tagValue.ShortName).ApplyT(func(_args []interface{}) (map[string]string, error) {
tagKeyShortName := _args[0].(string)
tagValueShortName := _args[1].(string)
return map[string]string{
fmt.Sprintf("%v/%v", project.ProjectId, tagKeyShortName): tagValueShortName,
}, nil
}).(pulumi.Map[string]stringOutput),
SourceContents: pulumi.String(`# 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]}
`),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
  required_providers {
    gcp = {
      source = "pulumi/gcp"
    }
  }
}

data "gcp_organizations_getproject" "project" {
}

resource "gcp_tags_tagkey" "tag_key" {
  parent     ="projects/${data.gcp_organizations_getproject.project.number}"
  short_name = "tag_key"
}
resource "gcp_tags_tagvalue" "tag_value" {
  parent     ="tagKeys/${gcp_tags_tagkey.tag_key.name}"
  short_name = "tag_value"
}
resource "gcp_serviceaccount_account" "test_account" {
  account_id   = "my-account"
  display_name = "Test Service Account"
}
resource "gcp_workflows_workflow" "example" {
  name                = "workflow"
  region              = "us-central1"
  description         = "Magic"
  service_account     = gcp_serviceaccount_account.test_account.id
  deletion_protection = false
  tags = {
    "${data.gcp_organizations_getproject.project.project_id}/${gcp_tags_tagkey.tag_key.short_name}" = gcp_tags_tagvalue.tag_value.short_name
  }
  source_contents = "# This is a sample workflow. You can replace it with your source code.\n#\n# This workflow does the following:\n# - reads current time and date information from an external API and stores\n#   the response in currentTime variable\n# - retrieves a list of Wikipedia articles related to the day of the week\n#   from currentTime\n# - returns the list of articles as an output of the workflow\n#\n# Note: In Terraform you need to escape the $$ or it will cause errors.\n\n- getCurrentTime:\n    call: http.get\n    args:\n        url: $${sys.get_env(\\\"url\\\")}\n    result: currentTime\n- readWikipedia:\n    call: http.get\n    args:\n        url: https://en.wikipedia.org/w/api.php\n        query:\n            action: opensearch\n            search: $${currentTime.body.dayOfWeek}\n    result: wikiResult\n- returnOutput:\n    return: $${wikiResult.body[1]}\n"
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.organizations.OrganizationsFunctions;
import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
import com.pulumi.gcp.tags.TagKey;
import com.pulumi.gcp.tags.TagKeyArgs;
import com.pulumi.gcp.tags.TagValue;
import com.pulumi.gcp.tags.TagValueArgs;
import com.pulumi.gcp.serviceaccount.Account;
import com.pulumi.gcp.serviceaccount.AccountArgs;
import com.pulumi.gcp.workflows.Workflow;
import com.pulumi.gcp.workflows.WorkflowArgs;
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) {
        final var project = OrganizationsFunctions.getProject(GetProjectArgs.builder()
            .build());

        var tagKey = new TagKey("tagKey", TagKeyArgs.builder()
            .parent(String.format("projects/%s", project.number()))
            .shortName("tag_key")
            .build());

        var tagValue = new TagValue("tagValue", TagValueArgs.builder()
            .parent(tagKey.name().applyValue(_name -> String.format("tagKeys/%s", _name)))
            .shortName("tag_value")
            .build());

        var testAccount = new Account("testAccount", AccountArgs.builder()
            .accountId("my-account")
            .displayName("Test Service Account")
            .build());

        var example = new Workflow("example", WorkflowArgs.builder()
            .name("workflow")
            .region("us-central1")
            .description("Magic")
            .serviceAccount(testAccount.id())
            .deletionProtection(false)
            .tags(Output.tuple(tagKey.shortName(), tagValue.shortName()).applyValue(values -> {
                var tagKeyShortName = values.t1;
                var tagValueShortName = values.t2;
                return Map.of(String.format("%s/%s", 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]}
            """)
            .build());

    }
}
resources:
  tagKey:
    type: gcp:tags:TagKey
    name: tag_key
    properties:
      parent: projects/${project.number}
      shortName: tag_key
  tagValue:
    type: gcp:tags:TagValue
    name: tag_value
    properties:
      parent: tagKeys/${tagKey.name}
      shortName: tag_value
  testAccount:
    type: gcp:serviceaccount:Account
    name: test_account
    properties:
      accountId: my-account
      displayName: Test Service Account
  example:
    type: gcp:workflows:Workflow
    properties:
      name: workflow
      region: us-central1
      description: Magic
      serviceAccount: ${testAccount.id}
      deletionProtection: false
      tags:
        ${project.projectId}/${tagKey.shortName}: ${tagValue.shortName}
      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]}
variables:
  project:
    fn::invoke:
      function: gcp:organizations:getProject
      arguments: {}

Import

This resource does not support import.

Constructors

Workflow(String name, {WorkflowArgs? args, CustomResourceOptions? options})
Creates a new Workflow. name The Pulumi resource name. args Arguments used to configure this Workflow. The set of arguments for Workflow. options Resource options controlling this resource's behavior.
Workflow.reference(String urn)
Creates a typed reference to an existing Workflow resource.

Properties

callLogLevel ↔ Output<String?>
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.
latefinal
childResources → Set<Resource>
finalinherited
completionSources ↔ Map<String, IOutputCompletionSource>
latefinalinherited
createTime ↔ Output<String>
The timestamp of when the workflow was created in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits.
latefinal
cryptoKeyName ↔ Output<String?>
The KMS key used to encrypt workflow and execution data. Format: projects/{project}/locations/{location}/keyRings/{keyRing}/cryptoKeys/{cryptoKey}
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
deletionProtection ↔ Output<bool?>
Whether Terraform will be prevented from destroying the workflow. Defaults to true. When aterraform destroy or pulumi up would delete the workflow, the command will fail if this field is not set to false in Terraform state. When the field is set to true or unset in Terraform state, a pulumi up or terraform destroy that would delete the workflow will fail. When the field is set to false, deleting the workflow is allowed.
latefinal
description ↔ Output<String>
Description of the workflow provided by the user. Must be at most 1000 unicode characters long.
latefinal
effectiveLabels ↔ Output<Map<String, String>>
All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
latefinal
executionHistoryLevel ↔ Output<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.
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
labels ↔ Output<Map<String, String>?>
A set of key/value label pairs to assign to this Workflow.
latefinal
name ↔ Output<String>
Name of the Workflow.
latefinal
namePrefix ↔ 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.
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
pulumiLabels ↔ Output<Map<String, String>>
The combination of labels configured directly on the resource and default labels configured on the provider.
latefinal
region ↔ Output<String?>
The region of the workflow.
latefinal
resourceTransforms → List<ResourceTransform>
Inherited/explicit async transforms.
no setterinherited
revisionId ↔ Output<String>
The revision of the workflow. A new one is generated if the service account or source contents is changed.
latefinal
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
serviceAccount ↔ 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.
latefinal
sourceContents ↔ Output<String?>
Workflow code to be executed. The size limit is 128KB. > Warning: This field is currently optional but will become REQUIRED in version 8.0.0 of the provider to align with API constraints.
latefinal
state ↔ Output<String>
State of the workflow deployment.
latefinal
tags ↔ Output<Map<String, 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.
latefinal
transformations → List<ResourceTransformation>
Inherited/explicit legacy transformations.
no setterinherited
updateTime ↔ Output<String>
The timestamp of when the workflow was last updated in RFC3339 UTC "Zulu" format, with nanosecond resolution and up to nine fractional digits.
latefinal
urn ↔ Output<String>
latefinalinherited
userEnvVars ↔ Output<Map<String, 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".
latefinal

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, {WorkflowState? state, CustomResourceOptions? options}) → Workflow
Gets an existing Workflow resource's state with the given name and id.