gcp.pubsub.Subscription
Explore with Pulumi AI
A named resource representing the stream of messages from a single, specific topic, to be delivered to the subscribing application.
To get more information about Subscription, see:
- API documentation
- How-to Guides
Note: You can retrieve the email of the Google Managed Pub/Sub Service Account used for forwarding by using the
gcp.projects.ServiceIdentity
resource.
Example Usage
Pubsub Subscription Push
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const example = new gcp.pubsub.Topic("example", {name: "example-topic"});
const exampleSubscription = new gcp.pubsub.Subscription("example", {
name: "example-subscription",
topic: example.id,
ackDeadlineSeconds: 20,
labels: {
foo: "bar",
},
pushConfig: {
pushEndpoint: "https://example.com/push",
attributes: {
"x-goog-version": "v1",
},
},
});
import pulumi
import pulumi_gcp as gcp
example = gcp.pubsub.Topic("example", name="example-topic")
example_subscription = gcp.pubsub.Subscription("example",
name="example-subscription",
topic=example.id,
ack_deadline_seconds=20,
labels={
"foo": "bar",
},
push_config=gcp.pubsub.SubscriptionPushConfigArgs(
push_endpoint="https://example.com/push",
attributes={
"x-goog-version": "v1",
},
))
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/pubsub"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := pubsub.NewTopic(ctx, "example", &pubsub.TopicArgs{
Name: pulumi.String("example-topic"),
})
if err != nil {
return err
}
_, err = pubsub.NewSubscription(ctx, "example", &pubsub.SubscriptionArgs{
Name: pulumi.String("example-subscription"),
Topic: example.ID(),
AckDeadlineSeconds: pulumi.Int(20),
Labels: pulumi.StringMap{
"foo": pulumi.String("bar"),
},
PushConfig: &pubsub.SubscriptionPushConfigArgs{
PushEndpoint: pulumi.String("https://example.com/push"),
Attributes: pulumi.StringMap{
"x-goog-version": pulumi.String("v1"),
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var example = new Gcp.PubSub.Topic("example", new()
{
Name = "example-topic",
});
var exampleSubscription = new Gcp.PubSub.Subscription("example", new()
{
Name = "example-subscription",
Topic = example.Id,
AckDeadlineSeconds = 20,
Labels =
{
{ "foo", "bar" },
},
PushConfig = new Gcp.PubSub.Inputs.SubscriptionPushConfigArgs
{
PushEndpoint = "https://example.com/push",
Attributes =
{
{ "x-goog-version", "v1" },
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.pubsub.Topic;
import com.pulumi.gcp.pubsub.TopicArgs;
import com.pulumi.gcp.pubsub.Subscription;
import com.pulumi.gcp.pubsub.SubscriptionArgs;
import com.pulumi.gcp.pubsub.inputs.SubscriptionPushConfigArgs;
import java.util.List;
import java.util.ArrayList;
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 example = new Topic("example", TopicArgs.builder()
.name("example-topic")
.build());
var exampleSubscription = new Subscription("exampleSubscription", SubscriptionArgs.builder()
.name("example-subscription")
.topic(example.id())
.ackDeadlineSeconds(20)
.labels(Map.of("foo", "bar"))
.pushConfig(SubscriptionPushConfigArgs.builder()
.pushEndpoint("https://example.com/push")
.attributes(Map.of("x-goog-version", "v1"))
.build())
.build());
}
}
resources:
example:
type: gcp:pubsub:Topic
properties:
name: example-topic
exampleSubscription:
type: gcp:pubsub:Subscription
name: example
properties:
name: example-subscription
topic: ${example.id}
ackDeadlineSeconds: 20
labels:
foo: bar
pushConfig:
pushEndpoint: https://example.com/push
attributes:
x-goog-version: v1
Pubsub Subscription Pull
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const example = new gcp.pubsub.Topic("example", {name: "example-topic"});
const exampleSubscription = new gcp.pubsub.Subscription("example", {
name: "example-subscription",
topic: example.id,
labels: {
foo: "bar",
},
messageRetentionDuration: "1200s",
retainAckedMessages: true,
ackDeadlineSeconds: 20,
expirationPolicy: {
ttl: "300000.5s",
},
retryPolicy: {
minimumBackoff: "10s",
},
enableMessageOrdering: false,
});
import pulumi
import pulumi_gcp as gcp
example = gcp.pubsub.Topic("example", name="example-topic")
example_subscription = gcp.pubsub.Subscription("example",
name="example-subscription",
topic=example.id,
labels={
"foo": "bar",
},
message_retention_duration="1200s",
retain_acked_messages=True,
ack_deadline_seconds=20,
expiration_policy=gcp.pubsub.SubscriptionExpirationPolicyArgs(
ttl="300000.5s",
),
retry_policy=gcp.pubsub.SubscriptionRetryPolicyArgs(
minimum_backoff="10s",
),
enable_message_ordering=False)
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/pubsub"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := pubsub.NewTopic(ctx, "example", &pubsub.TopicArgs{
Name: pulumi.String("example-topic"),
})
if err != nil {
return err
}
_, err = pubsub.NewSubscription(ctx, "example", &pubsub.SubscriptionArgs{
Name: pulumi.String("example-subscription"),
Topic: example.ID(),
Labels: pulumi.StringMap{
"foo": pulumi.String("bar"),
},
MessageRetentionDuration: pulumi.String("1200s"),
RetainAckedMessages: pulumi.Bool(true),
AckDeadlineSeconds: pulumi.Int(20),
ExpirationPolicy: &pubsub.SubscriptionExpirationPolicyArgs{
Ttl: pulumi.String("300000.5s"),
},
RetryPolicy: &pubsub.SubscriptionRetryPolicyArgs{
MinimumBackoff: pulumi.String("10s"),
},
EnableMessageOrdering: pulumi.Bool(false),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var example = new Gcp.PubSub.Topic("example", new()
{
Name = "example-topic",
});
var exampleSubscription = new Gcp.PubSub.Subscription("example", new()
{
Name = "example-subscription",
Topic = example.Id,
Labels =
{
{ "foo", "bar" },
},
MessageRetentionDuration = "1200s",
RetainAckedMessages = true,
AckDeadlineSeconds = 20,
ExpirationPolicy = new Gcp.PubSub.Inputs.SubscriptionExpirationPolicyArgs
{
Ttl = "300000.5s",
},
RetryPolicy = new Gcp.PubSub.Inputs.SubscriptionRetryPolicyArgs
{
MinimumBackoff = "10s",
},
EnableMessageOrdering = false,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.pubsub.Topic;
import com.pulumi.gcp.pubsub.TopicArgs;
import com.pulumi.gcp.pubsub.Subscription;
import com.pulumi.gcp.pubsub.SubscriptionArgs;
import com.pulumi.gcp.pubsub.inputs.SubscriptionExpirationPolicyArgs;
import com.pulumi.gcp.pubsub.inputs.SubscriptionRetryPolicyArgs;
import java.util.List;
import java.util.ArrayList;
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 example = new Topic("example", TopicArgs.builder()
.name("example-topic")
.build());
var exampleSubscription = new Subscription("exampleSubscription", SubscriptionArgs.builder()
.name("example-subscription")
.topic(example.id())
.labels(Map.of("foo", "bar"))
.messageRetentionDuration("1200s")
.retainAckedMessages(true)
.ackDeadlineSeconds(20)
.expirationPolicy(SubscriptionExpirationPolicyArgs.builder()
.ttl("300000.5s")
.build())
.retryPolicy(SubscriptionRetryPolicyArgs.builder()
.minimumBackoff("10s")
.build())
.enableMessageOrdering(false)
.build());
}
}
resources:
example:
type: gcp:pubsub:Topic
properties:
name: example-topic
exampleSubscription:
type: gcp:pubsub:Subscription
name: example
properties:
name: example-subscription
topic: ${example.id}
labels:
foo: bar
messageRetentionDuration: 1200s
retainAckedMessages: true
ackDeadlineSeconds: 20
expirationPolicy:
ttl: 300000.5s
retryPolicy:
minimumBackoff: 10s
enableMessageOrdering: false
Pubsub Subscription Dead Letter
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const example = new gcp.pubsub.Topic("example", {name: "example-topic"});
const exampleDeadLetter = new gcp.pubsub.Topic("example_dead_letter", {name: "example-topic-dead-letter"});
const exampleSubscription = new gcp.pubsub.Subscription("example", {
name: "example-subscription",
topic: example.id,
deadLetterPolicy: {
deadLetterTopic: exampleDeadLetter.id,
maxDeliveryAttempts: 10,
},
});
import pulumi
import pulumi_gcp as gcp
example = gcp.pubsub.Topic("example", name="example-topic")
example_dead_letter = gcp.pubsub.Topic("example_dead_letter", name="example-topic-dead-letter")
example_subscription = gcp.pubsub.Subscription("example",
name="example-subscription",
topic=example.id,
dead_letter_policy=gcp.pubsub.SubscriptionDeadLetterPolicyArgs(
dead_letter_topic=example_dead_letter.id,
max_delivery_attempts=10,
))
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/pubsub"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := pubsub.NewTopic(ctx, "example", &pubsub.TopicArgs{
Name: pulumi.String("example-topic"),
})
if err != nil {
return err
}
exampleDeadLetter, err := pubsub.NewTopic(ctx, "example_dead_letter", &pubsub.TopicArgs{
Name: pulumi.String("example-topic-dead-letter"),
})
if err != nil {
return err
}
_, err = pubsub.NewSubscription(ctx, "example", &pubsub.SubscriptionArgs{
Name: pulumi.String("example-subscription"),
Topic: example.ID(),
DeadLetterPolicy: &pubsub.SubscriptionDeadLetterPolicyArgs{
DeadLetterTopic: exampleDeadLetter.ID(),
MaxDeliveryAttempts: pulumi.Int(10),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var example = new Gcp.PubSub.Topic("example", new()
{
Name = "example-topic",
});
var exampleDeadLetter = new Gcp.PubSub.Topic("example_dead_letter", new()
{
Name = "example-topic-dead-letter",
});
var exampleSubscription = new Gcp.PubSub.Subscription("example", new()
{
Name = "example-subscription",
Topic = example.Id,
DeadLetterPolicy = new Gcp.PubSub.Inputs.SubscriptionDeadLetterPolicyArgs
{
DeadLetterTopic = exampleDeadLetter.Id,
MaxDeliveryAttempts = 10,
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.pubsub.Topic;
import com.pulumi.gcp.pubsub.TopicArgs;
import com.pulumi.gcp.pubsub.Subscription;
import com.pulumi.gcp.pubsub.SubscriptionArgs;
import com.pulumi.gcp.pubsub.inputs.SubscriptionDeadLetterPolicyArgs;
import java.util.List;
import java.util.ArrayList;
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 example = new Topic("example", TopicArgs.builder()
.name("example-topic")
.build());
var exampleDeadLetter = new Topic("exampleDeadLetter", TopicArgs.builder()
.name("example-topic-dead-letter")
.build());
var exampleSubscription = new Subscription("exampleSubscription", SubscriptionArgs.builder()
.name("example-subscription")
.topic(example.id())
.deadLetterPolicy(SubscriptionDeadLetterPolicyArgs.builder()
.deadLetterTopic(exampleDeadLetter.id())
.maxDeliveryAttempts(10)
.build())
.build());
}
}
resources:
example:
type: gcp:pubsub:Topic
properties:
name: example-topic
exampleDeadLetter:
type: gcp:pubsub:Topic
name: example_dead_letter
properties:
name: example-topic-dead-letter
exampleSubscription:
type: gcp:pubsub:Subscription
name: example
properties:
name: example-subscription
topic: ${example.id}
deadLetterPolicy:
deadLetterTopic: ${exampleDeadLetter.id}
maxDeliveryAttempts: 10
Pubsub Subscription Push Bq
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const example = new gcp.pubsub.Topic("example", {name: "example-topic"});
const project = gcp.organizations.getProject({});
const viewer = new gcp.projects.IAMMember("viewer", {
project: project.then(project => project.projectId),
role: "roles/bigquery.metadataViewer",
member: project.then(project => `serviceAccount:service-${project.number}@gcp-sa-pubsub.iam.gserviceaccount.com`),
});
const editor = new gcp.projects.IAMMember("editor", {
project: project.then(project => project.projectId),
role: "roles/bigquery.dataEditor",
member: project.then(project => `serviceAccount:service-${project.number}@gcp-sa-pubsub.iam.gserviceaccount.com`),
});
const test = new gcp.bigquery.Dataset("test", {datasetId: "example_dataset"});
const testTable = new gcp.bigquery.Table("test", {
deletionProtection: false,
tableId: "example_table",
datasetId: test.datasetId,
schema: `[
{
"name": "data",
"type": "STRING",
"mode": "NULLABLE",
"description": "The data"
}
]
`,
});
const exampleSubscription = new gcp.pubsub.Subscription("example", {
name: "example-subscription",
topic: example.id,
bigqueryConfig: {
table: pulumi.interpolate`${testTable.project}.${testTable.datasetId}.${testTable.tableId}`,
},
}, {
dependsOn: [
viewer,
editor,
],
});
import pulumi
import pulumi_gcp as gcp
example = gcp.pubsub.Topic("example", name="example-topic")
project = gcp.organizations.get_project()
viewer = gcp.projects.IAMMember("viewer",
project=project.project_id,
role="roles/bigquery.metadataViewer",
member=f"serviceAccount:service-{project.number}@gcp-sa-pubsub.iam.gserviceaccount.com")
editor = gcp.projects.IAMMember("editor",
project=project.project_id,
role="roles/bigquery.dataEditor",
member=f"serviceAccount:service-{project.number}@gcp-sa-pubsub.iam.gserviceaccount.com")
test = gcp.bigquery.Dataset("test", dataset_id="example_dataset")
test_table = gcp.bigquery.Table("test",
deletion_protection=False,
table_id="example_table",
dataset_id=test.dataset_id,
schema="""[
{
"name": "data",
"type": "STRING",
"mode": "NULLABLE",
"description": "The data"
}
]
""")
example_subscription = gcp.pubsub.Subscription("example",
name="example-subscription",
topic=example.id,
bigquery_config=gcp.pubsub.SubscriptionBigqueryConfigArgs(
table=pulumi.Output.all(test_table.project, test_table.dataset_id, test_table.table_id).apply(lambda project, dataset_id, table_id: f"{project}.{dataset_id}.{table_id}"),
),
opts = pulumi.ResourceOptions(depends_on=[
viewer,
editor,
]))
package main
import (
"fmt"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/bigquery"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/projects"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/pubsub"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := pubsub.NewTopic(ctx, "example", &pubsub.TopicArgs{
Name: pulumi.String("example-topic"),
})
if err != nil {
return err
}
project, err := organizations.LookupProject(ctx, nil, nil)
if err != nil {
return err
}
viewer, err := projects.NewIAMMember(ctx, "viewer", &projects.IAMMemberArgs{
Project: pulumi.String(project.ProjectId),
Role: pulumi.String("roles/bigquery.metadataViewer"),
Member: pulumi.String(fmt.Sprintf("serviceAccount:service-%v@gcp-sa-pubsub.iam.gserviceaccount.com", project.Number)),
})
if err != nil {
return err
}
editor, err := projects.NewIAMMember(ctx, "editor", &projects.IAMMemberArgs{
Project: pulumi.String(project.ProjectId),
Role: pulumi.String("roles/bigquery.dataEditor"),
Member: pulumi.String(fmt.Sprintf("serviceAccount:service-%v@gcp-sa-pubsub.iam.gserviceaccount.com", project.Number)),
})
if err != nil {
return err
}
test, err := bigquery.NewDataset(ctx, "test", &bigquery.DatasetArgs{
DatasetId: pulumi.String("example_dataset"),
})
if err != nil {
return err
}
testTable, err := bigquery.NewTable(ctx, "test", &bigquery.TableArgs{
DeletionProtection: pulumi.Bool(false),
TableId: pulumi.String("example_table"),
DatasetId: test.DatasetId,
Schema: pulumi.String(`[
{
"name": "data",
"type": "STRING",
"mode": "NULLABLE",
"description": "The data"
}
]
`),
})
if err != nil {
return err
}
_, err = pubsub.NewSubscription(ctx, "example", &pubsub.SubscriptionArgs{
Name: pulumi.String("example-subscription"),
Topic: example.ID(),
BigqueryConfig: &pubsub.SubscriptionBigqueryConfigArgs{
Table: pulumi.All(testTable.Project, testTable.DatasetId, testTable.TableId).ApplyT(func(_args []interface{}) (string, error) {
project := _args[0].(string)
datasetId := _args[1].(string)
tableId := _args[2].(string)
return fmt.Sprintf("%v.%v.%v", project, datasetId, tableId), nil
}).(pulumi.StringOutput),
},
}, pulumi.DependsOn([]pulumi.Resource{
viewer,
editor,
}))
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var example = new Gcp.PubSub.Topic("example", new()
{
Name = "example-topic",
});
var project = Gcp.Organizations.GetProject.Invoke();
var viewer = new Gcp.Projects.IAMMember("viewer", new()
{
Project = project.Apply(getProjectResult => getProjectResult.ProjectId),
Role = "roles/bigquery.metadataViewer",
Member = $"serviceAccount:service-{project.Apply(getProjectResult => getProjectResult.Number)}@gcp-sa-pubsub.iam.gserviceaccount.com",
});
var editor = new Gcp.Projects.IAMMember("editor", new()
{
Project = project.Apply(getProjectResult => getProjectResult.ProjectId),
Role = "roles/bigquery.dataEditor",
Member = $"serviceAccount:service-{project.Apply(getProjectResult => getProjectResult.Number)}@gcp-sa-pubsub.iam.gserviceaccount.com",
});
var test = new Gcp.BigQuery.Dataset("test", new()
{
DatasetId = "example_dataset",
});
var testTable = new Gcp.BigQuery.Table("test", new()
{
DeletionProtection = false,
TableId = "example_table",
DatasetId = test.DatasetId,
Schema = @"[
{
""name"": ""data"",
""type"": ""STRING"",
""mode"": ""NULLABLE"",
""description"": ""The data""
}
]
",
});
var exampleSubscription = new Gcp.PubSub.Subscription("example", new()
{
Name = "example-subscription",
Topic = example.Id,
BigqueryConfig = new Gcp.PubSub.Inputs.SubscriptionBigqueryConfigArgs
{
Table = Output.Tuple(testTable.Project, testTable.DatasetId, testTable.TableId).Apply(values =>
{
var project = values.Item1;
var datasetId = values.Item2;
var tableId = values.Item3;
return $"{project}.{datasetId}.{tableId}";
}),
},
}, new CustomResourceOptions
{
DependsOn =
{
viewer,
editor,
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.pubsub.Topic;
import com.pulumi.gcp.pubsub.TopicArgs;
import com.pulumi.gcp.organizations.OrganizationsFunctions;
import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
import com.pulumi.gcp.projects.IAMMember;
import com.pulumi.gcp.projects.IAMMemberArgs;
import com.pulumi.gcp.bigquery.Dataset;
import com.pulumi.gcp.bigquery.DatasetArgs;
import com.pulumi.gcp.bigquery.Table;
import com.pulumi.gcp.bigquery.TableArgs;
import com.pulumi.gcp.pubsub.Subscription;
import com.pulumi.gcp.pubsub.SubscriptionArgs;
import com.pulumi.gcp.pubsub.inputs.SubscriptionBigqueryConfigArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.List;
import java.util.ArrayList;
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 example = new Topic("example", TopicArgs.builder()
.name("example-topic")
.build());
final var project = OrganizationsFunctions.getProject();
var viewer = new IAMMember("viewer", IAMMemberArgs.builder()
.project(project.applyValue(getProjectResult -> getProjectResult.projectId()))
.role("roles/bigquery.metadataViewer")
.member(String.format("serviceAccount:service-%s@gcp-sa-pubsub.iam.gserviceaccount.com", project.applyValue(getProjectResult -> getProjectResult.number())))
.build());
var editor = new IAMMember("editor", IAMMemberArgs.builder()
.project(project.applyValue(getProjectResult -> getProjectResult.projectId()))
.role("roles/bigquery.dataEditor")
.member(String.format("serviceAccount:service-%s@gcp-sa-pubsub.iam.gserviceaccount.com", project.applyValue(getProjectResult -> getProjectResult.number())))
.build());
var test = new Dataset("test", DatasetArgs.builder()
.datasetId("example_dataset")
.build());
var testTable = new Table("testTable", TableArgs.builder()
.deletionProtection(false)
.tableId("example_table")
.datasetId(test.datasetId())
.schema("""
[
{
"name": "data",
"type": "STRING",
"mode": "NULLABLE",
"description": "The data"
}
]
""")
.build());
var exampleSubscription = new Subscription("exampleSubscription", SubscriptionArgs.builder()
.name("example-subscription")
.topic(example.id())
.bigqueryConfig(SubscriptionBigqueryConfigArgs.builder()
.table(Output.tuple(testTable.project(), testTable.datasetId(), testTable.tableId()).applyValue(values -> {
var project = values.t1;
var datasetId = values.t2;
var tableId = values.t3;
return String.format("%s.%s.%s", project.applyValue(getProjectResult -> getProjectResult),datasetId,tableId);
}))
.build())
.build(), CustomResourceOptions.builder()
.dependsOn(
viewer,
editor)
.build());
}
}
resources:
example:
type: gcp:pubsub:Topic
properties:
name: example-topic
exampleSubscription:
type: gcp:pubsub:Subscription
name: example
properties:
name: example-subscription
topic: ${example.id}
bigqueryConfig:
table: ${testTable.project}.${testTable.datasetId}.${testTable.tableId}
options:
dependson:
- ${viewer}
- ${editor}
viewer:
type: gcp:projects:IAMMember
properties:
project: ${project.projectId}
role: roles/bigquery.metadataViewer
member: serviceAccount:service-${project.number}@gcp-sa-pubsub.iam.gserviceaccount.com
editor:
type: gcp:projects:IAMMember
properties:
project: ${project.projectId}
role: roles/bigquery.dataEditor
member: serviceAccount:service-${project.number}@gcp-sa-pubsub.iam.gserviceaccount.com
test:
type: gcp:bigquery:Dataset
properties:
datasetId: example_dataset
testTable:
type: gcp:bigquery:Table
name: test
properties:
deletionProtection: false
tableId: example_table
datasetId: ${test.datasetId}
schema: |
[
{
"name": "data",
"type": "STRING",
"mode": "NULLABLE",
"description": "The data"
}
]
variables:
project:
fn::invoke:
Function: gcp:organizations:getProject
Arguments: {}
Pubsub Subscription Push Bq Table Schema
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const example = new gcp.pubsub.Topic("example", {name: "example-topic"});
const project = gcp.organizations.getProject({});
const viewer = new gcp.projects.IAMMember("viewer", {
project: project.then(project => project.projectId),
role: "roles/bigquery.metadataViewer",
member: project.then(project => `serviceAccount:service-${project.number}@gcp-sa-pubsub.iam.gserviceaccount.com`),
});
const editor = new gcp.projects.IAMMember("editor", {
project: project.then(project => project.projectId),
role: "roles/bigquery.dataEditor",
member: project.then(project => `serviceAccount:service-${project.number}@gcp-sa-pubsub.iam.gserviceaccount.com`),
});
const test = new gcp.bigquery.Dataset("test", {datasetId: "example_dataset"});
const testTable = new gcp.bigquery.Table("test", {
deletionProtection: false,
tableId: "example_table",
datasetId: test.datasetId,
schema: `[
{
"name": "data",
"type": "STRING",
"mode": "NULLABLE",
"description": "The data"
}
]
`,
});
const exampleSubscription = new gcp.pubsub.Subscription("example", {
name: "example-subscription",
topic: example.id,
bigqueryConfig: {
table: pulumi.interpolate`${testTable.project}.${testTable.datasetId}.${testTable.tableId}`,
useTableSchema: true,
},
}, {
dependsOn: [
viewer,
editor,
],
});
import pulumi
import pulumi_gcp as gcp
example = gcp.pubsub.Topic("example", name="example-topic")
project = gcp.organizations.get_project()
viewer = gcp.projects.IAMMember("viewer",
project=project.project_id,
role="roles/bigquery.metadataViewer",
member=f"serviceAccount:service-{project.number}@gcp-sa-pubsub.iam.gserviceaccount.com")
editor = gcp.projects.IAMMember("editor",
project=project.project_id,
role="roles/bigquery.dataEditor",
member=f"serviceAccount:service-{project.number}@gcp-sa-pubsub.iam.gserviceaccount.com")
test = gcp.bigquery.Dataset("test", dataset_id="example_dataset")
test_table = gcp.bigquery.Table("test",
deletion_protection=False,
table_id="example_table",
dataset_id=test.dataset_id,
schema="""[
{
"name": "data",
"type": "STRING",
"mode": "NULLABLE",
"description": "The data"
}
]
""")
example_subscription = gcp.pubsub.Subscription("example",
name="example-subscription",
topic=example.id,
bigquery_config=gcp.pubsub.SubscriptionBigqueryConfigArgs(
table=pulumi.Output.all(test_table.project, test_table.dataset_id, test_table.table_id).apply(lambda project, dataset_id, table_id: f"{project}.{dataset_id}.{table_id}"),
use_table_schema=True,
),
opts = pulumi.ResourceOptions(depends_on=[
viewer,
editor,
]))
package main
import (
"fmt"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/bigquery"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/projects"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/pubsub"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := pubsub.NewTopic(ctx, "example", &pubsub.TopicArgs{
Name: pulumi.String("example-topic"),
})
if err != nil {
return err
}
project, err := organizations.LookupProject(ctx, nil, nil)
if err != nil {
return err
}
viewer, err := projects.NewIAMMember(ctx, "viewer", &projects.IAMMemberArgs{
Project: pulumi.String(project.ProjectId),
Role: pulumi.String("roles/bigquery.metadataViewer"),
Member: pulumi.String(fmt.Sprintf("serviceAccount:service-%v@gcp-sa-pubsub.iam.gserviceaccount.com", project.Number)),
})
if err != nil {
return err
}
editor, err := projects.NewIAMMember(ctx, "editor", &projects.IAMMemberArgs{
Project: pulumi.String(project.ProjectId),
Role: pulumi.String("roles/bigquery.dataEditor"),
Member: pulumi.String(fmt.Sprintf("serviceAccount:service-%v@gcp-sa-pubsub.iam.gserviceaccount.com", project.Number)),
})
if err != nil {
return err
}
test, err := bigquery.NewDataset(ctx, "test", &bigquery.DatasetArgs{
DatasetId: pulumi.String("example_dataset"),
})
if err != nil {
return err
}
testTable, err := bigquery.NewTable(ctx, "test", &bigquery.TableArgs{
DeletionProtection: pulumi.Bool(false),
TableId: pulumi.String("example_table"),
DatasetId: test.DatasetId,
Schema: pulumi.String(`[
{
"name": "data",
"type": "STRING",
"mode": "NULLABLE",
"description": "The data"
}
]
`),
})
if err != nil {
return err
}
_, err = pubsub.NewSubscription(ctx, "example", &pubsub.SubscriptionArgs{
Name: pulumi.String("example-subscription"),
Topic: example.ID(),
BigqueryConfig: &pubsub.SubscriptionBigqueryConfigArgs{
Table: pulumi.All(testTable.Project, testTable.DatasetId, testTable.TableId).ApplyT(func(_args []interface{}) (string, error) {
project := _args[0].(string)
datasetId := _args[1].(string)
tableId := _args[2].(string)
return fmt.Sprintf("%v.%v.%v", project, datasetId, tableId), nil
}).(pulumi.StringOutput),
UseTableSchema: pulumi.Bool(true),
},
}, pulumi.DependsOn([]pulumi.Resource{
viewer,
editor,
}))
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var example = new Gcp.PubSub.Topic("example", new()
{
Name = "example-topic",
});
var project = Gcp.Organizations.GetProject.Invoke();
var viewer = new Gcp.Projects.IAMMember("viewer", new()
{
Project = project.Apply(getProjectResult => getProjectResult.ProjectId),
Role = "roles/bigquery.metadataViewer",
Member = $"serviceAccount:service-{project.Apply(getProjectResult => getProjectResult.Number)}@gcp-sa-pubsub.iam.gserviceaccount.com",
});
var editor = new Gcp.Projects.IAMMember("editor", new()
{
Project = project.Apply(getProjectResult => getProjectResult.ProjectId),
Role = "roles/bigquery.dataEditor",
Member = $"serviceAccount:service-{project.Apply(getProjectResult => getProjectResult.Number)}@gcp-sa-pubsub.iam.gserviceaccount.com",
});
var test = new Gcp.BigQuery.Dataset("test", new()
{
DatasetId = "example_dataset",
});
var testTable = new Gcp.BigQuery.Table("test", new()
{
DeletionProtection = false,
TableId = "example_table",
DatasetId = test.DatasetId,
Schema = @"[
{
""name"": ""data"",
""type"": ""STRING"",
""mode"": ""NULLABLE"",
""description"": ""The data""
}
]
",
});
var exampleSubscription = new Gcp.PubSub.Subscription("example", new()
{
Name = "example-subscription",
Topic = example.Id,
BigqueryConfig = new Gcp.PubSub.Inputs.SubscriptionBigqueryConfigArgs
{
Table = Output.Tuple(testTable.Project, testTable.DatasetId, testTable.TableId).Apply(values =>
{
var project = values.Item1;
var datasetId = values.Item2;
var tableId = values.Item3;
return $"{project}.{datasetId}.{tableId}";
}),
UseTableSchema = true,
},
}, new CustomResourceOptions
{
DependsOn =
{
viewer,
editor,
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.pubsub.Topic;
import com.pulumi.gcp.pubsub.TopicArgs;
import com.pulumi.gcp.organizations.OrganizationsFunctions;
import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
import com.pulumi.gcp.projects.IAMMember;
import com.pulumi.gcp.projects.IAMMemberArgs;
import com.pulumi.gcp.bigquery.Dataset;
import com.pulumi.gcp.bigquery.DatasetArgs;
import com.pulumi.gcp.bigquery.Table;
import com.pulumi.gcp.bigquery.TableArgs;
import com.pulumi.gcp.pubsub.Subscription;
import com.pulumi.gcp.pubsub.SubscriptionArgs;
import com.pulumi.gcp.pubsub.inputs.SubscriptionBigqueryConfigArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.List;
import java.util.ArrayList;
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 example = new Topic("example", TopicArgs.builder()
.name("example-topic")
.build());
final var project = OrganizationsFunctions.getProject();
var viewer = new IAMMember("viewer", IAMMemberArgs.builder()
.project(project.applyValue(getProjectResult -> getProjectResult.projectId()))
.role("roles/bigquery.metadataViewer")
.member(String.format("serviceAccount:service-%s@gcp-sa-pubsub.iam.gserviceaccount.com", project.applyValue(getProjectResult -> getProjectResult.number())))
.build());
var editor = new IAMMember("editor", IAMMemberArgs.builder()
.project(project.applyValue(getProjectResult -> getProjectResult.projectId()))
.role("roles/bigquery.dataEditor")
.member(String.format("serviceAccount:service-%s@gcp-sa-pubsub.iam.gserviceaccount.com", project.applyValue(getProjectResult -> getProjectResult.number())))
.build());
var test = new Dataset("test", DatasetArgs.builder()
.datasetId("example_dataset")
.build());
var testTable = new Table("testTable", TableArgs.builder()
.deletionProtection(false)
.tableId("example_table")
.datasetId(test.datasetId())
.schema("""
[
{
"name": "data",
"type": "STRING",
"mode": "NULLABLE",
"description": "The data"
}
]
""")
.build());
var exampleSubscription = new Subscription("exampleSubscription", SubscriptionArgs.builder()
.name("example-subscription")
.topic(example.id())
.bigqueryConfig(SubscriptionBigqueryConfigArgs.builder()
.table(Output.tuple(testTable.project(), testTable.datasetId(), testTable.tableId()).applyValue(values -> {
var project = values.t1;
var datasetId = values.t2;
var tableId = values.t3;
return String.format("%s.%s.%s", project.applyValue(getProjectResult -> getProjectResult),datasetId,tableId);
}))
.useTableSchema(true)
.build())
.build(), CustomResourceOptions.builder()
.dependsOn(
viewer,
editor)
.build());
}
}
resources:
example:
type: gcp:pubsub:Topic
properties:
name: example-topic
exampleSubscription:
type: gcp:pubsub:Subscription
name: example
properties:
name: example-subscription
topic: ${example.id}
bigqueryConfig:
table: ${testTable.project}.${testTable.datasetId}.${testTable.tableId}
useTableSchema: true
options:
dependson:
- ${viewer}
- ${editor}
viewer:
type: gcp:projects:IAMMember
properties:
project: ${project.projectId}
role: roles/bigquery.metadataViewer
member: serviceAccount:service-${project.number}@gcp-sa-pubsub.iam.gserviceaccount.com
editor:
type: gcp:projects:IAMMember
properties:
project: ${project.projectId}
role: roles/bigquery.dataEditor
member: serviceAccount:service-${project.number}@gcp-sa-pubsub.iam.gserviceaccount.com
test:
type: gcp:bigquery:Dataset
properties:
datasetId: example_dataset
testTable:
type: gcp:bigquery:Table
name: test
properties:
deletionProtection: false
tableId: example_table
datasetId: ${test.datasetId}
schema: |
[
{
"name": "data",
"type": "STRING",
"mode": "NULLABLE",
"description": "The data"
}
]
variables:
project:
fn::invoke:
Function: gcp:organizations:getProject
Arguments: {}
Pubsub Subscription Push Bq Service Account
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const example = new gcp.pubsub.Topic("example", {name: "example-topic"});
const bqWriteServiceAccount = new gcp.serviceaccount.Account("bq_write_service_account", {
accountId: "example-bqw",
displayName: "BQ Write Service Account",
});
const project = gcp.organizations.getProject({});
const viewer = new gcp.projects.IAMMember("viewer", {
project: project.then(project => project.projectId),
role: "roles/bigquery.metadataViewer",
member: pulumi.interpolate`serviceAccount:${bqWriteServiceAccount.email}`,
});
const editor = new gcp.projects.IAMMember("editor", {
project: project.then(project => project.projectId),
role: "roles/bigquery.dataEditor",
member: pulumi.interpolate`serviceAccount:${bqWriteServiceAccount.email}`,
});
const test = new gcp.bigquery.Dataset("test", {datasetId: "example_dataset"});
const testTable = new gcp.bigquery.Table("test", {
deletionProtection: false,
tableId: "example_table",
datasetId: test.datasetId,
schema: `[
{
"name": "data",
"type": "STRING",
"mode": "NULLABLE",
"description": "The data"
}
]
`,
});
const exampleSubscription = new gcp.pubsub.Subscription("example", {
name: "example-subscription",
topic: example.id,
bigqueryConfig: {
table: pulumi.interpolate`${testTable.project}.${testTable.datasetId}.${testTable.tableId}`,
serviceAccountEmail: bqWriteServiceAccount.email,
},
}, {
dependsOn: [
bqWriteServiceAccount,
viewer,
editor,
],
});
import pulumi
import pulumi_gcp as gcp
example = gcp.pubsub.Topic("example", name="example-topic")
bq_write_service_account = gcp.serviceaccount.Account("bq_write_service_account",
account_id="example-bqw",
display_name="BQ Write Service Account")
project = gcp.organizations.get_project()
viewer = gcp.projects.IAMMember("viewer",
project=project.project_id,
role="roles/bigquery.metadataViewer",
member=bq_write_service_account.email.apply(lambda email: f"serviceAccount:{email}"))
editor = gcp.projects.IAMMember("editor",
project=project.project_id,
role="roles/bigquery.dataEditor",
member=bq_write_service_account.email.apply(lambda email: f"serviceAccount:{email}"))
test = gcp.bigquery.Dataset("test", dataset_id="example_dataset")
test_table = gcp.bigquery.Table("test",
deletion_protection=False,
table_id="example_table",
dataset_id=test.dataset_id,
schema="""[
{
"name": "data",
"type": "STRING",
"mode": "NULLABLE",
"description": "The data"
}
]
""")
example_subscription = gcp.pubsub.Subscription("example",
name="example-subscription",
topic=example.id,
bigquery_config=gcp.pubsub.SubscriptionBigqueryConfigArgs(
table=pulumi.Output.all(test_table.project, test_table.dataset_id, test_table.table_id).apply(lambda project, dataset_id, table_id: f"{project}.{dataset_id}.{table_id}"),
service_account_email=bq_write_service_account.email,
),
opts = pulumi.ResourceOptions(depends_on=[
bq_write_service_account,
viewer,
editor,
]))
package main
import (
"fmt"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/bigquery"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/projects"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/pubsub"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/serviceaccount"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := pubsub.NewTopic(ctx, "example", &pubsub.TopicArgs{
Name: pulumi.String("example-topic"),
})
if err != nil {
return err
}
bqWriteServiceAccount, err := serviceaccount.NewAccount(ctx, "bq_write_service_account", &serviceaccount.AccountArgs{
AccountId: pulumi.String("example-bqw"),
DisplayName: pulumi.String("BQ Write Service Account"),
})
if err != nil {
return err
}
project, err := organizations.LookupProject(ctx, nil, nil)
if err != nil {
return err
}
viewer, err := projects.NewIAMMember(ctx, "viewer", &projects.IAMMemberArgs{
Project: pulumi.String(project.ProjectId),
Role: pulumi.String("roles/bigquery.metadataViewer"),
Member: bqWriteServiceAccount.Email.ApplyT(func(email string) (string, error) {
return fmt.Sprintf("serviceAccount:%v", email), nil
}).(pulumi.StringOutput),
})
if err != nil {
return err
}
editor, err := projects.NewIAMMember(ctx, "editor", &projects.IAMMemberArgs{
Project: pulumi.String(project.ProjectId),
Role: pulumi.String("roles/bigquery.dataEditor"),
Member: bqWriteServiceAccount.Email.ApplyT(func(email string) (string, error) {
return fmt.Sprintf("serviceAccount:%v", email), nil
}).(pulumi.StringOutput),
})
if err != nil {
return err
}
test, err := bigquery.NewDataset(ctx, "test", &bigquery.DatasetArgs{
DatasetId: pulumi.String("example_dataset"),
})
if err != nil {
return err
}
testTable, err := bigquery.NewTable(ctx, "test", &bigquery.TableArgs{
DeletionProtection: pulumi.Bool(false),
TableId: pulumi.String("example_table"),
DatasetId: test.DatasetId,
Schema: pulumi.String(`[
{
"name": "data",
"type": "STRING",
"mode": "NULLABLE",
"description": "The data"
}
]
`),
})
if err != nil {
return err
}
_, err = pubsub.NewSubscription(ctx, "example", &pubsub.SubscriptionArgs{
Name: pulumi.String("example-subscription"),
Topic: example.ID(),
BigqueryConfig: &pubsub.SubscriptionBigqueryConfigArgs{
Table: pulumi.All(testTable.Project, testTable.DatasetId, testTable.TableId).ApplyT(func(_args []interface{}) (string, error) {
project := _args[0].(string)
datasetId := _args[1].(string)
tableId := _args[2].(string)
return fmt.Sprintf("%v.%v.%v", project, datasetId, tableId), nil
}).(pulumi.StringOutput),
ServiceAccountEmail: bqWriteServiceAccount.Email,
},
}, pulumi.DependsOn([]pulumi.Resource{
bqWriteServiceAccount,
viewer,
editor,
}))
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var example = new Gcp.PubSub.Topic("example", new()
{
Name = "example-topic",
});
var bqWriteServiceAccount = new Gcp.ServiceAccount.Account("bq_write_service_account", new()
{
AccountId = "example-bqw",
DisplayName = "BQ Write Service Account",
});
var project = Gcp.Organizations.GetProject.Invoke();
var viewer = new Gcp.Projects.IAMMember("viewer", new()
{
Project = project.Apply(getProjectResult => getProjectResult.ProjectId),
Role = "roles/bigquery.metadataViewer",
Member = bqWriteServiceAccount.Email.Apply(email => $"serviceAccount:{email}"),
});
var editor = new Gcp.Projects.IAMMember("editor", new()
{
Project = project.Apply(getProjectResult => getProjectResult.ProjectId),
Role = "roles/bigquery.dataEditor",
Member = bqWriteServiceAccount.Email.Apply(email => $"serviceAccount:{email}"),
});
var test = new Gcp.BigQuery.Dataset("test", new()
{
DatasetId = "example_dataset",
});
var testTable = new Gcp.BigQuery.Table("test", new()
{
DeletionProtection = false,
TableId = "example_table",
DatasetId = test.DatasetId,
Schema = @"[
{
""name"": ""data"",
""type"": ""STRING"",
""mode"": ""NULLABLE"",
""description"": ""The data""
}
]
",
});
var exampleSubscription = new Gcp.PubSub.Subscription("example", new()
{
Name = "example-subscription",
Topic = example.Id,
BigqueryConfig = new Gcp.PubSub.Inputs.SubscriptionBigqueryConfigArgs
{
Table = Output.Tuple(testTable.Project, testTable.DatasetId, testTable.TableId).Apply(values =>
{
var project = values.Item1;
var datasetId = values.Item2;
var tableId = values.Item3;
return $"{project}.{datasetId}.{tableId}";
}),
ServiceAccountEmail = bqWriteServiceAccount.Email,
},
}, new CustomResourceOptions
{
DependsOn =
{
bqWriteServiceAccount,
viewer,
editor,
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.pubsub.Topic;
import com.pulumi.gcp.pubsub.TopicArgs;
import com.pulumi.gcp.serviceaccount.Account;
import com.pulumi.gcp.serviceaccount.AccountArgs;
import com.pulumi.gcp.organizations.OrganizationsFunctions;
import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
import com.pulumi.gcp.projects.IAMMember;
import com.pulumi.gcp.projects.IAMMemberArgs;
import com.pulumi.gcp.bigquery.Dataset;
import com.pulumi.gcp.bigquery.DatasetArgs;
import com.pulumi.gcp.bigquery.Table;
import com.pulumi.gcp.bigquery.TableArgs;
import com.pulumi.gcp.pubsub.Subscription;
import com.pulumi.gcp.pubsub.SubscriptionArgs;
import com.pulumi.gcp.pubsub.inputs.SubscriptionBigqueryConfigArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.List;
import java.util.ArrayList;
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 example = new Topic("example", TopicArgs.builder()
.name("example-topic")
.build());
var bqWriteServiceAccount = new Account("bqWriteServiceAccount", AccountArgs.builder()
.accountId("example-bqw")
.displayName("BQ Write Service Account")
.build());
final var project = OrganizationsFunctions.getProject();
var viewer = new IAMMember("viewer", IAMMemberArgs.builder()
.project(project.applyValue(getProjectResult -> getProjectResult.projectId()))
.role("roles/bigquery.metadataViewer")
.member(bqWriteServiceAccount.email().applyValue(email -> String.format("serviceAccount:%s", email)))
.build());
var editor = new IAMMember("editor", IAMMemberArgs.builder()
.project(project.applyValue(getProjectResult -> getProjectResult.projectId()))
.role("roles/bigquery.dataEditor")
.member(bqWriteServiceAccount.email().applyValue(email -> String.format("serviceAccount:%s", email)))
.build());
var test = new Dataset("test", DatasetArgs.builder()
.datasetId("example_dataset")
.build());
var testTable = new Table("testTable", TableArgs.builder()
.deletionProtection(false)
.tableId("example_table")
.datasetId(test.datasetId())
.schema("""
[
{
"name": "data",
"type": "STRING",
"mode": "NULLABLE",
"description": "The data"
}
]
""")
.build());
var exampleSubscription = new Subscription("exampleSubscription", SubscriptionArgs.builder()
.name("example-subscription")
.topic(example.id())
.bigqueryConfig(SubscriptionBigqueryConfigArgs.builder()
.table(Output.tuple(testTable.project(), testTable.datasetId(), testTable.tableId()).applyValue(values -> {
var project = values.t1;
var datasetId = values.t2;
var tableId = values.t3;
return String.format("%s.%s.%s", project.applyValue(getProjectResult -> getProjectResult),datasetId,tableId);
}))
.serviceAccountEmail(bqWriteServiceAccount.email())
.build())
.build(), CustomResourceOptions.builder()
.dependsOn(
bqWriteServiceAccount,
viewer,
editor)
.build());
}
}
resources:
example:
type: gcp:pubsub:Topic
properties:
name: example-topic
exampleSubscription:
type: gcp:pubsub:Subscription
name: example
properties:
name: example-subscription
topic: ${example.id}
bigqueryConfig:
table: ${testTable.project}.${testTable.datasetId}.${testTable.tableId}
serviceAccountEmail: ${bqWriteServiceAccount.email}
options:
dependson:
- ${bqWriteServiceAccount}
- ${viewer}
- ${editor}
bqWriteServiceAccount:
type: gcp:serviceaccount:Account
name: bq_write_service_account
properties:
accountId: example-bqw
displayName: BQ Write Service Account
viewer:
type: gcp:projects:IAMMember
properties:
project: ${project.projectId}
role: roles/bigquery.metadataViewer
member: serviceAccount:${bqWriteServiceAccount.email}
editor:
type: gcp:projects:IAMMember
properties:
project: ${project.projectId}
role: roles/bigquery.dataEditor
member: serviceAccount:${bqWriteServiceAccount.email}
test:
type: gcp:bigquery:Dataset
properties:
datasetId: example_dataset
testTable:
type: gcp:bigquery:Table
name: test
properties:
deletionProtection: false
tableId: example_table
datasetId: ${test.datasetId}
schema: |
[
{
"name": "data",
"type": "STRING",
"mode": "NULLABLE",
"description": "The data"
}
]
variables:
project:
fn::invoke:
Function: gcp:organizations:getProject
Arguments: {}
Pubsub Subscription Push Cloudstorage
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const example = new gcp.storage.Bucket("example", {
name: "example-bucket",
location: "US",
uniformBucketLevelAccess: true,
});
const exampleTopic = new gcp.pubsub.Topic("example", {name: "example-topic"});
const project = gcp.organizations.getProject({});
const admin = new gcp.storage.BucketIAMMember("admin", {
bucket: example.name,
role: "roles/storage.admin",
member: project.then(project => `serviceAccount:service-${project.number}@gcp-sa-pubsub.iam.gserviceaccount.com`),
});
const exampleSubscription = new gcp.pubsub.Subscription("example", {
name: "example-subscription",
topic: exampleTopic.id,
cloudStorageConfig: {
bucket: example.name,
filenamePrefix: "pre-",
filenameSuffix: "-_79169",
filenameDatetimeFormat: "YYYY-MM-DD/hh_mm_ssZ",
maxBytes: 1000,
maxDuration: "300s",
},
}, {
dependsOn: [
example,
admin,
],
});
import pulumi
import pulumi_gcp as gcp
example = gcp.storage.Bucket("example",
name="example-bucket",
location="US",
uniform_bucket_level_access=True)
example_topic = gcp.pubsub.Topic("example", name="example-topic")
project = gcp.organizations.get_project()
admin = gcp.storage.BucketIAMMember("admin",
bucket=example.name,
role="roles/storage.admin",
member=f"serviceAccount:service-{project.number}@gcp-sa-pubsub.iam.gserviceaccount.com")
example_subscription = gcp.pubsub.Subscription("example",
name="example-subscription",
topic=example_topic.id,
cloud_storage_config=gcp.pubsub.SubscriptionCloudStorageConfigArgs(
bucket=example.name,
filename_prefix="pre-",
filename_suffix="-_79169",
filename_datetime_format="YYYY-MM-DD/hh_mm_ssZ",
max_bytes=1000,
max_duration="300s",
),
opts = pulumi.ResourceOptions(depends_on=[
example,
admin,
]))
package main
import (
"fmt"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/pubsub"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/storage"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := storage.NewBucket(ctx, "example", &storage.BucketArgs{
Name: pulumi.String("example-bucket"),
Location: pulumi.String("US"),
UniformBucketLevelAccess: pulumi.Bool(true),
})
if err != nil {
return err
}
exampleTopic, err := pubsub.NewTopic(ctx, "example", &pubsub.TopicArgs{
Name: pulumi.String("example-topic"),
})
if err != nil {
return err
}
project, err := organizations.LookupProject(ctx, nil, nil)
if err != nil {
return err
}
admin, err := storage.NewBucketIAMMember(ctx, "admin", &storage.BucketIAMMemberArgs{
Bucket: example.Name,
Role: pulumi.String("roles/storage.admin"),
Member: pulumi.String(fmt.Sprintf("serviceAccount:service-%v@gcp-sa-pubsub.iam.gserviceaccount.com", project.Number)),
})
if err != nil {
return err
}
_, err = pubsub.NewSubscription(ctx, "example", &pubsub.SubscriptionArgs{
Name: pulumi.String("example-subscription"),
Topic: exampleTopic.ID(),
CloudStorageConfig: &pubsub.SubscriptionCloudStorageConfigArgs{
Bucket: example.Name,
FilenamePrefix: pulumi.String("pre-"),
FilenameSuffix: pulumi.String("-_79169"),
FilenameDatetimeFormat: pulumi.String("YYYY-MM-DD/hh_mm_ssZ"),
MaxBytes: pulumi.Int(1000),
MaxDuration: pulumi.String("300s"),
},
}, pulumi.DependsOn([]pulumi.Resource{
example,
admin,
}))
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var example = new Gcp.Storage.Bucket("example", new()
{
Name = "example-bucket",
Location = "US",
UniformBucketLevelAccess = true,
});
var exampleTopic = new Gcp.PubSub.Topic("example", new()
{
Name = "example-topic",
});
var project = Gcp.Organizations.GetProject.Invoke();
var admin = new Gcp.Storage.BucketIAMMember("admin", new()
{
Bucket = example.Name,
Role = "roles/storage.admin",
Member = $"serviceAccount:service-{project.Apply(getProjectResult => getProjectResult.Number)}@gcp-sa-pubsub.iam.gserviceaccount.com",
});
var exampleSubscription = new Gcp.PubSub.Subscription("example", new()
{
Name = "example-subscription",
Topic = exampleTopic.Id,
CloudStorageConfig = new Gcp.PubSub.Inputs.SubscriptionCloudStorageConfigArgs
{
Bucket = example.Name,
FilenamePrefix = "pre-",
FilenameSuffix = "-_79169",
FilenameDatetimeFormat = "YYYY-MM-DD/hh_mm_ssZ",
MaxBytes = 1000,
MaxDuration = "300s",
},
}, new CustomResourceOptions
{
DependsOn =
{
example,
admin,
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.storage.Bucket;
import com.pulumi.gcp.storage.BucketArgs;
import com.pulumi.gcp.pubsub.Topic;
import com.pulumi.gcp.pubsub.TopicArgs;
import com.pulumi.gcp.organizations.OrganizationsFunctions;
import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
import com.pulumi.gcp.storage.BucketIAMMember;
import com.pulumi.gcp.storage.BucketIAMMemberArgs;
import com.pulumi.gcp.pubsub.Subscription;
import com.pulumi.gcp.pubsub.SubscriptionArgs;
import com.pulumi.gcp.pubsub.inputs.SubscriptionCloudStorageConfigArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.List;
import java.util.ArrayList;
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 example = new Bucket("example", BucketArgs.builder()
.name("example-bucket")
.location("US")
.uniformBucketLevelAccess(true)
.build());
var exampleTopic = new Topic("exampleTopic", TopicArgs.builder()
.name("example-topic")
.build());
final var project = OrganizationsFunctions.getProject();
var admin = new BucketIAMMember("admin", BucketIAMMemberArgs.builder()
.bucket(example.name())
.role("roles/storage.admin")
.member(String.format("serviceAccount:service-%s@gcp-sa-pubsub.iam.gserviceaccount.com", project.applyValue(getProjectResult -> getProjectResult.number())))
.build());
var exampleSubscription = new Subscription("exampleSubscription", SubscriptionArgs.builder()
.name("example-subscription")
.topic(exampleTopic.id())
.cloudStorageConfig(SubscriptionCloudStorageConfigArgs.builder()
.bucket(example.name())
.filenamePrefix("pre-")
.filenameSuffix("-_79169")
.filenameDatetimeFormat("YYYY-MM-DD/hh_mm_ssZ")
.maxBytes(1000)
.maxDuration("300s")
.build())
.build(), CustomResourceOptions.builder()
.dependsOn(
example,
admin)
.build());
}
}
resources:
example:
type: gcp:storage:Bucket
properties:
name: example-bucket
location: US
uniformBucketLevelAccess: true
exampleTopic:
type: gcp:pubsub:Topic
name: example
properties:
name: example-topic
exampleSubscription:
type: gcp:pubsub:Subscription
name: example
properties:
name: example-subscription
topic: ${exampleTopic.id}
cloudStorageConfig:
bucket: ${example.name}
filenamePrefix: pre-
filenameSuffix: -_79169
filenameDatetimeFormat: YYYY-MM-DD/hh_mm_ssZ
maxBytes: 1000
maxDuration: 300s
options:
dependson:
- ${example}
- ${admin}
admin:
type: gcp:storage:BucketIAMMember
properties:
bucket: ${example.name}
role: roles/storage.admin
member: serviceAccount:service-${project.number}@gcp-sa-pubsub.iam.gserviceaccount.com
variables:
project:
fn::invoke:
Function: gcp:organizations:getProject
Arguments: {}
Pubsub Subscription Push Cloudstorage Avro
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const example = new gcp.storage.Bucket("example", {
name: "example-bucket",
location: "US",
uniformBucketLevelAccess: true,
});
const exampleTopic = new gcp.pubsub.Topic("example", {name: "example-topic"});
const project = gcp.organizations.getProject({});
const admin = new gcp.storage.BucketIAMMember("admin", {
bucket: example.name,
role: "roles/storage.admin",
member: project.then(project => `serviceAccount:service-${project.number}@gcp-sa-pubsub.iam.gserviceaccount.com`),
});
const exampleSubscription = new gcp.pubsub.Subscription("example", {
name: "example-subscription",
topic: exampleTopic.id,
cloudStorageConfig: {
bucket: example.name,
filenamePrefix: "pre-",
filenameSuffix: "-_56529",
filenameDatetimeFormat: "YYYY-MM-DD/hh_mm_ssZ",
maxBytes: 1000,
maxDuration: "300s",
avroConfig: {
writeMetadata: true,
},
},
}, {
dependsOn: [
example,
admin,
],
});
import pulumi
import pulumi_gcp as gcp
example = gcp.storage.Bucket("example",
name="example-bucket",
location="US",
uniform_bucket_level_access=True)
example_topic = gcp.pubsub.Topic("example", name="example-topic")
project = gcp.organizations.get_project()
admin = gcp.storage.BucketIAMMember("admin",
bucket=example.name,
role="roles/storage.admin",
member=f"serviceAccount:service-{project.number}@gcp-sa-pubsub.iam.gserviceaccount.com")
example_subscription = gcp.pubsub.Subscription("example",
name="example-subscription",
topic=example_topic.id,
cloud_storage_config=gcp.pubsub.SubscriptionCloudStorageConfigArgs(
bucket=example.name,
filename_prefix="pre-",
filename_suffix="-_56529",
filename_datetime_format="YYYY-MM-DD/hh_mm_ssZ",
max_bytes=1000,
max_duration="300s",
avro_config=gcp.pubsub.SubscriptionCloudStorageConfigAvroConfigArgs(
write_metadata=True,
),
),
opts = pulumi.ResourceOptions(depends_on=[
example,
admin,
]))
package main
import (
"fmt"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/pubsub"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/storage"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := storage.NewBucket(ctx, "example", &storage.BucketArgs{
Name: pulumi.String("example-bucket"),
Location: pulumi.String("US"),
UniformBucketLevelAccess: pulumi.Bool(true),
})
if err != nil {
return err
}
exampleTopic, err := pubsub.NewTopic(ctx, "example", &pubsub.TopicArgs{
Name: pulumi.String("example-topic"),
})
if err != nil {
return err
}
project, err := organizations.LookupProject(ctx, nil, nil)
if err != nil {
return err
}
admin, err := storage.NewBucketIAMMember(ctx, "admin", &storage.BucketIAMMemberArgs{
Bucket: example.Name,
Role: pulumi.String("roles/storage.admin"),
Member: pulumi.String(fmt.Sprintf("serviceAccount:service-%v@gcp-sa-pubsub.iam.gserviceaccount.com", project.Number)),
})
if err != nil {
return err
}
_, err = pubsub.NewSubscription(ctx, "example", &pubsub.SubscriptionArgs{
Name: pulumi.String("example-subscription"),
Topic: exampleTopic.ID(),
CloudStorageConfig: &pubsub.SubscriptionCloudStorageConfigArgs{
Bucket: example.Name,
FilenamePrefix: pulumi.String("pre-"),
FilenameSuffix: pulumi.String("-_56529"),
FilenameDatetimeFormat: pulumi.String("YYYY-MM-DD/hh_mm_ssZ"),
MaxBytes: pulumi.Int(1000),
MaxDuration: pulumi.String("300s"),
AvroConfig: &pubsub.SubscriptionCloudStorageConfigAvroConfigArgs{
WriteMetadata: pulumi.Bool(true),
},
},
}, pulumi.DependsOn([]pulumi.Resource{
example,
admin,
}))
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var example = new Gcp.Storage.Bucket("example", new()
{
Name = "example-bucket",
Location = "US",
UniformBucketLevelAccess = true,
});
var exampleTopic = new Gcp.PubSub.Topic("example", new()
{
Name = "example-topic",
});
var project = Gcp.Organizations.GetProject.Invoke();
var admin = new Gcp.Storage.BucketIAMMember("admin", new()
{
Bucket = example.Name,
Role = "roles/storage.admin",
Member = $"serviceAccount:service-{project.Apply(getProjectResult => getProjectResult.Number)}@gcp-sa-pubsub.iam.gserviceaccount.com",
});
var exampleSubscription = new Gcp.PubSub.Subscription("example", new()
{
Name = "example-subscription",
Topic = exampleTopic.Id,
CloudStorageConfig = new Gcp.PubSub.Inputs.SubscriptionCloudStorageConfigArgs
{
Bucket = example.Name,
FilenamePrefix = "pre-",
FilenameSuffix = "-_56529",
FilenameDatetimeFormat = "YYYY-MM-DD/hh_mm_ssZ",
MaxBytes = 1000,
MaxDuration = "300s",
AvroConfig = new Gcp.PubSub.Inputs.SubscriptionCloudStorageConfigAvroConfigArgs
{
WriteMetadata = true,
},
},
}, new CustomResourceOptions
{
DependsOn =
{
example,
admin,
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.storage.Bucket;
import com.pulumi.gcp.storage.BucketArgs;
import com.pulumi.gcp.pubsub.Topic;
import com.pulumi.gcp.pubsub.TopicArgs;
import com.pulumi.gcp.organizations.OrganizationsFunctions;
import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
import com.pulumi.gcp.storage.BucketIAMMember;
import com.pulumi.gcp.storage.BucketIAMMemberArgs;
import com.pulumi.gcp.pubsub.Subscription;
import com.pulumi.gcp.pubsub.SubscriptionArgs;
import com.pulumi.gcp.pubsub.inputs.SubscriptionCloudStorageConfigArgs;
import com.pulumi.gcp.pubsub.inputs.SubscriptionCloudStorageConfigAvroConfigArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.List;
import java.util.ArrayList;
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 example = new Bucket("example", BucketArgs.builder()
.name("example-bucket")
.location("US")
.uniformBucketLevelAccess(true)
.build());
var exampleTopic = new Topic("exampleTopic", TopicArgs.builder()
.name("example-topic")
.build());
final var project = OrganizationsFunctions.getProject();
var admin = new BucketIAMMember("admin", BucketIAMMemberArgs.builder()
.bucket(example.name())
.role("roles/storage.admin")
.member(String.format("serviceAccount:service-%s@gcp-sa-pubsub.iam.gserviceaccount.com", project.applyValue(getProjectResult -> getProjectResult.number())))
.build());
var exampleSubscription = new Subscription("exampleSubscription", SubscriptionArgs.builder()
.name("example-subscription")
.topic(exampleTopic.id())
.cloudStorageConfig(SubscriptionCloudStorageConfigArgs.builder()
.bucket(example.name())
.filenamePrefix("pre-")
.filenameSuffix("-_56529")
.filenameDatetimeFormat("YYYY-MM-DD/hh_mm_ssZ")
.maxBytes(1000)
.maxDuration("300s")
.avroConfig(SubscriptionCloudStorageConfigAvroConfigArgs.builder()
.writeMetadata(true)
.build())
.build())
.build(), CustomResourceOptions.builder()
.dependsOn(
example,
admin)
.build());
}
}
resources:
example:
type: gcp:storage:Bucket
properties:
name: example-bucket
location: US
uniformBucketLevelAccess: true
exampleTopic:
type: gcp:pubsub:Topic
name: example
properties:
name: example-topic
exampleSubscription:
type: gcp:pubsub:Subscription
name: example
properties:
name: example-subscription
topic: ${exampleTopic.id}
cloudStorageConfig:
bucket: ${example.name}
filenamePrefix: pre-
filenameSuffix: -_56529
filenameDatetimeFormat: YYYY-MM-DD/hh_mm_ssZ
maxBytes: 1000
maxDuration: 300s
avroConfig:
writeMetadata: true
options:
dependson:
- ${example}
- ${admin}
admin:
type: gcp:storage:BucketIAMMember
properties:
bucket: ${example.name}
role: roles/storage.admin
member: serviceAccount:service-${project.number}@gcp-sa-pubsub.iam.gserviceaccount.com
variables:
project:
fn::invoke:
Function: gcp:organizations:getProject
Arguments: {}
Pubsub Subscription Push Cloudstorage Service Account
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const example = new gcp.storage.Bucket("example", {
name: "example-bucket",
location: "US",
uniformBucketLevelAccess: true,
});
const exampleTopic = new gcp.pubsub.Topic("example", {name: "example-topic"});
const storageWriteServiceAccount = new gcp.serviceaccount.Account("storage_write_service_account", {
accountId: "example-stw",
displayName: "Storage Write Service Account",
});
const admin = new gcp.storage.BucketIAMMember("admin", {
bucket: example.name,
role: "roles/storage.admin",
member: pulumi.interpolate`serviceAccount:${storageWriteServiceAccount.email}`,
});
const exampleSubscription = new gcp.pubsub.Subscription("example", {
name: "example-subscription",
topic: exampleTopic.id,
cloudStorageConfig: {
bucket: example.name,
filenamePrefix: "pre-",
filenameSuffix: "-_75413",
filenameDatetimeFormat: "YYYY-MM-DD/hh_mm_ssZ",
maxBytes: 1000,
maxDuration: "300s",
serviceAccountEmail: storageWriteServiceAccount.email,
},
}, {
dependsOn: [
storageWriteServiceAccount,
example,
admin,
],
});
const project = gcp.organizations.getProject({});
import pulumi
import pulumi_gcp as gcp
example = gcp.storage.Bucket("example",
name="example-bucket",
location="US",
uniform_bucket_level_access=True)
example_topic = gcp.pubsub.Topic("example", name="example-topic")
storage_write_service_account = gcp.serviceaccount.Account("storage_write_service_account",
account_id="example-stw",
display_name="Storage Write Service Account")
admin = gcp.storage.BucketIAMMember("admin",
bucket=example.name,
role="roles/storage.admin",
member=storage_write_service_account.email.apply(lambda email: f"serviceAccount:{email}"))
example_subscription = gcp.pubsub.Subscription("example",
name="example-subscription",
topic=example_topic.id,
cloud_storage_config=gcp.pubsub.SubscriptionCloudStorageConfigArgs(
bucket=example.name,
filename_prefix="pre-",
filename_suffix="-_75413",
filename_datetime_format="YYYY-MM-DD/hh_mm_ssZ",
max_bytes=1000,
max_duration="300s",
service_account_email=storage_write_service_account.email,
),
opts = pulumi.ResourceOptions(depends_on=[
storage_write_service_account,
example,
admin,
]))
project = gcp.organizations.get_project()
package main
import (
"fmt"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/organizations"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/pubsub"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/serviceaccount"
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/storage"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
example, err := storage.NewBucket(ctx, "example", &storage.BucketArgs{
Name: pulumi.String("example-bucket"),
Location: pulumi.String("US"),
UniformBucketLevelAccess: pulumi.Bool(true),
})
if err != nil {
return err
}
exampleTopic, err := pubsub.NewTopic(ctx, "example", &pubsub.TopicArgs{
Name: pulumi.String("example-topic"),
})
if err != nil {
return err
}
storageWriteServiceAccount, err := serviceaccount.NewAccount(ctx, "storage_write_service_account", &serviceaccount.AccountArgs{
AccountId: pulumi.String("example-stw"),
DisplayName: pulumi.String("Storage Write Service Account"),
})
if err != nil {
return err
}
admin, err := storage.NewBucketIAMMember(ctx, "admin", &storage.BucketIAMMemberArgs{
Bucket: example.Name,
Role: pulumi.String("roles/storage.admin"),
Member: storageWriteServiceAccount.Email.ApplyT(func(email string) (string, error) {
return fmt.Sprintf("serviceAccount:%v", email), nil
}).(pulumi.StringOutput),
})
if err != nil {
return err
}
_, err = pubsub.NewSubscription(ctx, "example", &pubsub.SubscriptionArgs{
Name: pulumi.String("example-subscription"),
Topic: exampleTopic.ID(),
CloudStorageConfig: &pubsub.SubscriptionCloudStorageConfigArgs{
Bucket: example.Name,
FilenamePrefix: pulumi.String("pre-"),
FilenameSuffix: pulumi.String("-_75413"),
FilenameDatetimeFormat: pulumi.String("YYYY-MM-DD/hh_mm_ssZ"),
MaxBytes: pulumi.Int(1000),
MaxDuration: pulumi.String("300s"),
ServiceAccountEmail: storageWriteServiceAccount.Email,
},
}, pulumi.DependsOn([]pulumi.Resource{
storageWriteServiceAccount,
example,
admin,
}))
if err != nil {
return err
}
_, err = organizations.LookupProject(ctx, nil, nil)
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var example = new Gcp.Storage.Bucket("example", new()
{
Name = "example-bucket",
Location = "US",
UniformBucketLevelAccess = true,
});
var exampleTopic = new Gcp.PubSub.Topic("example", new()
{
Name = "example-topic",
});
var storageWriteServiceAccount = new Gcp.ServiceAccount.Account("storage_write_service_account", new()
{
AccountId = "example-stw",
DisplayName = "Storage Write Service Account",
});
var admin = new Gcp.Storage.BucketIAMMember("admin", new()
{
Bucket = example.Name,
Role = "roles/storage.admin",
Member = storageWriteServiceAccount.Email.Apply(email => $"serviceAccount:{email}"),
});
var exampleSubscription = new Gcp.PubSub.Subscription("example", new()
{
Name = "example-subscription",
Topic = exampleTopic.Id,
CloudStorageConfig = new Gcp.PubSub.Inputs.SubscriptionCloudStorageConfigArgs
{
Bucket = example.Name,
FilenamePrefix = "pre-",
FilenameSuffix = "-_75413",
FilenameDatetimeFormat = "YYYY-MM-DD/hh_mm_ssZ",
MaxBytes = 1000,
MaxDuration = "300s",
ServiceAccountEmail = storageWriteServiceAccount.Email,
},
}, new CustomResourceOptions
{
DependsOn =
{
storageWriteServiceAccount,
example,
admin,
},
});
var project = Gcp.Organizations.GetProject.Invoke();
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.storage.Bucket;
import com.pulumi.gcp.storage.BucketArgs;
import com.pulumi.gcp.pubsub.Topic;
import com.pulumi.gcp.pubsub.TopicArgs;
import com.pulumi.gcp.serviceaccount.Account;
import com.pulumi.gcp.serviceaccount.AccountArgs;
import com.pulumi.gcp.storage.BucketIAMMember;
import com.pulumi.gcp.storage.BucketIAMMemberArgs;
import com.pulumi.gcp.pubsub.Subscription;
import com.pulumi.gcp.pubsub.SubscriptionArgs;
import com.pulumi.gcp.pubsub.inputs.SubscriptionCloudStorageConfigArgs;
import com.pulumi.gcp.organizations.OrganizationsFunctions;
import com.pulumi.gcp.organizations.inputs.GetProjectArgs;
import com.pulumi.resources.CustomResourceOptions;
import java.util.List;
import java.util.ArrayList;
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 example = new Bucket("example", BucketArgs.builder()
.name("example-bucket")
.location("US")
.uniformBucketLevelAccess(true)
.build());
var exampleTopic = new Topic("exampleTopic", TopicArgs.builder()
.name("example-topic")
.build());
var storageWriteServiceAccount = new Account("storageWriteServiceAccount", AccountArgs.builder()
.accountId("example-stw")
.displayName("Storage Write Service Account")
.build());
var admin = new BucketIAMMember("admin", BucketIAMMemberArgs.builder()
.bucket(example.name())
.role("roles/storage.admin")
.member(storageWriteServiceAccount.email().applyValue(email -> String.format("serviceAccount:%s", email)))
.build());
var exampleSubscription = new Subscription("exampleSubscription", SubscriptionArgs.builder()
.name("example-subscription")
.topic(exampleTopic.id())
.cloudStorageConfig(SubscriptionCloudStorageConfigArgs.builder()
.bucket(example.name())
.filenamePrefix("pre-")
.filenameSuffix("-_75413")
.filenameDatetimeFormat("YYYY-MM-DD/hh_mm_ssZ")
.maxBytes(1000)
.maxDuration("300s")
.serviceAccountEmail(storageWriteServiceAccount.email())
.build())
.build(), CustomResourceOptions.builder()
.dependsOn(
storageWriteServiceAccount,
example,
admin)
.build());
final var project = OrganizationsFunctions.getProject();
}
}
resources:
example:
type: gcp:storage:Bucket
properties:
name: example-bucket
location: US
uniformBucketLevelAccess: true
exampleTopic:
type: gcp:pubsub:Topic
name: example
properties:
name: example-topic
exampleSubscription:
type: gcp:pubsub:Subscription
name: example
properties:
name: example-subscription
topic: ${exampleTopic.id}
cloudStorageConfig:
bucket: ${example.name}
filenamePrefix: pre-
filenameSuffix: -_75413
filenameDatetimeFormat: YYYY-MM-DD/hh_mm_ssZ
maxBytes: 1000
maxDuration: 300s
serviceAccountEmail: ${storageWriteServiceAccount.email}
options:
dependson:
- ${storageWriteServiceAccount}
- ${example}
- ${admin}
storageWriteServiceAccount:
type: gcp:serviceaccount:Account
name: storage_write_service_account
properties:
accountId: example-stw
displayName: Storage Write Service Account
admin:
type: gcp:storage:BucketIAMMember
properties:
bucket: ${example.name}
role: roles/storage.admin
member: serviceAccount:${storageWriteServiceAccount.email}
variables:
project:
fn::invoke:
Function: gcp:organizations:getProject
Arguments: {}
Create Subscription Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Subscription(name: string, args: SubscriptionArgs, opts?: CustomResourceOptions);
@overload
def Subscription(resource_name: str,
args: SubscriptionArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Subscription(resource_name: str,
opts: Optional[ResourceOptions] = None,
topic: Optional[str] = None,
labels: Optional[Mapping[str, str]] = None,
message_retention_duration: Optional[str] = None,
dead_letter_policy: Optional[SubscriptionDeadLetterPolicyArgs] = None,
enable_exactly_once_delivery: Optional[bool] = None,
enable_message_ordering: Optional[bool] = None,
expiration_policy: Optional[SubscriptionExpirationPolicyArgs] = None,
cloud_storage_config: Optional[SubscriptionCloudStorageConfigArgs] = None,
ack_deadline_seconds: Optional[int] = None,
filter: Optional[str] = None,
name: Optional[str] = None,
project: Optional[str] = None,
push_config: Optional[SubscriptionPushConfigArgs] = None,
retain_acked_messages: Optional[bool] = None,
retry_policy: Optional[SubscriptionRetryPolicyArgs] = None,
bigquery_config: Optional[SubscriptionBigqueryConfigArgs] = None)
func NewSubscription(ctx *Context, name string, args SubscriptionArgs, opts ...ResourceOption) (*Subscription, error)
public Subscription(string name, SubscriptionArgs args, CustomResourceOptions? opts = null)
public Subscription(String name, SubscriptionArgs args)
public Subscription(String name, SubscriptionArgs args, CustomResourceOptions options)
type: gcp:pubsub:Subscription
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args SubscriptionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args SubscriptionArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args SubscriptionArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args SubscriptionArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args SubscriptionArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var subscriptionResource = new Gcp.PubSub.Subscription("subscriptionResource", new()
{
Topic = "string",
Labels =
{
{ "string", "string" },
},
MessageRetentionDuration = "string",
DeadLetterPolicy = new Gcp.PubSub.Inputs.SubscriptionDeadLetterPolicyArgs
{
DeadLetterTopic = "string",
MaxDeliveryAttempts = 0,
},
EnableExactlyOnceDelivery = false,
EnableMessageOrdering = false,
ExpirationPolicy = new Gcp.PubSub.Inputs.SubscriptionExpirationPolicyArgs
{
Ttl = "string",
},
CloudStorageConfig = new Gcp.PubSub.Inputs.SubscriptionCloudStorageConfigArgs
{
Bucket = "string",
AvroConfig = new Gcp.PubSub.Inputs.SubscriptionCloudStorageConfigAvroConfigArgs
{
WriteMetadata = false,
},
FilenameDatetimeFormat = "string",
FilenamePrefix = "string",
FilenameSuffix = "string",
MaxBytes = 0,
MaxDuration = "string",
ServiceAccountEmail = "string",
State = "string",
},
AckDeadlineSeconds = 0,
Filter = "string",
Name = "string",
Project = "string",
PushConfig = new Gcp.PubSub.Inputs.SubscriptionPushConfigArgs
{
PushEndpoint = "string",
Attributes =
{
{ "string", "string" },
},
NoWrapper = new Gcp.PubSub.Inputs.SubscriptionPushConfigNoWrapperArgs
{
WriteMetadata = false,
},
OidcToken = new Gcp.PubSub.Inputs.SubscriptionPushConfigOidcTokenArgs
{
ServiceAccountEmail = "string",
Audience = "string",
},
},
RetainAckedMessages = false,
RetryPolicy = new Gcp.PubSub.Inputs.SubscriptionRetryPolicyArgs
{
MaximumBackoff = "string",
MinimumBackoff = "string",
},
BigqueryConfig = new Gcp.PubSub.Inputs.SubscriptionBigqueryConfigArgs
{
Table = "string",
DropUnknownFields = false,
ServiceAccountEmail = "string",
UseTableSchema = false,
UseTopicSchema = false,
WriteMetadata = false,
},
});
example, err := pubsub.NewSubscription(ctx, "subscriptionResource", &pubsub.SubscriptionArgs{
Topic: pulumi.String("string"),
Labels: pulumi.StringMap{
"string": pulumi.String("string"),
},
MessageRetentionDuration: pulumi.String("string"),
DeadLetterPolicy: &pubsub.SubscriptionDeadLetterPolicyArgs{
DeadLetterTopic: pulumi.String("string"),
MaxDeliveryAttempts: pulumi.Int(0),
},
EnableExactlyOnceDelivery: pulumi.Bool(false),
EnableMessageOrdering: pulumi.Bool(false),
ExpirationPolicy: &pubsub.SubscriptionExpirationPolicyArgs{
Ttl: pulumi.String("string"),
},
CloudStorageConfig: &pubsub.SubscriptionCloudStorageConfigArgs{
Bucket: pulumi.String("string"),
AvroConfig: &pubsub.SubscriptionCloudStorageConfigAvroConfigArgs{
WriteMetadata: pulumi.Bool(false),
},
FilenameDatetimeFormat: pulumi.String("string"),
FilenamePrefix: pulumi.String("string"),
FilenameSuffix: pulumi.String("string"),
MaxBytes: pulumi.Int(0),
MaxDuration: pulumi.String("string"),
ServiceAccountEmail: pulumi.String("string"),
State: pulumi.String("string"),
},
AckDeadlineSeconds: pulumi.Int(0),
Filter: pulumi.String("string"),
Name: pulumi.String("string"),
Project: pulumi.String("string"),
PushConfig: &pubsub.SubscriptionPushConfigArgs{
PushEndpoint: pulumi.String("string"),
Attributes: pulumi.StringMap{
"string": pulumi.String("string"),
},
NoWrapper: &pubsub.SubscriptionPushConfigNoWrapperArgs{
WriteMetadata: pulumi.Bool(false),
},
OidcToken: &pubsub.SubscriptionPushConfigOidcTokenArgs{
ServiceAccountEmail: pulumi.String("string"),
Audience: pulumi.String("string"),
},
},
RetainAckedMessages: pulumi.Bool(false),
RetryPolicy: &pubsub.SubscriptionRetryPolicyArgs{
MaximumBackoff: pulumi.String("string"),
MinimumBackoff: pulumi.String("string"),
},
BigqueryConfig: &pubsub.SubscriptionBigqueryConfigArgs{
Table: pulumi.String("string"),
DropUnknownFields: pulumi.Bool(false),
ServiceAccountEmail: pulumi.String("string"),
UseTableSchema: pulumi.Bool(false),
UseTopicSchema: pulumi.Bool(false),
WriteMetadata: pulumi.Bool(false),
},
})
var subscriptionResource = new Subscription("subscriptionResource", SubscriptionArgs.builder()
.topic("string")
.labels(Map.of("string", "string"))
.messageRetentionDuration("string")
.deadLetterPolicy(SubscriptionDeadLetterPolicyArgs.builder()
.deadLetterTopic("string")
.maxDeliveryAttempts(0)
.build())
.enableExactlyOnceDelivery(false)
.enableMessageOrdering(false)
.expirationPolicy(SubscriptionExpirationPolicyArgs.builder()
.ttl("string")
.build())
.cloudStorageConfig(SubscriptionCloudStorageConfigArgs.builder()
.bucket("string")
.avroConfig(SubscriptionCloudStorageConfigAvroConfigArgs.builder()
.writeMetadata(false)
.build())
.filenameDatetimeFormat("string")
.filenamePrefix("string")
.filenameSuffix("string")
.maxBytes(0)
.maxDuration("string")
.serviceAccountEmail("string")
.state("string")
.build())
.ackDeadlineSeconds(0)
.filter("string")
.name("string")
.project("string")
.pushConfig(SubscriptionPushConfigArgs.builder()
.pushEndpoint("string")
.attributes(Map.of("string", "string"))
.noWrapper(SubscriptionPushConfigNoWrapperArgs.builder()
.writeMetadata(false)
.build())
.oidcToken(SubscriptionPushConfigOidcTokenArgs.builder()
.serviceAccountEmail("string")
.audience("string")
.build())
.build())
.retainAckedMessages(false)
.retryPolicy(SubscriptionRetryPolicyArgs.builder()
.maximumBackoff("string")
.minimumBackoff("string")
.build())
.bigqueryConfig(SubscriptionBigqueryConfigArgs.builder()
.table("string")
.dropUnknownFields(false)
.serviceAccountEmail("string")
.useTableSchema(false)
.useTopicSchema(false)
.writeMetadata(false)
.build())
.build());
subscription_resource = gcp.pubsub.Subscription("subscriptionResource",
topic="string",
labels={
"string": "string",
},
message_retention_duration="string",
dead_letter_policy=gcp.pubsub.SubscriptionDeadLetterPolicyArgs(
dead_letter_topic="string",
max_delivery_attempts=0,
),
enable_exactly_once_delivery=False,
enable_message_ordering=False,
expiration_policy=gcp.pubsub.SubscriptionExpirationPolicyArgs(
ttl="string",
),
cloud_storage_config=gcp.pubsub.SubscriptionCloudStorageConfigArgs(
bucket="string",
avro_config=gcp.pubsub.SubscriptionCloudStorageConfigAvroConfigArgs(
write_metadata=False,
),
filename_datetime_format="string",
filename_prefix="string",
filename_suffix="string",
max_bytes=0,
max_duration="string",
service_account_email="string",
state="string",
),
ack_deadline_seconds=0,
filter="string",
name="string",
project="string",
push_config=gcp.pubsub.SubscriptionPushConfigArgs(
push_endpoint="string",
attributes={
"string": "string",
},
no_wrapper=gcp.pubsub.SubscriptionPushConfigNoWrapperArgs(
write_metadata=False,
),
oidc_token=gcp.pubsub.SubscriptionPushConfigOidcTokenArgs(
service_account_email="string",
audience="string",
),
),
retain_acked_messages=False,
retry_policy=gcp.pubsub.SubscriptionRetryPolicyArgs(
maximum_backoff="string",
minimum_backoff="string",
),
bigquery_config=gcp.pubsub.SubscriptionBigqueryConfigArgs(
table="string",
drop_unknown_fields=False,
service_account_email="string",
use_table_schema=False,
use_topic_schema=False,
write_metadata=False,
))
const subscriptionResource = new gcp.pubsub.Subscription("subscriptionResource", {
topic: "string",
labels: {
string: "string",
},
messageRetentionDuration: "string",
deadLetterPolicy: {
deadLetterTopic: "string",
maxDeliveryAttempts: 0,
},
enableExactlyOnceDelivery: false,
enableMessageOrdering: false,
expirationPolicy: {
ttl: "string",
},
cloudStorageConfig: {
bucket: "string",
avroConfig: {
writeMetadata: false,
},
filenameDatetimeFormat: "string",
filenamePrefix: "string",
filenameSuffix: "string",
maxBytes: 0,
maxDuration: "string",
serviceAccountEmail: "string",
state: "string",
},
ackDeadlineSeconds: 0,
filter: "string",
name: "string",
project: "string",
pushConfig: {
pushEndpoint: "string",
attributes: {
string: "string",
},
noWrapper: {
writeMetadata: false,
},
oidcToken: {
serviceAccountEmail: "string",
audience: "string",
},
},
retainAckedMessages: false,
retryPolicy: {
maximumBackoff: "string",
minimumBackoff: "string",
},
bigqueryConfig: {
table: "string",
dropUnknownFields: false,
serviceAccountEmail: "string",
useTableSchema: false,
useTopicSchema: false,
writeMetadata: false,
},
});
type: gcp:pubsub:Subscription
properties:
ackDeadlineSeconds: 0
bigqueryConfig:
dropUnknownFields: false
serviceAccountEmail: string
table: string
useTableSchema: false
useTopicSchema: false
writeMetadata: false
cloudStorageConfig:
avroConfig:
writeMetadata: false
bucket: string
filenameDatetimeFormat: string
filenamePrefix: string
filenameSuffix: string
maxBytes: 0
maxDuration: string
serviceAccountEmail: string
state: string
deadLetterPolicy:
deadLetterTopic: string
maxDeliveryAttempts: 0
enableExactlyOnceDelivery: false
enableMessageOrdering: false
expirationPolicy:
ttl: string
filter: string
labels:
string: string
messageRetentionDuration: string
name: string
project: string
pushConfig:
attributes:
string: string
noWrapper:
writeMetadata: false
oidcToken:
audience: string
serviceAccountEmail: string
pushEndpoint: string
retainAckedMessages: false
retryPolicy:
maximumBackoff: string
minimumBackoff: string
topic: string
Subscription Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The Subscription resource accepts the following input properties:
- Topic string
- A reference to a Topic resource, of the form projects/{project}/topics/{{name}}
(as in the id property of a google_pubsub_topic), or just a topic name if
the topic is in the same project as the subscription.
- Ack
Deadline intSeconds - This value is the maximum time after a subscriber receives a message before the subscriber should acknowledge the message. After message delivery but before the ack deadline expires and before the message is acknowledged, it is an outstanding message and will not be delivered again during that time (on a best-effort basis). For pull subscriptions, this value is used as the initial value for the ack deadline. To override this value for a given message, call subscriptions.modifyAckDeadline with the corresponding ackId if using pull. The minimum custom deadline you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds (10 minutes). If this parameter is 0, a default value of 10 seconds is used. For push delivery, this value is also used to set the request timeout for the call to the push endpoint. If the subscriber never acknowledges the message, the Pub/Sub system will eventually redeliver the message.
- Bigquery
Config SubscriptionBigquery Config - If delivery to BigQuery is used with this subscription, this field is used to configure it. Either pushConfig, bigQueryConfig or cloudStorageConfig can be set, but not combined. If all three are empty, then the subscriber will pull and ack messages using API methods. Structure is documented below.
- Cloud
Storage SubscriptionConfig Cloud Storage Config - If delivery to Cloud Storage is used with this subscription, this field is used to configure it. Either pushConfig, bigQueryConfig or cloudStorageConfig can be set, but not combined. If all three are empty, then the subscriber will pull and ack messages using API methods. Structure is documented below.
- Dead
Letter SubscriptionPolicy Dead Letter Policy - A policy that specifies the conditions for dead lettering messages in this subscription. If dead_letter_policy is not set, dead lettering is disabled. The Cloud Pub/Sub service account associated with this subscription's parent project (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have permission to Acknowledge() messages on this subscription. Structure is documented below.
- Enable
Exactly boolOnce Delivery - If
true
, Pub/Sub provides the following guarantees for the delivery of a message with a given value of messageId on this Subscriptions':- The message sent to a subscriber is guaranteed not to be resent before the message's acknowledgement deadline expires.
- An acknowledged message will not be resent to a subscriber.
Note that subscribers may still receive multiple copies of a message when
enable_exactly_once_delivery
is true if the message was published multiple times by a publisher client. These copies are considered distinct by Pub/Sub and have distinct messageId values
- Enable
Message boolOrdering - If
true
, messages published with the same orderingKey in PubsubMessage will be delivered to the subscribers in the order in which they are received by the Pub/Sub system. Otherwise, they may be delivered in any order. - Expiration
Policy SubscriptionExpiration Policy - A policy that specifies the conditions for this subscription's expiration. A subscription is considered active as long as any connected subscriber is successfully consuming messages from the subscription or is issuing operations on the subscription. If expirationPolicy is not set, a default policy with ttl of 31 days will be used. If it is set but ttl is "", the resource never expires. The minimum allowed value for expirationPolicy.ttl is 1 day. Structure is documented below.
- Filter string
- The subscription only delivers the messages that match the filter. Pub/Sub automatically acknowledges the messages that don't match the filter. You can filter messages by their attributes. The maximum length of a filter is 256 bytes. After creating the subscription, you can't modify the filter.
- Labels Dictionary<string, string>
A set of key/value label pairs to assign to this Subscription.
Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field
effective_labels
for all of the labels present on the resource.- Message
Retention stringDuration - How long to retain unacknowledged messages in the subscription's
backlog, from the moment a message is published. If
retain_acked_messages is true, then this also configures the retention
of acknowledged messages, and thus configures how far back in time a
subscriptions.seek can be done. Defaults to 7 days. Cannot be more
than 7 days (
"604800s"
) or less than 10 minutes ("600s"
). A duration in seconds with up to nine fractional digits, terminated by 's'. Example:"600.5s"
. - Name string
- Name of the subscription.
- Project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- Push
Config SubscriptionPush Config - If push delivery is used with this subscription, this field is used to configure it. An empty pushConfig signifies that the subscriber will pull and ack messages using API methods. Structure is documented below.
- Retain
Acked boolMessages - Indicates whether to retain acknowledged messages. If
true
, then messages are not expunged from the subscription's backlog, even if they are acknowledged, until they fall out of the messageRetentionDuration window. - Retry
Policy SubscriptionRetry Policy - A policy that specifies how Pub/Sub retries message delivery for this subscription. If not set, the default retry policy is applied. This generally implies that messages will be retried as soon as possible for healthy subscribers. RetryPolicy will be triggered on NACKs or acknowledgement deadline exceeded events for a given message Structure is documented below.
- Topic string
- A reference to a Topic resource, of the form projects/{project}/topics/{{name}}
(as in the id property of a google_pubsub_topic), or just a topic name if
the topic is in the same project as the subscription.
- Ack
Deadline intSeconds - This value is the maximum time after a subscriber receives a message before the subscriber should acknowledge the message. After message delivery but before the ack deadline expires and before the message is acknowledged, it is an outstanding message and will not be delivered again during that time (on a best-effort basis). For pull subscriptions, this value is used as the initial value for the ack deadline. To override this value for a given message, call subscriptions.modifyAckDeadline with the corresponding ackId if using pull. The minimum custom deadline you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds (10 minutes). If this parameter is 0, a default value of 10 seconds is used. For push delivery, this value is also used to set the request timeout for the call to the push endpoint. If the subscriber never acknowledges the message, the Pub/Sub system will eventually redeliver the message.
- Bigquery
Config SubscriptionBigquery Config Args - If delivery to BigQuery is used with this subscription, this field is used to configure it. Either pushConfig, bigQueryConfig or cloudStorageConfig can be set, but not combined. If all three are empty, then the subscriber will pull and ack messages using API methods. Structure is documented below.
- Cloud
Storage SubscriptionConfig Cloud Storage Config Args - If delivery to Cloud Storage is used with this subscription, this field is used to configure it. Either pushConfig, bigQueryConfig or cloudStorageConfig can be set, but not combined. If all three are empty, then the subscriber will pull and ack messages using API methods. Structure is documented below.
- Dead
Letter SubscriptionPolicy Dead Letter Policy Args - A policy that specifies the conditions for dead lettering messages in this subscription. If dead_letter_policy is not set, dead lettering is disabled. The Cloud Pub/Sub service account associated with this subscription's parent project (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have permission to Acknowledge() messages on this subscription. Structure is documented below.
- Enable
Exactly boolOnce Delivery - If
true
, Pub/Sub provides the following guarantees for the delivery of a message with a given value of messageId on this Subscriptions':- The message sent to a subscriber is guaranteed not to be resent before the message's acknowledgement deadline expires.
- An acknowledged message will not be resent to a subscriber.
Note that subscribers may still receive multiple copies of a message when
enable_exactly_once_delivery
is true if the message was published multiple times by a publisher client. These copies are considered distinct by Pub/Sub and have distinct messageId values
- Enable
Message boolOrdering - If
true
, messages published with the same orderingKey in PubsubMessage will be delivered to the subscribers in the order in which they are received by the Pub/Sub system. Otherwise, they may be delivered in any order. - Expiration
Policy SubscriptionExpiration Policy Args - A policy that specifies the conditions for this subscription's expiration. A subscription is considered active as long as any connected subscriber is successfully consuming messages from the subscription or is issuing operations on the subscription. If expirationPolicy is not set, a default policy with ttl of 31 days will be used. If it is set but ttl is "", the resource never expires. The minimum allowed value for expirationPolicy.ttl is 1 day. Structure is documented below.
- Filter string
- The subscription only delivers the messages that match the filter. Pub/Sub automatically acknowledges the messages that don't match the filter. You can filter messages by their attributes. The maximum length of a filter is 256 bytes. After creating the subscription, you can't modify the filter.
- Labels map[string]string
A set of key/value label pairs to assign to this Subscription.
Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field
effective_labels
for all of the labels present on the resource.- Message
Retention stringDuration - How long to retain unacknowledged messages in the subscription's
backlog, from the moment a message is published. If
retain_acked_messages is true, then this also configures the retention
of acknowledged messages, and thus configures how far back in time a
subscriptions.seek can be done. Defaults to 7 days. Cannot be more
than 7 days (
"604800s"
) or less than 10 minutes ("600s"
). A duration in seconds with up to nine fractional digits, terminated by 's'. Example:"600.5s"
. - Name string
- Name of the subscription.
- Project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- Push
Config SubscriptionPush Config Args - If push delivery is used with this subscription, this field is used to configure it. An empty pushConfig signifies that the subscriber will pull and ack messages using API methods. Structure is documented below.
- Retain
Acked boolMessages - Indicates whether to retain acknowledged messages. If
true
, then messages are not expunged from the subscription's backlog, even if they are acknowledged, until they fall out of the messageRetentionDuration window. - Retry
Policy SubscriptionRetry Policy Args - A policy that specifies how Pub/Sub retries message delivery for this subscription. If not set, the default retry policy is applied. This generally implies that messages will be retried as soon as possible for healthy subscribers. RetryPolicy will be triggered on NACKs or acknowledgement deadline exceeded events for a given message Structure is documented below.
- topic String
- A reference to a Topic resource, of the form projects/{project}/topics/{{name}}
(as in the id property of a google_pubsub_topic), or just a topic name if
the topic is in the same project as the subscription.
- ack
Deadline IntegerSeconds - This value is the maximum time after a subscriber receives a message before the subscriber should acknowledge the message. After message delivery but before the ack deadline expires and before the message is acknowledged, it is an outstanding message and will not be delivered again during that time (on a best-effort basis). For pull subscriptions, this value is used as the initial value for the ack deadline. To override this value for a given message, call subscriptions.modifyAckDeadline with the corresponding ackId if using pull. The minimum custom deadline you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds (10 minutes). If this parameter is 0, a default value of 10 seconds is used. For push delivery, this value is also used to set the request timeout for the call to the push endpoint. If the subscriber never acknowledges the message, the Pub/Sub system will eventually redeliver the message.
- bigquery
Config SubscriptionBigquery Config - If delivery to BigQuery is used with this subscription, this field is used to configure it. Either pushConfig, bigQueryConfig or cloudStorageConfig can be set, but not combined. If all three are empty, then the subscriber will pull and ack messages using API methods. Structure is documented below.
- cloud
Storage SubscriptionConfig Cloud Storage Config - If delivery to Cloud Storage is used with this subscription, this field is used to configure it. Either pushConfig, bigQueryConfig or cloudStorageConfig can be set, but not combined. If all three are empty, then the subscriber will pull and ack messages using API methods. Structure is documented below.
- dead
Letter SubscriptionPolicy Dead Letter Policy - A policy that specifies the conditions for dead lettering messages in this subscription. If dead_letter_policy is not set, dead lettering is disabled. The Cloud Pub/Sub service account associated with this subscription's parent project (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have permission to Acknowledge() messages on this subscription. Structure is documented below.
- enable
Exactly BooleanOnce Delivery - If
true
, Pub/Sub provides the following guarantees for the delivery of a message with a given value of messageId on this Subscriptions':- The message sent to a subscriber is guaranteed not to be resent before the message's acknowledgement deadline expires.
- An acknowledged message will not be resent to a subscriber.
Note that subscribers may still receive multiple copies of a message when
enable_exactly_once_delivery
is true if the message was published multiple times by a publisher client. These copies are considered distinct by Pub/Sub and have distinct messageId values
- enable
Message BooleanOrdering - If
true
, messages published with the same orderingKey in PubsubMessage will be delivered to the subscribers in the order in which they are received by the Pub/Sub system. Otherwise, they may be delivered in any order. - expiration
Policy SubscriptionExpiration Policy - A policy that specifies the conditions for this subscription's expiration. A subscription is considered active as long as any connected subscriber is successfully consuming messages from the subscription or is issuing operations on the subscription. If expirationPolicy is not set, a default policy with ttl of 31 days will be used. If it is set but ttl is "", the resource never expires. The minimum allowed value for expirationPolicy.ttl is 1 day. Structure is documented below.
- filter String
- The subscription only delivers the messages that match the filter. Pub/Sub automatically acknowledges the messages that don't match the filter. You can filter messages by their attributes. The maximum length of a filter is 256 bytes. After creating the subscription, you can't modify the filter.
- labels Map<String,String>
A set of key/value label pairs to assign to this Subscription.
Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field
effective_labels
for all of the labels present on the resource.- message
Retention StringDuration - How long to retain unacknowledged messages in the subscription's
backlog, from the moment a message is published. If
retain_acked_messages is true, then this also configures the retention
of acknowledged messages, and thus configures how far back in time a
subscriptions.seek can be done. Defaults to 7 days. Cannot be more
than 7 days (
"604800s"
) or less than 10 minutes ("600s"
). A duration in seconds with up to nine fractional digits, terminated by 's'. Example:"600.5s"
. - name String
- Name of the subscription.
- project String
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- push
Config SubscriptionPush Config - If push delivery is used with this subscription, this field is used to configure it. An empty pushConfig signifies that the subscriber will pull and ack messages using API methods. Structure is documented below.
- retain
Acked BooleanMessages - Indicates whether to retain acknowledged messages. If
true
, then messages are not expunged from the subscription's backlog, even if they are acknowledged, until they fall out of the messageRetentionDuration window. - retry
Policy SubscriptionRetry Policy - A policy that specifies how Pub/Sub retries message delivery for this subscription. If not set, the default retry policy is applied. This generally implies that messages will be retried as soon as possible for healthy subscribers. RetryPolicy will be triggered on NACKs or acknowledgement deadline exceeded events for a given message Structure is documented below.
- topic string
- A reference to a Topic resource, of the form projects/{project}/topics/{{name}}
(as in the id property of a google_pubsub_topic), or just a topic name if
the topic is in the same project as the subscription.
- ack
Deadline numberSeconds - This value is the maximum time after a subscriber receives a message before the subscriber should acknowledge the message. After message delivery but before the ack deadline expires and before the message is acknowledged, it is an outstanding message and will not be delivered again during that time (on a best-effort basis). For pull subscriptions, this value is used as the initial value for the ack deadline. To override this value for a given message, call subscriptions.modifyAckDeadline with the corresponding ackId if using pull. The minimum custom deadline you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds (10 minutes). If this parameter is 0, a default value of 10 seconds is used. For push delivery, this value is also used to set the request timeout for the call to the push endpoint. If the subscriber never acknowledges the message, the Pub/Sub system will eventually redeliver the message.
- bigquery
Config SubscriptionBigquery Config - If delivery to BigQuery is used with this subscription, this field is used to configure it. Either pushConfig, bigQueryConfig or cloudStorageConfig can be set, but not combined. If all three are empty, then the subscriber will pull and ack messages using API methods. Structure is documented below.
- cloud
Storage SubscriptionConfig Cloud Storage Config - If delivery to Cloud Storage is used with this subscription, this field is used to configure it. Either pushConfig, bigQueryConfig or cloudStorageConfig can be set, but not combined. If all three are empty, then the subscriber will pull and ack messages using API methods. Structure is documented below.
- dead
Letter SubscriptionPolicy Dead Letter Policy - A policy that specifies the conditions for dead lettering messages in this subscription. If dead_letter_policy is not set, dead lettering is disabled. The Cloud Pub/Sub service account associated with this subscription's parent project (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have permission to Acknowledge() messages on this subscription. Structure is documented below.
- enable
Exactly booleanOnce Delivery - If
true
, Pub/Sub provides the following guarantees for the delivery of a message with a given value of messageId on this Subscriptions':- The message sent to a subscriber is guaranteed not to be resent before the message's acknowledgement deadline expires.
- An acknowledged message will not be resent to a subscriber.
Note that subscribers may still receive multiple copies of a message when
enable_exactly_once_delivery
is true if the message was published multiple times by a publisher client. These copies are considered distinct by Pub/Sub and have distinct messageId values
- enable
Message booleanOrdering - If
true
, messages published with the same orderingKey in PubsubMessage will be delivered to the subscribers in the order in which they are received by the Pub/Sub system. Otherwise, they may be delivered in any order. - expiration
Policy SubscriptionExpiration Policy - A policy that specifies the conditions for this subscription's expiration. A subscription is considered active as long as any connected subscriber is successfully consuming messages from the subscription or is issuing operations on the subscription. If expirationPolicy is not set, a default policy with ttl of 31 days will be used. If it is set but ttl is "", the resource never expires. The minimum allowed value for expirationPolicy.ttl is 1 day. Structure is documented below.
- filter string
- The subscription only delivers the messages that match the filter. Pub/Sub automatically acknowledges the messages that don't match the filter. You can filter messages by their attributes. The maximum length of a filter is 256 bytes. After creating the subscription, you can't modify the filter.
- labels {[key: string]: string}
A set of key/value label pairs to assign to this Subscription.
Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field
effective_labels
for all of the labels present on the resource.- message
Retention stringDuration - How long to retain unacknowledged messages in the subscription's
backlog, from the moment a message is published. If
retain_acked_messages is true, then this also configures the retention
of acknowledged messages, and thus configures how far back in time a
subscriptions.seek can be done. Defaults to 7 days. Cannot be more
than 7 days (
"604800s"
) or less than 10 minutes ("600s"
). A duration in seconds with up to nine fractional digits, terminated by 's'. Example:"600.5s"
. - name string
- Name of the subscription.
- project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- push
Config SubscriptionPush Config - If push delivery is used with this subscription, this field is used to configure it. An empty pushConfig signifies that the subscriber will pull and ack messages using API methods. Structure is documented below.
- retain
Acked booleanMessages - Indicates whether to retain acknowledged messages. If
true
, then messages are not expunged from the subscription's backlog, even if they are acknowledged, until they fall out of the messageRetentionDuration window. - retry
Policy SubscriptionRetry Policy - A policy that specifies how Pub/Sub retries message delivery for this subscription. If not set, the default retry policy is applied. This generally implies that messages will be retried as soon as possible for healthy subscribers. RetryPolicy will be triggered on NACKs or acknowledgement deadline exceeded events for a given message Structure is documented below.
- topic str
- A reference to a Topic resource, of the form projects/{project}/topics/{{name}}
(as in the id property of a google_pubsub_topic), or just a topic name if
the topic is in the same project as the subscription.
- ack_
deadline_ intseconds - This value is the maximum time after a subscriber receives a message before the subscriber should acknowledge the message. After message delivery but before the ack deadline expires and before the message is acknowledged, it is an outstanding message and will not be delivered again during that time (on a best-effort basis). For pull subscriptions, this value is used as the initial value for the ack deadline. To override this value for a given message, call subscriptions.modifyAckDeadline with the corresponding ackId if using pull. The minimum custom deadline you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds (10 minutes). If this parameter is 0, a default value of 10 seconds is used. For push delivery, this value is also used to set the request timeout for the call to the push endpoint. If the subscriber never acknowledges the message, the Pub/Sub system will eventually redeliver the message.
- bigquery_
config SubscriptionBigquery Config Args - If delivery to BigQuery is used with this subscription, this field is used to configure it. Either pushConfig, bigQueryConfig or cloudStorageConfig can be set, but not combined. If all three are empty, then the subscriber will pull and ack messages using API methods. Structure is documented below.
- cloud_
storage_ Subscriptionconfig Cloud Storage Config Args - If delivery to Cloud Storage is used with this subscription, this field is used to configure it. Either pushConfig, bigQueryConfig or cloudStorageConfig can be set, but not combined. If all three are empty, then the subscriber will pull and ack messages using API methods. Structure is documented below.
- dead_
letter_ Subscriptionpolicy Dead Letter Policy Args - A policy that specifies the conditions for dead lettering messages in this subscription. If dead_letter_policy is not set, dead lettering is disabled. The Cloud Pub/Sub service account associated with this subscription's parent project (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have permission to Acknowledge() messages on this subscription. Structure is documented below.
- enable_
exactly_ boolonce_ delivery - If
true
, Pub/Sub provides the following guarantees for the delivery of a message with a given value of messageId on this Subscriptions':- The message sent to a subscriber is guaranteed not to be resent before the message's acknowledgement deadline expires.
- An acknowledged message will not be resent to a subscriber.
Note that subscribers may still receive multiple copies of a message when
enable_exactly_once_delivery
is true if the message was published multiple times by a publisher client. These copies are considered distinct by Pub/Sub and have distinct messageId values
- enable_
message_ boolordering - If
true
, messages published with the same orderingKey in PubsubMessage will be delivered to the subscribers in the order in which they are received by the Pub/Sub system. Otherwise, they may be delivered in any order. - expiration_
policy SubscriptionExpiration Policy Args - A policy that specifies the conditions for this subscription's expiration. A subscription is considered active as long as any connected subscriber is successfully consuming messages from the subscription or is issuing operations on the subscription. If expirationPolicy is not set, a default policy with ttl of 31 days will be used. If it is set but ttl is "", the resource never expires. The minimum allowed value for expirationPolicy.ttl is 1 day. Structure is documented below.
- filter str
- The subscription only delivers the messages that match the filter. Pub/Sub automatically acknowledges the messages that don't match the filter. You can filter messages by their attributes. The maximum length of a filter is 256 bytes. After creating the subscription, you can't modify the filter.
- labels Mapping[str, str]
A set of key/value label pairs to assign to this Subscription.
Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field
effective_labels
for all of the labels present on the resource.- message_
retention_ strduration - How long to retain unacknowledged messages in the subscription's
backlog, from the moment a message is published. If
retain_acked_messages is true, then this also configures the retention
of acknowledged messages, and thus configures how far back in time a
subscriptions.seek can be done. Defaults to 7 days. Cannot be more
than 7 days (
"604800s"
) or less than 10 minutes ("600s"
). A duration in seconds with up to nine fractional digits, terminated by 's'. Example:"600.5s"
. - name str
- Name of the subscription.
- project str
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- push_
config SubscriptionPush Config Args - If push delivery is used with this subscription, this field is used to configure it. An empty pushConfig signifies that the subscriber will pull and ack messages using API methods. Structure is documented below.
- retain_
acked_ boolmessages - Indicates whether to retain acknowledged messages. If
true
, then messages are not expunged from the subscription's backlog, even if they are acknowledged, until they fall out of the messageRetentionDuration window. - retry_
policy SubscriptionRetry Policy Args - A policy that specifies how Pub/Sub retries message delivery for this subscription. If not set, the default retry policy is applied. This generally implies that messages will be retried as soon as possible for healthy subscribers. RetryPolicy will be triggered on NACKs or acknowledgement deadline exceeded events for a given message Structure is documented below.
- topic String
- A reference to a Topic resource, of the form projects/{project}/topics/{{name}}
(as in the id property of a google_pubsub_topic), or just a topic name if
the topic is in the same project as the subscription.
- ack
Deadline NumberSeconds - This value is the maximum time after a subscriber receives a message before the subscriber should acknowledge the message. After message delivery but before the ack deadline expires and before the message is acknowledged, it is an outstanding message and will not be delivered again during that time (on a best-effort basis). For pull subscriptions, this value is used as the initial value for the ack deadline. To override this value for a given message, call subscriptions.modifyAckDeadline with the corresponding ackId if using pull. The minimum custom deadline you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds (10 minutes). If this parameter is 0, a default value of 10 seconds is used. For push delivery, this value is also used to set the request timeout for the call to the push endpoint. If the subscriber never acknowledges the message, the Pub/Sub system will eventually redeliver the message.
- bigquery
Config Property Map - If delivery to BigQuery is used with this subscription, this field is used to configure it. Either pushConfig, bigQueryConfig or cloudStorageConfig can be set, but not combined. If all three are empty, then the subscriber will pull and ack messages using API methods. Structure is documented below.
- cloud
Storage Property MapConfig - If delivery to Cloud Storage is used with this subscription, this field is used to configure it. Either pushConfig, bigQueryConfig or cloudStorageConfig can be set, but not combined. If all three are empty, then the subscriber will pull and ack messages using API methods. Structure is documented below.
- dead
Letter Property MapPolicy - A policy that specifies the conditions for dead lettering messages in this subscription. If dead_letter_policy is not set, dead lettering is disabled. The Cloud Pub/Sub service account associated with this subscription's parent project (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have permission to Acknowledge() messages on this subscription. Structure is documented below.
- enable
Exactly BooleanOnce Delivery - If
true
, Pub/Sub provides the following guarantees for the delivery of a message with a given value of messageId on this Subscriptions':- The message sent to a subscriber is guaranteed not to be resent before the message's acknowledgement deadline expires.
- An acknowledged message will not be resent to a subscriber.
Note that subscribers may still receive multiple copies of a message when
enable_exactly_once_delivery
is true if the message was published multiple times by a publisher client. These copies are considered distinct by Pub/Sub and have distinct messageId values
- enable
Message BooleanOrdering - If
true
, messages published with the same orderingKey in PubsubMessage will be delivered to the subscribers in the order in which they are received by the Pub/Sub system. Otherwise, they may be delivered in any order. - expiration
Policy Property Map - A policy that specifies the conditions for this subscription's expiration. A subscription is considered active as long as any connected subscriber is successfully consuming messages from the subscription or is issuing operations on the subscription. If expirationPolicy is not set, a default policy with ttl of 31 days will be used. If it is set but ttl is "", the resource never expires. The minimum allowed value for expirationPolicy.ttl is 1 day. Structure is documented below.
- filter String
- The subscription only delivers the messages that match the filter. Pub/Sub automatically acknowledges the messages that don't match the filter. You can filter messages by their attributes. The maximum length of a filter is 256 bytes. After creating the subscription, you can't modify the filter.
- labels Map<String>
A set of key/value label pairs to assign to this Subscription.
Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field
effective_labels
for all of the labels present on the resource.- message
Retention StringDuration - How long to retain unacknowledged messages in the subscription's
backlog, from the moment a message is published. If
retain_acked_messages is true, then this also configures the retention
of acknowledged messages, and thus configures how far back in time a
subscriptions.seek can be done. Defaults to 7 days. Cannot be more
than 7 days (
"604800s"
) or less than 10 minutes ("600s"
). A duration in seconds with up to nine fractional digits, terminated by 's'. Example:"600.5s"
. - name String
- Name of the subscription.
- project String
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- push
Config Property Map - If push delivery is used with this subscription, this field is used to configure it. An empty pushConfig signifies that the subscriber will pull and ack messages using API methods. Structure is documented below.
- retain
Acked BooleanMessages - Indicates whether to retain acknowledged messages. If
true
, then messages are not expunged from the subscription's backlog, even if they are acknowledged, until they fall out of the messageRetentionDuration window. - retry
Policy Property Map - A policy that specifies how Pub/Sub retries message delivery for this subscription. If not set, the default retry policy is applied. This generally implies that messages will be retried as soon as possible for healthy subscribers. RetryPolicy will be triggered on NACKs or acknowledgement deadline exceeded events for a given message Structure is documented below.
Outputs
All input properties are implicitly available as output properties. Additionally, the Subscription resource produces the following output properties:
- Effective
Labels Dictionary<string, string> - All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
- Id string
- The provider-assigned unique ID for this managed resource.
- Pulumi
Labels Dictionary<string, string> - The combination of labels configured directly on the resource and default labels configured on the provider.
- Effective
Labels 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.
- Id string
- The provider-assigned unique ID for this managed resource.
- Pulumi
Labels map[string]string - The combination of labels configured directly on the resource and default labels configured on the provider.
- effective
Labels 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.
- id String
- The provider-assigned unique ID for this managed resource.
- pulumi
Labels Map<String,String> - The combination of labels configured directly on the resource and default labels configured on the provider.
- effective
Labels {[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.
- id string
- The provider-assigned unique ID for this managed resource.
- pulumi
Labels {[key: string]: string} - The combination of labels configured directly on the resource and default labels configured on the provider.
- effective_
labels Mapping[str, str] - All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
- id str
- The provider-assigned unique ID for this managed resource.
- pulumi_
labels Mapping[str, str] - The combination of labels configured directly on the resource and default labels configured on the provider.
- effective
Labels Map<String> - All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
- id String
- The provider-assigned unique ID for this managed resource.
- pulumi
Labels Map<String> - The combination of labels configured directly on the resource and default labels configured on the provider.
Look up Existing Subscription Resource
Get an existing Subscription resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: SubscriptionState, opts?: CustomResourceOptions): Subscription
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
ack_deadline_seconds: Optional[int] = None,
bigquery_config: Optional[SubscriptionBigqueryConfigArgs] = None,
cloud_storage_config: Optional[SubscriptionCloudStorageConfigArgs] = None,
dead_letter_policy: Optional[SubscriptionDeadLetterPolicyArgs] = None,
effective_labels: Optional[Mapping[str, str]] = None,
enable_exactly_once_delivery: Optional[bool] = None,
enable_message_ordering: Optional[bool] = None,
expiration_policy: Optional[SubscriptionExpirationPolicyArgs] = None,
filter: Optional[str] = None,
labels: Optional[Mapping[str, str]] = None,
message_retention_duration: Optional[str] = None,
name: Optional[str] = None,
project: Optional[str] = None,
pulumi_labels: Optional[Mapping[str, str]] = None,
push_config: Optional[SubscriptionPushConfigArgs] = None,
retain_acked_messages: Optional[bool] = None,
retry_policy: Optional[SubscriptionRetryPolicyArgs] = None,
topic: Optional[str] = None) -> Subscription
func GetSubscription(ctx *Context, name string, id IDInput, state *SubscriptionState, opts ...ResourceOption) (*Subscription, error)
public static Subscription Get(string name, Input<string> id, SubscriptionState? state, CustomResourceOptions? opts = null)
public static Subscription get(String name, Output<String> id, SubscriptionState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Ack
Deadline intSeconds - This value is the maximum time after a subscriber receives a message before the subscriber should acknowledge the message. After message delivery but before the ack deadline expires and before the message is acknowledged, it is an outstanding message and will not be delivered again during that time (on a best-effort basis). For pull subscriptions, this value is used as the initial value for the ack deadline. To override this value for a given message, call subscriptions.modifyAckDeadline with the corresponding ackId if using pull. The minimum custom deadline you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds (10 minutes). If this parameter is 0, a default value of 10 seconds is used. For push delivery, this value is also used to set the request timeout for the call to the push endpoint. If the subscriber never acknowledges the message, the Pub/Sub system will eventually redeliver the message.
- Bigquery
Config SubscriptionBigquery Config - If delivery to BigQuery is used with this subscription, this field is used to configure it. Either pushConfig, bigQueryConfig or cloudStorageConfig can be set, but not combined. If all three are empty, then the subscriber will pull and ack messages using API methods. Structure is documented below.
- Cloud
Storage SubscriptionConfig Cloud Storage Config - If delivery to Cloud Storage is used with this subscription, this field is used to configure it. Either pushConfig, bigQueryConfig or cloudStorageConfig can be set, but not combined. If all three are empty, then the subscriber will pull and ack messages using API methods. Structure is documented below.
- Dead
Letter SubscriptionPolicy Dead Letter Policy - A policy that specifies the conditions for dead lettering messages in this subscription. If dead_letter_policy is not set, dead lettering is disabled. The Cloud Pub/Sub service account associated with this subscription's parent project (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have permission to Acknowledge() messages on this subscription. Structure is documented below.
- Effective
Labels Dictionary<string, string> - All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
- Enable
Exactly boolOnce Delivery - If
true
, Pub/Sub provides the following guarantees for the delivery of a message with a given value of messageId on this Subscriptions':- The message sent to a subscriber is guaranteed not to be resent before the message's acknowledgement deadline expires.
- An acknowledged message will not be resent to a subscriber.
Note that subscribers may still receive multiple copies of a message when
enable_exactly_once_delivery
is true if the message was published multiple times by a publisher client. These copies are considered distinct by Pub/Sub and have distinct messageId values
- Enable
Message boolOrdering - If
true
, messages published with the same orderingKey in PubsubMessage will be delivered to the subscribers in the order in which they are received by the Pub/Sub system. Otherwise, they may be delivered in any order. - Expiration
Policy SubscriptionExpiration Policy - A policy that specifies the conditions for this subscription's expiration. A subscription is considered active as long as any connected subscriber is successfully consuming messages from the subscription or is issuing operations on the subscription. If expirationPolicy is not set, a default policy with ttl of 31 days will be used. If it is set but ttl is "", the resource never expires. The minimum allowed value for expirationPolicy.ttl is 1 day. Structure is documented below.
- Filter string
- The subscription only delivers the messages that match the filter. Pub/Sub automatically acknowledges the messages that don't match the filter. You can filter messages by their attributes. The maximum length of a filter is 256 bytes. After creating the subscription, you can't modify the filter.
- Labels Dictionary<string, string>
A set of key/value label pairs to assign to this Subscription.
Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field
effective_labels
for all of the labels present on the resource.- Message
Retention stringDuration - How long to retain unacknowledged messages in the subscription's
backlog, from the moment a message is published. If
retain_acked_messages is true, then this also configures the retention
of acknowledged messages, and thus configures how far back in time a
subscriptions.seek can be done. Defaults to 7 days. Cannot be more
than 7 days (
"604800s"
) or less than 10 minutes ("600s"
). A duration in seconds with up to nine fractional digits, terminated by 's'. Example:"600.5s"
. - Name string
- Name of the subscription.
- Project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- Pulumi
Labels Dictionary<string, string> - The combination of labels configured directly on the resource and default labels configured on the provider.
- Push
Config SubscriptionPush Config - If push delivery is used with this subscription, this field is used to configure it. An empty pushConfig signifies that the subscriber will pull and ack messages using API methods. Structure is documented below.
- Retain
Acked boolMessages - Indicates whether to retain acknowledged messages. If
true
, then messages are not expunged from the subscription's backlog, even if they are acknowledged, until they fall out of the messageRetentionDuration window. - Retry
Policy SubscriptionRetry Policy - A policy that specifies how Pub/Sub retries message delivery for this subscription. If not set, the default retry policy is applied. This generally implies that messages will be retried as soon as possible for healthy subscribers. RetryPolicy will be triggered on NACKs or acknowledgement deadline exceeded events for a given message Structure is documented below.
- Topic string
- A reference to a Topic resource, of the form projects/{project}/topics/{{name}}
(as in the id property of a google_pubsub_topic), or just a topic name if
the topic is in the same project as the subscription.
- Ack
Deadline intSeconds - This value is the maximum time after a subscriber receives a message before the subscriber should acknowledge the message. After message delivery but before the ack deadline expires and before the message is acknowledged, it is an outstanding message and will not be delivered again during that time (on a best-effort basis). For pull subscriptions, this value is used as the initial value for the ack deadline. To override this value for a given message, call subscriptions.modifyAckDeadline with the corresponding ackId if using pull. The minimum custom deadline you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds (10 minutes). If this parameter is 0, a default value of 10 seconds is used. For push delivery, this value is also used to set the request timeout for the call to the push endpoint. If the subscriber never acknowledges the message, the Pub/Sub system will eventually redeliver the message.
- Bigquery
Config SubscriptionBigquery Config Args - If delivery to BigQuery is used with this subscription, this field is used to configure it. Either pushConfig, bigQueryConfig or cloudStorageConfig can be set, but not combined. If all three are empty, then the subscriber will pull and ack messages using API methods. Structure is documented below.
- Cloud
Storage SubscriptionConfig Cloud Storage Config Args - If delivery to Cloud Storage is used with this subscription, this field is used to configure it. Either pushConfig, bigQueryConfig or cloudStorageConfig can be set, but not combined. If all three are empty, then the subscriber will pull and ack messages using API methods. Structure is documented below.
- Dead
Letter SubscriptionPolicy Dead Letter Policy Args - A policy that specifies the conditions for dead lettering messages in this subscription. If dead_letter_policy is not set, dead lettering is disabled. The Cloud Pub/Sub service account associated with this subscription's parent project (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have permission to Acknowledge() messages on this subscription. Structure is documented below.
- Effective
Labels 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.
- Enable
Exactly boolOnce Delivery - If
true
, Pub/Sub provides the following guarantees for the delivery of a message with a given value of messageId on this Subscriptions':- The message sent to a subscriber is guaranteed not to be resent before the message's acknowledgement deadline expires.
- An acknowledged message will not be resent to a subscriber.
Note that subscribers may still receive multiple copies of a message when
enable_exactly_once_delivery
is true if the message was published multiple times by a publisher client. These copies are considered distinct by Pub/Sub and have distinct messageId values
- Enable
Message boolOrdering - If
true
, messages published with the same orderingKey in PubsubMessage will be delivered to the subscribers in the order in which they are received by the Pub/Sub system. Otherwise, they may be delivered in any order. - Expiration
Policy SubscriptionExpiration Policy Args - A policy that specifies the conditions for this subscription's expiration. A subscription is considered active as long as any connected subscriber is successfully consuming messages from the subscription or is issuing operations on the subscription. If expirationPolicy is not set, a default policy with ttl of 31 days will be used. If it is set but ttl is "", the resource never expires. The minimum allowed value for expirationPolicy.ttl is 1 day. Structure is documented below.
- Filter string
- The subscription only delivers the messages that match the filter. Pub/Sub automatically acknowledges the messages that don't match the filter. You can filter messages by their attributes. The maximum length of a filter is 256 bytes. After creating the subscription, you can't modify the filter.
- Labels map[string]string
A set of key/value label pairs to assign to this Subscription.
Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field
effective_labels
for all of the labels present on the resource.- Message
Retention stringDuration - How long to retain unacknowledged messages in the subscription's
backlog, from the moment a message is published. If
retain_acked_messages is true, then this also configures the retention
of acknowledged messages, and thus configures how far back in time a
subscriptions.seek can be done. Defaults to 7 days. Cannot be more
than 7 days (
"604800s"
) or less than 10 minutes ("600s"
). A duration in seconds with up to nine fractional digits, terminated by 's'. Example:"600.5s"
. - Name string
- Name of the subscription.
- Project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- Pulumi
Labels map[string]string - The combination of labels configured directly on the resource and default labels configured on the provider.
- Push
Config SubscriptionPush Config Args - If push delivery is used with this subscription, this field is used to configure it. An empty pushConfig signifies that the subscriber will pull and ack messages using API methods. Structure is documented below.
- Retain
Acked boolMessages - Indicates whether to retain acknowledged messages. If
true
, then messages are not expunged from the subscription's backlog, even if they are acknowledged, until they fall out of the messageRetentionDuration window. - Retry
Policy SubscriptionRetry Policy Args - A policy that specifies how Pub/Sub retries message delivery for this subscription. If not set, the default retry policy is applied. This generally implies that messages will be retried as soon as possible for healthy subscribers. RetryPolicy will be triggered on NACKs or acknowledgement deadline exceeded events for a given message Structure is documented below.
- Topic string
- A reference to a Topic resource, of the form projects/{project}/topics/{{name}}
(as in the id property of a google_pubsub_topic), or just a topic name if
the topic is in the same project as the subscription.
- ack
Deadline IntegerSeconds - This value is the maximum time after a subscriber receives a message before the subscriber should acknowledge the message. After message delivery but before the ack deadline expires and before the message is acknowledged, it is an outstanding message and will not be delivered again during that time (on a best-effort basis). For pull subscriptions, this value is used as the initial value for the ack deadline. To override this value for a given message, call subscriptions.modifyAckDeadline with the corresponding ackId if using pull. The minimum custom deadline you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds (10 minutes). If this parameter is 0, a default value of 10 seconds is used. For push delivery, this value is also used to set the request timeout for the call to the push endpoint. If the subscriber never acknowledges the message, the Pub/Sub system will eventually redeliver the message.
- bigquery
Config SubscriptionBigquery Config - If delivery to BigQuery is used with this subscription, this field is used to configure it. Either pushConfig, bigQueryConfig or cloudStorageConfig can be set, but not combined. If all three are empty, then the subscriber will pull and ack messages using API methods. Structure is documented below.
- cloud
Storage SubscriptionConfig Cloud Storage Config - If delivery to Cloud Storage is used with this subscription, this field is used to configure it. Either pushConfig, bigQueryConfig or cloudStorageConfig can be set, but not combined. If all three are empty, then the subscriber will pull and ack messages using API methods. Structure is documented below.
- dead
Letter SubscriptionPolicy Dead Letter Policy - A policy that specifies the conditions for dead lettering messages in this subscription. If dead_letter_policy is not set, dead lettering is disabled. The Cloud Pub/Sub service account associated with this subscription's parent project (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have permission to Acknowledge() messages on this subscription. Structure is documented below.
- effective
Labels 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.
- enable
Exactly BooleanOnce Delivery - If
true
, Pub/Sub provides the following guarantees for the delivery of a message with a given value of messageId on this Subscriptions':- The message sent to a subscriber is guaranteed not to be resent before the message's acknowledgement deadline expires.
- An acknowledged message will not be resent to a subscriber.
Note that subscribers may still receive multiple copies of a message when
enable_exactly_once_delivery
is true if the message was published multiple times by a publisher client. These copies are considered distinct by Pub/Sub and have distinct messageId values
- enable
Message BooleanOrdering - If
true
, messages published with the same orderingKey in PubsubMessage will be delivered to the subscribers in the order in which they are received by the Pub/Sub system. Otherwise, they may be delivered in any order. - expiration
Policy SubscriptionExpiration Policy - A policy that specifies the conditions for this subscription's expiration. A subscription is considered active as long as any connected subscriber is successfully consuming messages from the subscription or is issuing operations on the subscription. If expirationPolicy is not set, a default policy with ttl of 31 days will be used. If it is set but ttl is "", the resource never expires. The minimum allowed value for expirationPolicy.ttl is 1 day. Structure is documented below.
- filter String
- The subscription only delivers the messages that match the filter. Pub/Sub automatically acknowledges the messages that don't match the filter. You can filter messages by their attributes. The maximum length of a filter is 256 bytes. After creating the subscription, you can't modify the filter.
- labels Map<String,String>
A set of key/value label pairs to assign to this Subscription.
Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field
effective_labels
for all of the labels present on the resource.- message
Retention StringDuration - How long to retain unacknowledged messages in the subscription's
backlog, from the moment a message is published. If
retain_acked_messages is true, then this also configures the retention
of acknowledged messages, and thus configures how far back in time a
subscriptions.seek can be done. Defaults to 7 days. Cannot be more
than 7 days (
"604800s"
) or less than 10 minutes ("600s"
). A duration in seconds with up to nine fractional digits, terminated by 's'. Example:"600.5s"
. - name String
- Name of the subscription.
- project String
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- pulumi
Labels Map<String,String> - The combination of labels configured directly on the resource and default labels configured on the provider.
- push
Config SubscriptionPush Config - If push delivery is used with this subscription, this field is used to configure it. An empty pushConfig signifies that the subscriber will pull and ack messages using API methods. Structure is documented below.
- retain
Acked BooleanMessages - Indicates whether to retain acknowledged messages. If
true
, then messages are not expunged from the subscription's backlog, even if they are acknowledged, until they fall out of the messageRetentionDuration window. - retry
Policy SubscriptionRetry Policy - A policy that specifies how Pub/Sub retries message delivery for this subscription. If not set, the default retry policy is applied. This generally implies that messages will be retried as soon as possible for healthy subscribers. RetryPolicy will be triggered on NACKs or acknowledgement deadline exceeded events for a given message Structure is documented below.
- topic String
- A reference to a Topic resource, of the form projects/{project}/topics/{{name}}
(as in the id property of a google_pubsub_topic), or just a topic name if
the topic is in the same project as the subscription.
- ack
Deadline numberSeconds - This value is the maximum time after a subscriber receives a message before the subscriber should acknowledge the message. After message delivery but before the ack deadline expires and before the message is acknowledged, it is an outstanding message and will not be delivered again during that time (on a best-effort basis). For pull subscriptions, this value is used as the initial value for the ack deadline. To override this value for a given message, call subscriptions.modifyAckDeadline with the corresponding ackId if using pull. The minimum custom deadline you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds (10 minutes). If this parameter is 0, a default value of 10 seconds is used. For push delivery, this value is also used to set the request timeout for the call to the push endpoint. If the subscriber never acknowledges the message, the Pub/Sub system will eventually redeliver the message.
- bigquery
Config SubscriptionBigquery Config - If delivery to BigQuery is used with this subscription, this field is used to configure it. Either pushConfig, bigQueryConfig or cloudStorageConfig can be set, but not combined. If all three are empty, then the subscriber will pull and ack messages using API methods. Structure is documented below.
- cloud
Storage SubscriptionConfig Cloud Storage Config - If delivery to Cloud Storage is used with this subscription, this field is used to configure it. Either pushConfig, bigQueryConfig or cloudStorageConfig can be set, but not combined. If all three are empty, then the subscriber will pull and ack messages using API methods. Structure is documented below.
- dead
Letter SubscriptionPolicy Dead Letter Policy - A policy that specifies the conditions for dead lettering messages in this subscription. If dead_letter_policy is not set, dead lettering is disabled. The Cloud Pub/Sub service account associated with this subscription's parent project (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have permission to Acknowledge() messages on this subscription. Structure is documented below.
- effective
Labels {[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.
- enable
Exactly booleanOnce Delivery - If
true
, Pub/Sub provides the following guarantees for the delivery of a message with a given value of messageId on this Subscriptions':- The message sent to a subscriber is guaranteed not to be resent before the message's acknowledgement deadline expires.
- An acknowledged message will not be resent to a subscriber.
Note that subscribers may still receive multiple copies of a message when
enable_exactly_once_delivery
is true if the message was published multiple times by a publisher client. These copies are considered distinct by Pub/Sub and have distinct messageId values
- enable
Message booleanOrdering - If
true
, messages published with the same orderingKey in PubsubMessage will be delivered to the subscribers in the order in which they are received by the Pub/Sub system. Otherwise, they may be delivered in any order. - expiration
Policy SubscriptionExpiration Policy - A policy that specifies the conditions for this subscription's expiration. A subscription is considered active as long as any connected subscriber is successfully consuming messages from the subscription or is issuing operations on the subscription. If expirationPolicy is not set, a default policy with ttl of 31 days will be used. If it is set but ttl is "", the resource never expires. The minimum allowed value for expirationPolicy.ttl is 1 day. Structure is documented below.
- filter string
- The subscription only delivers the messages that match the filter. Pub/Sub automatically acknowledges the messages that don't match the filter. You can filter messages by their attributes. The maximum length of a filter is 256 bytes. After creating the subscription, you can't modify the filter.
- labels {[key: string]: string}
A set of key/value label pairs to assign to this Subscription.
Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field
effective_labels
for all of the labels present on the resource.- message
Retention stringDuration - How long to retain unacknowledged messages in the subscription's
backlog, from the moment a message is published. If
retain_acked_messages is true, then this also configures the retention
of acknowledged messages, and thus configures how far back in time a
subscriptions.seek can be done. Defaults to 7 days. Cannot be more
than 7 days (
"604800s"
) or less than 10 minutes ("600s"
). A duration in seconds with up to nine fractional digits, terminated by 's'. Example:"600.5s"
. - name string
- Name of the subscription.
- project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- pulumi
Labels {[key: string]: string} - The combination of labels configured directly on the resource and default labels configured on the provider.
- push
Config SubscriptionPush Config - If push delivery is used with this subscription, this field is used to configure it. An empty pushConfig signifies that the subscriber will pull and ack messages using API methods. Structure is documented below.
- retain
Acked booleanMessages - Indicates whether to retain acknowledged messages. If
true
, then messages are not expunged from the subscription's backlog, even if they are acknowledged, until they fall out of the messageRetentionDuration window. - retry
Policy SubscriptionRetry Policy - A policy that specifies how Pub/Sub retries message delivery for this subscription. If not set, the default retry policy is applied. This generally implies that messages will be retried as soon as possible for healthy subscribers. RetryPolicy will be triggered on NACKs or acknowledgement deadline exceeded events for a given message Structure is documented below.
- topic string
- A reference to a Topic resource, of the form projects/{project}/topics/{{name}}
(as in the id property of a google_pubsub_topic), or just a topic name if
the topic is in the same project as the subscription.
- ack_
deadline_ intseconds - This value is the maximum time after a subscriber receives a message before the subscriber should acknowledge the message. After message delivery but before the ack deadline expires and before the message is acknowledged, it is an outstanding message and will not be delivered again during that time (on a best-effort basis). For pull subscriptions, this value is used as the initial value for the ack deadline. To override this value for a given message, call subscriptions.modifyAckDeadline with the corresponding ackId if using pull. The minimum custom deadline you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds (10 minutes). If this parameter is 0, a default value of 10 seconds is used. For push delivery, this value is also used to set the request timeout for the call to the push endpoint. If the subscriber never acknowledges the message, the Pub/Sub system will eventually redeliver the message.
- bigquery_
config SubscriptionBigquery Config Args - If delivery to BigQuery is used with this subscription, this field is used to configure it. Either pushConfig, bigQueryConfig or cloudStorageConfig can be set, but not combined. If all three are empty, then the subscriber will pull and ack messages using API methods. Structure is documented below.
- cloud_
storage_ Subscriptionconfig Cloud Storage Config Args - If delivery to Cloud Storage is used with this subscription, this field is used to configure it. Either pushConfig, bigQueryConfig or cloudStorageConfig can be set, but not combined. If all three are empty, then the subscriber will pull and ack messages using API methods. Structure is documented below.
- dead_
letter_ Subscriptionpolicy Dead Letter Policy Args - A policy that specifies the conditions for dead lettering messages in this subscription. If dead_letter_policy is not set, dead lettering is disabled. The Cloud Pub/Sub service account associated with this subscription's parent project (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have permission to Acknowledge() messages on this subscription. Structure is documented below.
- effective_
labels Mapping[str, str] - All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
- enable_
exactly_ boolonce_ delivery - If
true
, Pub/Sub provides the following guarantees for the delivery of a message with a given value of messageId on this Subscriptions':- The message sent to a subscriber is guaranteed not to be resent before the message's acknowledgement deadline expires.
- An acknowledged message will not be resent to a subscriber.
Note that subscribers may still receive multiple copies of a message when
enable_exactly_once_delivery
is true if the message was published multiple times by a publisher client. These copies are considered distinct by Pub/Sub and have distinct messageId values
- enable_
message_ boolordering - If
true
, messages published with the same orderingKey in PubsubMessage will be delivered to the subscribers in the order in which they are received by the Pub/Sub system. Otherwise, they may be delivered in any order. - expiration_
policy SubscriptionExpiration Policy Args - A policy that specifies the conditions for this subscription's expiration. A subscription is considered active as long as any connected subscriber is successfully consuming messages from the subscription or is issuing operations on the subscription. If expirationPolicy is not set, a default policy with ttl of 31 days will be used. If it is set but ttl is "", the resource never expires. The minimum allowed value for expirationPolicy.ttl is 1 day. Structure is documented below.
- filter str
- The subscription only delivers the messages that match the filter. Pub/Sub automatically acknowledges the messages that don't match the filter. You can filter messages by their attributes. The maximum length of a filter is 256 bytes. After creating the subscription, you can't modify the filter.
- labels Mapping[str, str]
A set of key/value label pairs to assign to this Subscription.
Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field
effective_labels
for all of the labels present on the resource.- message_
retention_ strduration - How long to retain unacknowledged messages in the subscription's
backlog, from the moment a message is published. If
retain_acked_messages is true, then this also configures the retention
of acknowledged messages, and thus configures how far back in time a
subscriptions.seek can be done. Defaults to 7 days. Cannot be more
than 7 days (
"604800s"
) or less than 10 minutes ("600s"
). A duration in seconds with up to nine fractional digits, terminated by 's'. Example:"600.5s"
. - name str
- Name of the subscription.
- project str
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- pulumi_
labels Mapping[str, str] - The combination of labels configured directly on the resource and default labels configured on the provider.
- push_
config SubscriptionPush Config Args - If push delivery is used with this subscription, this field is used to configure it. An empty pushConfig signifies that the subscriber will pull and ack messages using API methods. Structure is documented below.
- retain_
acked_ boolmessages - Indicates whether to retain acknowledged messages. If
true
, then messages are not expunged from the subscription's backlog, even if they are acknowledged, until they fall out of the messageRetentionDuration window. - retry_
policy SubscriptionRetry Policy Args - A policy that specifies how Pub/Sub retries message delivery for this subscription. If not set, the default retry policy is applied. This generally implies that messages will be retried as soon as possible for healthy subscribers. RetryPolicy will be triggered on NACKs or acknowledgement deadline exceeded events for a given message Structure is documented below.
- topic str
- A reference to a Topic resource, of the form projects/{project}/topics/{{name}}
(as in the id property of a google_pubsub_topic), or just a topic name if
the topic is in the same project as the subscription.
- ack
Deadline NumberSeconds - This value is the maximum time after a subscriber receives a message before the subscriber should acknowledge the message. After message delivery but before the ack deadline expires and before the message is acknowledged, it is an outstanding message and will not be delivered again during that time (on a best-effort basis). For pull subscriptions, this value is used as the initial value for the ack deadline. To override this value for a given message, call subscriptions.modifyAckDeadline with the corresponding ackId if using pull. The minimum custom deadline you can specify is 10 seconds. The maximum custom deadline you can specify is 600 seconds (10 minutes). If this parameter is 0, a default value of 10 seconds is used. For push delivery, this value is also used to set the request timeout for the call to the push endpoint. If the subscriber never acknowledges the message, the Pub/Sub system will eventually redeliver the message.
- bigquery
Config Property Map - If delivery to BigQuery is used with this subscription, this field is used to configure it. Either pushConfig, bigQueryConfig or cloudStorageConfig can be set, but not combined. If all three are empty, then the subscriber will pull and ack messages using API methods. Structure is documented below.
- cloud
Storage Property MapConfig - If delivery to Cloud Storage is used with this subscription, this field is used to configure it. Either pushConfig, bigQueryConfig or cloudStorageConfig can be set, but not combined. If all three are empty, then the subscriber will pull and ack messages using API methods. Structure is documented below.
- dead
Letter Property MapPolicy - A policy that specifies the conditions for dead lettering messages in this subscription. If dead_letter_policy is not set, dead lettering is disabled. The Cloud Pub/Sub service account associated with this subscription's parent project (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have permission to Acknowledge() messages on this subscription. Structure is documented below.
- effective
Labels Map<String> - All of labels (key/value pairs) present on the resource in GCP, including the labels configured through Pulumi, other clients and services.
- enable
Exactly BooleanOnce Delivery - If
true
, Pub/Sub provides the following guarantees for the delivery of a message with a given value of messageId on this Subscriptions':- The message sent to a subscriber is guaranteed not to be resent before the message's acknowledgement deadline expires.
- An acknowledged message will not be resent to a subscriber.
Note that subscribers may still receive multiple copies of a message when
enable_exactly_once_delivery
is true if the message was published multiple times by a publisher client. These copies are considered distinct by Pub/Sub and have distinct messageId values
- enable
Message BooleanOrdering - If
true
, messages published with the same orderingKey in PubsubMessage will be delivered to the subscribers in the order in which they are received by the Pub/Sub system. Otherwise, they may be delivered in any order. - expiration
Policy Property Map - A policy that specifies the conditions for this subscription's expiration. A subscription is considered active as long as any connected subscriber is successfully consuming messages from the subscription or is issuing operations on the subscription. If expirationPolicy is not set, a default policy with ttl of 31 days will be used. If it is set but ttl is "", the resource never expires. The minimum allowed value for expirationPolicy.ttl is 1 day. Structure is documented below.
- filter String
- The subscription only delivers the messages that match the filter. Pub/Sub automatically acknowledges the messages that don't match the filter. You can filter messages by their attributes. The maximum length of a filter is 256 bytes. After creating the subscription, you can't modify the filter.
- labels Map<String>
A set of key/value label pairs to assign to this Subscription.
Note: This field is non-authoritative, and will only manage the labels present in your configuration. Please refer to the field
effective_labels
for all of the labels present on the resource.- message
Retention StringDuration - How long to retain unacknowledged messages in the subscription's
backlog, from the moment a message is published. If
retain_acked_messages is true, then this also configures the retention
of acknowledged messages, and thus configures how far back in time a
subscriptions.seek can be done. Defaults to 7 days. Cannot be more
than 7 days (
"604800s"
) or less than 10 minutes ("600s"
). A duration in seconds with up to nine fractional digits, terminated by 's'. Example:"600.5s"
. - name String
- Name of the subscription.
- project String
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- pulumi
Labels Map<String> - The combination of labels configured directly on the resource and default labels configured on the provider.
- push
Config Property Map - If push delivery is used with this subscription, this field is used to configure it. An empty pushConfig signifies that the subscriber will pull and ack messages using API methods. Structure is documented below.
- retain
Acked BooleanMessages - Indicates whether to retain acknowledged messages. If
true
, then messages are not expunged from the subscription's backlog, even if they are acknowledged, until they fall out of the messageRetentionDuration window. - retry
Policy Property Map - A policy that specifies how Pub/Sub retries message delivery for this subscription. If not set, the default retry policy is applied. This generally implies that messages will be retried as soon as possible for healthy subscribers. RetryPolicy will be triggered on NACKs or acknowledgement deadline exceeded events for a given message Structure is documented below.
- topic String
- A reference to a Topic resource, of the form projects/{project}/topics/{{name}}
(as in the id property of a google_pubsub_topic), or just a topic name if
the topic is in the same project as the subscription.
Supporting Types
SubscriptionBigqueryConfig, SubscriptionBigqueryConfigArgs
- Table string
- The name of the table to which to write data, of the form {projectId}:{datasetId}.{tableId}
- Drop
Unknown boolFields - When true and use_topic_schema or use_table_schema is true, any fields that are a part of the topic schema or message schema that are not part of the BigQuery table schema are dropped when writing to BigQuery. Otherwise, the schemas must be kept in sync and any messages with extra fields are not written and remain in the subscription's backlog.
- Service
Account stringEmail - The service account to use to write to BigQuery. If not specified, the Pub/Sub service agent, service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
- Use
Table boolSchema - When true, use the BigQuery table's schema as the columns to write to in BigQuery. Messages must be published in JSON format. Only one of use_topic_schema and use_table_schema can be set.
- Use
Topic boolSchema - When true, use the topic's schema as the columns to write to in BigQuery, if it exists. Only one of use_topic_schema and use_table_schema can be set.
- Write
Metadata bool - When true, write the subscription name, messageId, publishTime, attributes, and orderingKey to additional columns in the table. The subscription name, messageId, and publishTime fields are put in their own columns while all other message properties (other than data) are written to a JSON object in the attributes column.
- Table string
- The name of the table to which to write data, of the form {projectId}:{datasetId}.{tableId}
- Drop
Unknown boolFields - When true and use_topic_schema or use_table_schema is true, any fields that are a part of the topic schema or message schema that are not part of the BigQuery table schema are dropped when writing to BigQuery. Otherwise, the schemas must be kept in sync and any messages with extra fields are not written and remain in the subscription's backlog.
- Service
Account stringEmail - The service account to use to write to BigQuery. If not specified, the Pub/Sub service agent, service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
- Use
Table boolSchema - When true, use the BigQuery table's schema as the columns to write to in BigQuery. Messages must be published in JSON format. Only one of use_topic_schema and use_table_schema can be set.
- Use
Topic boolSchema - When true, use the topic's schema as the columns to write to in BigQuery, if it exists. Only one of use_topic_schema and use_table_schema can be set.
- Write
Metadata bool - When true, write the subscription name, messageId, publishTime, attributes, and orderingKey to additional columns in the table. The subscription name, messageId, and publishTime fields are put in their own columns while all other message properties (other than data) are written to a JSON object in the attributes column.
- table String
- The name of the table to which to write data, of the form {projectId}:{datasetId}.{tableId}
- drop
Unknown BooleanFields - When true and use_topic_schema or use_table_schema is true, any fields that are a part of the topic schema or message schema that are not part of the BigQuery table schema are dropped when writing to BigQuery. Otherwise, the schemas must be kept in sync and any messages with extra fields are not written and remain in the subscription's backlog.
- service
Account StringEmail - The service account to use to write to BigQuery. If not specified, the Pub/Sub service agent, service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
- use
Table BooleanSchema - When true, use the BigQuery table's schema as the columns to write to in BigQuery. Messages must be published in JSON format. Only one of use_topic_schema and use_table_schema can be set.
- use
Topic BooleanSchema - When true, use the topic's schema as the columns to write to in BigQuery, if it exists. Only one of use_topic_schema and use_table_schema can be set.
- write
Metadata Boolean - When true, write the subscription name, messageId, publishTime, attributes, and orderingKey to additional columns in the table. The subscription name, messageId, and publishTime fields are put in their own columns while all other message properties (other than data) are written to a JSON object in the attributes column.
- table string
- The name of the table to which to write data, of the form {projectId}:{datasetId}.{tableId}
- drop
Unknown booleanFields - When true and use_topic_schema or use_table_schema is true, any fields that are a part of the topic schema or message schema that are not part of the BigQuery table schema are dropped when writing to BigQuery. Otherwise, the schemas must be kept in sync and any messages with extra fields are not written and remain in the subscription's backlog.
- service
Account stringEmail - The service account to use to write to BigQuery. If not specified, the Pub/Sub service agent, service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
- use
Table booleanSchema - When true, use the BigQuery table's schema as the columns to write to in BigQuery. Messages must be published in JSON format. Only one of use_topic_schema and use_table_schema can be set.
- use
Topic booleanSchema - When true, use the topic's schema as the columns to write to in BigQuery, if it exists. Only one of use_topic_schema and use_table_schema can be set.
- write
Metadata boolean - When true, write the subscription name, messageId, publishTime, attributes, and orderingKey to additional columns in the table. The subscription name, messageId, and publishTime fields are put in their own columns while all other message properties (other than data) are written to a JSON object in the attributes column.
- table str
- The name of the table to which to write data, of the form {projectId}:{datasetId}.{tableId}
- drop_
unknown_ boolfields - When true and use_topic_schema or use_table_schema is true, any fields that are a part of the topic schema or message schema that are not part of the BigQuery table schema are dropped when writing to BigQuery. Otherwise, the schemas must be kept in sync and any messages with extra fields are not written and remain in the subscription's backlog.
- service_
account_ stremail - The service account to use to write to BigQuery. If not specified, the Pub/Sub service agent, service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
- use_
table_ boolschema - When true, use the BigQuery table's schema as the columns to write to in BigQuery. Messages must be published in JSON format. Only one of use_topic_schema and use_table_schema can be set.
- use_
topic_ boolschema - When true, use the topic's schema as the columns to write to in BigQuery, if it exists. Only one of use_topic_schema and use_table_schema can be set.
- write_
metadata bool - When true, write the subscription name, messageId, publishTime, attributes, and orderingKey to additional columns in the table. The subscription name, messageId, and publishTime fields are put in their own columns while all other message properties (other than data) are written to a JSON object in the attributes column.
- table String
- The name of the table to which to write data, of the form {projectId}:{datasetId}.{tableId}
- drop
Unknown BooleanFields - When true and use_topic_schema or use_table_schema is true, any fields that are a part of the topic schema or message schema that are not part of the BigQuery table schema are dropped when writing to BigQuery. Otherwise, the schemas must be kept in sync and any messages with extra fields are not written and remain in the subscription's backlog.
- service
Account StringEmail - The service account to use to write to BigQuery. If not specified, the Pub/Sub service agent, service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
- use
Table BooleanSchema - When true, use the BigQuery table's schema as the columns to write to in BigQuery. Messages must be published in JSON format. Only one of use_topic_schema and use_table_schema can be set.
- use
Topic BooleanSchema - When true, use the topic's schema as the columns to write to in BigQuery, if it exists. Only one of use_topic_schema and use_table_schema can be set.
- write
Metadata Boolean - When true, write the subscription name, messageId, publishTime, attributes, and orderingKey to additional columns in the table. The subscription name, messageId, and publishTime fields are put in their own columns while all other message properties (other than data) are written to a JSON object in the attributes column.
SubscriptionCloudStorageConfig, SubscriptionCloudStorageConfigArgs
- Bucket string
- User-provided name for the Cloud Storage bucket. The bucket must be created by the user. The bucket name must be without any prefix like "gs://".
- Avro
Config SubscriptionCloud Storage Config Avro Config - If set, message data will be written to Cloud Storage in Avro format. Structure is documented below.
- Filename
Datetime stringFormat - User-provided format string specifying how to represent datetimes in Cloud Storage filenames.
- Filename
Prefix string - User-provided prefix for Cloud Storage filename.
- Filename
Suffix string - User-provided suffix for Cloud Storage filename. Must not end in "/".
- Max
Bytes int - The maximum bytes that can be written to a Cloud Storage file before a new file is created. Min 1 KB, max 10 GiB. The maxBytes limit may be exceeded in cases where messages are larger than the limit.
- Max
Duration string - The maximum duration that can elapse before a new Cloud Storage file is created. Min 1 minute, max 10 minutes, default 5 minutes. May not exceed the subscription's acknowledgement deadline. A duration in seconds with up to nine fractional digits, ending with 's'. Example: "3.5s".
- Service
Account stringEmail - The service account to use to write to Cloud Storage. If not specified, the Pub/Sub service agent, service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
- State string
- (Output) An output-only field that indicates whether or not the subscription can receive messages.
- Bucket string
- User-provided name for the Cloud Storage bucket. The bucket must be created by the user. The bucket name must be without any prefix like "gs://".
- Avro
Config SubscriptionCloud Storage Config Avro Config - If set, message data will be written to Cloud Storage in Avro format. Structure is documented below.
- Filename
Datetime stringFormat - User-provided format string specifying how to represent datetimes in Cloud Storage filenames.
- Filename
Prefix string - User-provided prefix for Cloud Storage filename.
- Filename
Suffix string - User-provided suffix for Cloud Storage filename. Must not end in "/".
- Max
Bytes int - The maximum bytes that can be written to a Cloud Storage file before a new file is created. Min 1 KB, max 10 GiB. The maxBytes limit may be exceeded in cases where messages are larger than the limit.
- Max
Duration string - The maximum duration that can elapse before a new Cloud Storage file is created. Min 1 minute, max 10 minutes, default 5 minutes. May not exceed the subscription's acknowledgement deadline. A duration in seconds with up to nine fractional digits, ending with 's'. Example: "3.5s".
- Service
Account stringEmail - The service account to use to write to Cloud Storage. If not specified, the Pub/Sub service agent, service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
- State string
- (Output) An output-only field that indicates whether or not the subscription can receive messages.
- bucket String
- User-provided name for the Cloud Storage bucket. The bucket must be created by the user. The bucket name must be without any prefix like "gs://".
- avro
Config SubscriptionCloud Storage Config Avro Config - If set, message data will be written to Cloud Storage in Avro format. Structure is documented below.
- filename
Datetime StringFormat - User-provided format string specifying how to represent datetimes in Cloud Storage filenames.
- filename
Prefix String - User-provided prefix for Cloud Storage filename.
- filename
Suffix String - User-provided suffix for Cloud Storage filename. Must not end in "/".
- max
Bytes Integer - The maximum bytes that can be written to a Cloud Storage file before a new file is created. Min 1 KB, max 10 GiB. The maxBytes limit may be exceeded in cases where messages are larger than the limit.
- max
Duration String - The maximum duration that can elapse before a new Cloud Storage file is created. Min 1 minute, max 10 minutes, default 5 minutes. May not exceed the subscription's acknowledgement deadline. A duration in seconds with up to nine fractional digits, ending with 's'. Example: "3.5s".
- service
Account StringEmail - The service account to use to write to Cloud Storage. If not specified, the Pub/Sub service agent, service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
- state String
- (Output) An output-only field that indicates whether or not the subscription can receive messages.
- bucket string
- User-provided name for the Cloud Storage bucket. The bucket must be created by the user. The bucket name must be without any prefix like "gs://".
- avro
Config SubscriptionCloud Storage Config Avro Config - If set, message data will be written to Cloud Storage in Avro format. Structure is documented below.
- filename
Datetime stringFormat - User-provided format string specifying how to represent datetimes in Cloud Storage filenames.
- filename
Prefix string - User-provided prefix for Cloud Storage filename.
- filename
Suffix string - User-provided suffix for Cloud Storage filename. Must not end in "/".
- max
Bytes number - The maximum bytes that can be written to a Cloud Storage file before a new file is created. Min 1 KB, max 10 GiB. The maxBytes limit may be exceeded in cases where messages are larger than the limit.
- max
Duration string - The maximum duration that can elapse before a new Cloud Storage file is created. Min 1 minute, max 10 minutes, default 5 minutes. May not exceed the subscription's acknowledgement deadline. A duration in seconds with up to nine fractional digits, ending with 's'. Example: "3.5s".
- service
Account stringEmail - The service account to use to write to Cloud Storage. If not specified, the Pub/Sub service agent, service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
- state string
- (Output) An output-only field that indicates whether or not the subscription can receive messages.
- bucket str
- User-provided name for the Cloud Storage bucket. The bucket must be created by the user. The bucket name must be without any prefix like "gs://".
- avro_
config SubscriptionCloud Storage Config Avro Config - If set, message data will be written to Cloud Storage in Avro format. Structure is documented below.
- filename_
datetime_ strformat - User-provided format string specifying how to represent datetimes in Cloud Storage filenames.
- filename_
prefix str - User-provided prefix for Cloud Storage filename.
- filename_
suffix str - User-provided suffix for Cloud Storage filename. Must not end in "/".
- max_
bytes int - The maximum bytes that can be written to a Cloud Storage file before a new file is created. Min 1 KB, max 10 GiB. The maxBytes limit may be exceeded in cases where messages are larger than the limit.
- max_
duration str - The maximum duration that can elapse before a new Cloud Storage file is created. Min 1 minute, max 10 minutes, default 5 minutes. May not exceed the subscription's acknowledgement deadline. A duration in seconds with up to nine fractional digits, ending with 's'. Example: "3.5s".
- service_
account_ stremail - The service account to use to write to Cloud Storage. If not specified, the Pub/Sub service agent, service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
- state str
- (Output) An output-only field that indicates whether or not the subscription can receive messages.
- bucket String
- User-provided name for the Cloud Storage bucket. The bucket must be created by the user. The bucket name must be without any prefix like "gs://".
- avro
Config Property Map - If set, message data will be written to Cloud Storage in Avro format. Structure is documented below.
- filename
Datetime StringFormat - User-provided format string specifying how to represent datetimes in Cloud Storage filenames.
- filename
Prefix String - User-provided prefix for Cloud Storage filename.
- filename
Suffix String - User-provided suffix for Cloud Storage filename. Must not end in "/".
- max
Bytes Number - The maximum bytes that can be written to a Cloud Storage file before a new file is created. Min 1 KB, max 10 GiB. The maxBytes limit may be exceeded in cases where messages are larger than the limit.
- max
Duration String - The maximum duration that can elapse before a new Cloud Storage file is created. Min 1 minute, max 10 minutes, default 5 minutes. May not exceed the subscription's acknowledgement deadline. A duration in seconds with up to nine fractional digits, ending with 's'. Example: "3.5s".
- service
Account StringEmail - The service account to use to write to Cloud Storage. If not specified, the Pub/Sub service agent, service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com, is used.
- state String
- (Output) An output-only field that indicates whether or not the subscription can receive messages.
SubscriptionCloudStorageConfigAvroConfig, SubscriptionCloudStorageConfigAvroConfigArgs
- Write
Metadata bool - When true, write the subscription name, messageId, publishTime, attributes, and orderingKey as additional fields in the output.
- Write
Metadata bool - When true, write the subscription name, messageId, publishTime, attributes, and orderingKey as additional fields in the output.
- write
Metadata Boolean - When true, write the subscription name, messageId, publishTime, attributes, and orderingKey as additional fields in the output.
- write
Metadata boolean - When true, write the subscription name, messageId, publishTime, attributes, and orderingKey as additional fields in the output.
- write_
metadata bool - When true, write the subscription name, messageId, publishTime, attributes, and orderingKey as additional fields in the output.
- write
Metadata Boolean - When true, write the subscription name, messageId, publishTime, attributes, and orderingKey as additional fields in the output.
SubscriptionDeadLetterPolicy, SubscriptionDeadLetterPolicyArgs
- Dead
Letter stringTopic - The name of the topic to which dead letter messages should be published.
Format is
projects/{project}/topics/{topic}
. The Cloud Pub/Sub service account associated with the enclosing subscription's parent project (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have permission to Publish() to this topic. The operation will fail if the topic does not exist. Users should ensure that there is a subscription attached to this topic since messages published to a topic with no subscriptions are lost. - Max
Delivery intAttempts - The maximum number of delivery attempts for any message. The value must be between 5 and 100. The number of delivery attempts is defined as 1 + (the sum of number of NACKs and number of times the acknowledgement deadline has been exceeded for the message). A NACK is any call to ModifyAckDeadline with a 0 deadline. Note that client libraries may automatically extend ack_deadlines. This field will be honored on a best effort basis. If this parameter is 0, a default value of 5 is used.
- Dead
Letter stringTopic - The name of the topic to which dead letter messages should be published.
Format is
projects/{project}/topics/{topic}
. The Cloud Pub/Sub service account associated with the enclosing subscription's parent project (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have permission to Publish() to this topic. The operation will fail if the topic does not exist. Users should ensure that there is a subscription attached to this topic since messages published to a topic with no subscriptions are lost. - Max
Delivery intAttempts - The maximum number of delivery attempts for any message. The value must be between 5 and 100. The number of delivery attempts is defined as 1 + (the sum of number of NACKs and number of times the acknowledgement deadline has been exceeded for the message). A NACK is any call to ModifyAckDeadline with a 0 deadline. Note that client libraries may automatically extend ack_deadlines. This field will be honored on a best effort basis. If this parameter is 0, a default value of 5 is used.
- dead
Letter StringTopic - The name of the topic to which dead letter messages should be published.
Format is
projects/{project}/topics/{topic}
. The Cloud Pub/Sub service account associated with the enclosing subscription's parent project (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have permission to Publish() to this topic. The operation will fail if the topic does not exist. Users should ensure that there is a subscription attached to this topic since messages published to a topic with no subscriptions are lost. - max
Delivery IntegerAttempts - The maximum number of delivery attempts for any message. The value must be between 5 and 100. The number of delivery attempts is defined as 1 + (the sum of number of NACKs and number of times the acknowledgement deadline has been exceeded for the message). A NACK is any call to ModifyAckDeadline with a 0 deadline. Note that client libraries may automatically extend ack_deadlines. This field will be honored on a best effort basis. If this parameter is 0, a default value of 5 is used.
- dead
Letter stringTopic - The name of the topic to which dead letter messages should be published.
Format is
projects/{project}/topics/{topic}
. The Cloud Pub/Sub service account associated with the enclosing subscription's parent project (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have permission to Publish() to this topic. The operation will fail if the topic does not exist. Users should ensure that there is a subscription attached to this topic since messages published to a topic with no subscriptions are lost. - max
Delivery numberAttempts - The maximum number of delivery attempts for any message. The value must be between 5 and 100. The number of delivery attempts is defined as 1 + (the sum of number of NACKs and number of times the acknowledgement deadline has been exceeded for the message). A NACK is any call to ModifyAckDeadline with a 0 deadline. Note that client libraries may automatically extend ack_deadlines. This field will be honored on a best effort basis. If this parameter is 0, a default value of 5 is used.
- dead_
letter_ strtopic - The name of the topic to which dead letter messages should be published.
Format is
projects/{project}/topics/{topic}
. The Cloud Pub/Sub service account associated with the enclosing subscription's parent project (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have permission to Publish() to this topic. The operation will fail if the topic does not exist. Users should ensure that there is a subscription attached to this topic since messages published to a topic with no subscriptions are lost. - max_
delivery_ intattempts - The maximum number of delivery attempts for any message. The value must be between 5 and 100. The number of delivery attempts is defined as 1 + (the sum of number of NACKs and number of times the acknowledgement deadline has been exceeded for the message). A NACK is any call to ModifyAckDeadline with a 0 deadline. Note that client libraries may automatically extend ack_deadlines. This field will be honored on a best effort basis. If this parameter is 0, a default value of 5 is used.
- dead
Letter StringTopic - The name of the topic to which dead letter messages should be published.
Format is
projects/{project}/topics/{topic}
. The Cloud Pub/Sub service account associated with the enclosing subscription's parent project (i.e., service-{project_number}@gcp-sa-pubsub.iam.gserviceaccount.com) must have permission to Publish() to this topic. The operation will fail if the topic does not exist. Users should ensure that there is a subscription attached to this topic since messages published to a topic with no subscriptions are lost. - max
Delivery NumberAttempts - The maximum number of delivery attempts for any message. The value must be between 5 and 100. The number of delivery attempts is defined as 1 + (the sum of number of NACKs and number of times the acknowledgement deadline has been exceeded for the message). A NACK is any call to ModifyAckDeadline with a 0 deadline. Note that client libraries may automatically extend ack_deadlines. This field will be honored on a best effort basis. If this parameter is 0, a default value of 5 is used.
SubscriptionExpirationPolicy, SubscriptionExpirationPolicyArgs
- Ttl string
- Specifies the "time-to-live" duration for an associated resource. The resource expires if it is not active for a period of ttl. If ttl is set to "", the associated resource never expires. A duration in seconds with up to nine fractional digits, terminated by 's'. Example - "3.5s".
- Ttl string
- Specifies the "time-to-live" duration for an associated resource. The resource expires if it is not active for a period of ttl. If ttl is set to "", the associated resource never expires. A duration in seconds with up to nine fractional digits, terminated by 's'. Example - "3.5s".
- ttl String
- Specifies the "time-to-live" duration for an associated resource. The resource expires if it is not active for a period of ttl. If ttl is set to "", the associated resource never expires. A duration in seconds with up to nine fractional digits, terminated by 's'. Example - "3.5s".
- ttl string
- Specifies the "time-to-live" duration for an associated resource. The resource expires if it is not active for a period of ttl. If ttl is set to "", the associated resource never expires. A duration in seconds with up to nine fractional digits, terminated by 's'. Example - "3.5s".
- ttl str
- Specifies the "time-to-live" duration for an associated resource. The resource expires if it is not active for a period of ttl. If ttl is set to "", the associated resource never expires. A duration in seconds with up to nine fractional digits, terminated by 's'. Example - "3.5s".
- ttl String
- Specifies the "time-to-live" duration for an associated resource. The resource expires if it is not active for a period of ttl. If ttl is set to "", the associated resource never expires. A duration in seconds with up to nine fractional digits, terminated by 's'. Example - "3.5s".
SubscriptionPushConfig, SubscriptionPushConfigArgs
- Push
Endpoint string - A URL locating the endpoint to which messages should be pushed. For example, a Webhook endpoint might use "https://example.com/push".
- Attributes Dictionary<string, string>
- Endpoint configuration attributes.
Every endpoint has a set of API supported attributes that can
be used to control different aspects of the message delivery.
The currently supported attribute is x-goog-version, which you
can use to change the format of the pushed message. This
attribute indicates the version of the data expected by
the endpoint. This controls the shape of the pushed message
(i.e., its fields and metadata). The endpoint version is
based on the version of the Pub/Sub API.
If not present during the subscriptions.create call,
it will default to the version of the API used to make
such call. If not present during a subscriptions.modifyPushConfig
call, its value will not be changed. subscriptions.get
calls will always return a valid version, even if the
subscription was created without this attribute.
The possible values for this attribute are:
- v1beta1: uses the push format defined in the v1beta1 Pub/Sub API.
- v1 or v1beta2: uses the push format defined in the v1 Pub/Sub API.
- No
Wrapper SubscriptionPush Config No Wrapper - When set, the payload to the push endpoint is not wrapped.Sets the
data
field as the HTTP body for delivery. Structure is documented below. - Oidc
Token SubscriptionPush Config Oidc Token - If specified, Pub/Sub will generate and attach an OIDC JWT token as an Authorization header in the HTTP request for every pushed message. Structure is documented below.
- Push
Endpoint string - A URL locating the endpoint to which messages should be pushed. For example, a Webhook endpoint might use "https://example.com/push".
- Attributes map[string]string
- Endpoint configuration attributes.
Every endpoint has a set of API supported attributes that can
be used to control different aspects of the message delivery.
The currently supported attribute is x-goog-version, which you
can use to change the format of the pushed message. This
attribute indicates the version of the data expected by
the endpoint. This controls the shape of the pushed message
(i.e., its fields and metadata). The endpoint version is
based on the version of the Pub/Sub API.
If not present during the subscriptions.create call,
it will default to the version of the API used to make
such call. If not present during a subscriptions.modifyPushConfig
call, its value will not be changed. subscriptions.get
calls will always return a valid version, even if the
subscription was created without this attribute.
The possible values for this attribute are:
- v1beta1: uses the push format defined in the v1beta1 Pub/Sub API.
- v1 or v1beta2: uses the push format defined in the v1 Pub/Sub API.
- No
Wrapper SubscriptionPush Config No Wrapper - When set, the payload to the push endpoint is not wrapped.Sets the
data
field as the HTTP body for delivery. Structure is documented below. - Oidc
Token SubscriptionPush Config Oidc Token - If specified, Pub/Sub will generate and attach an OIDC JWT token as an Authorization header in the HTTP request for every pushed message. Structure is documented below.
- push
Endpoint String - A URL locating the endpoint to which messages should be pushed. For example, a Webhook endpoint might use "https://example.com/push".
- attributes Map<String,String>
- Endpoint configuration attributes.
Every endpoint has a set of API supported attributes that can
be used to control different aspects of the message delivery.
The currently supported attribute is x-goog-version, which you
can use to change the format of the pushed message. This
attribute indicates the version of the data expected by
the endpoint. This controls the shape of the pushed message
(i.e., its fields and metadata). The endpoint version is
based on the version of the Pub/Sub API.
If not present during the subscriptions.create call,
it will default to the version of the API used to make
such call. If not present during a subscriptions.modifyPushConfig
call, its value will not be changed. subscriptions.get
calls will always return a valid version, even if the
subscription was created without this attribute.
The possible values for this attribute are:
- v1beta1: uses the push format defined in the v1beta1 Pub/Sub API.
- v1 or v1beta2: uses the push format defined in the v1 Pub/Sub API.
- no
Wrapper SubscriptionPush Config No Wrapper - When set, the payload to the push endpoint is not wrapped.Sets the
data
field as the HTTP body for delivery. Structure is documented below. - oidc
Token SubscriptionPush Config Oidc Token - If specified, Pub/Sub will generate and attach an OIDC JWT token as an Authorization header in the HTTP request for every pushed message. Structure is documented below.
- push
Endpoint string - A URL locating the endpoint to which messages should be pushed. For example, a Webhook endpoint might use "https://example.com/push".
- attributes {[key: string]: string}
- Endpoint configuration attributes.
Every endpoint has a set of API supported attributes that can
be used to control different aspects of the message delivery.
The currently supported attribute is x-goog-version, which you
can use to change the format of the pushed message. This
attribute indicates the version of the data expected by
the endpoint. This controls the shape of the pushed message
(i.e., its fields and metadata). The endpoint version is
based on the version of the Pub/Sub API.
If not present during the subscriptions.create call,
it will default to the version of the API used to make
such call. If not present during a subscriptions.modifyPushConfig
call, its value will not be changed. subscriptions.get
calls will always return a valid version, even if the
subscription was created without this attribute.
The possible values for this attribute are:
- v1beta1: uses the push format defined in the v1beta1 Pub/Sub API.
- v1 or v1beta2: uses the push format defined in the v1 Pub/Sub API.
- no
Wrapper SubscriptionPush Config No Wrapper - When set, the payload to the push endpoint is not wrapped.Sets the
data
field as the HTTP body for delivery. Structure is documented below. - oidc
Token SubscriptionPush Config Oidc Token - If specified, Pub/Sub will generate and attach an OIDC JWT token as an Authorization header in the HTTP request for every pushed message. Structure is documented below.
- push_
endpoint str - A URL locating the endpoint to which messages should be pushed. For example, a Webhook endpoint might use "https://example.com/push".
- attributes Mapping[str, str]
- Endpoint configuration attributes.
Every endpoint has a set of API supported attributes that can
be used to control different aspects of the message delivery.
The currently supported attribute is x-goog-version, which you
can use to change the format of the pushed message. This
attribute indicates the version of the data expected by
the endpoint. This controls the shape of the pushed message
(i.e., its fields and metadata). The endpoint version is
based on the version of the Pub/Sub API.
If not present during the subscriptions.create call,
it will default to the version of the API used to make
such call. If not present during a subscriptions.modifyPushConfig
call, its value will not be changed. subscriptions.get
calls will always return a valid version, even if the
subscription was created without this attribute.
The possible values for this attribute are:
- v1beta1: uses the push format defined in the v1beta1 Pub/Sub API.
- v1 or v1beta2: uses the push format defined in the v1 Pub/Sub API.
- no_
wrapper SubscriptionPush Config No Wrapper - When set, the payload to the push endpoint is not wrapped.Sets the
data
field as the HTTP body for delivery. Structure is documented below. - oidc_
token SubscriptionPush Config Oidc Token - If specified, Pub/Sub will generate and attach an OIDC JWT token as an Authorization header in the HTTP request for every pushed message. Structure is documented below.
- push
Endpoint String - A URL locating the endpoint to which messages should be pushed. For example, a Webhook endpoint might use "https://example.com/push".
- attributes Map<String>
- Endpoint configuration attributes.
Every endpoint has a set of API supported attributes that can
be used to control different aspects of the message delivery.
The currently supported attribute is x-goog-version, which you
can use to change the format of the pushed message. This
attribute indicates the version of the data expected by
the endpoint. This controls the shape of the pushed message
(i.e., its fields and metadata). The endpoint version is
based on the version of the Pub/Sub API.
If not present during the subscriptions.create call,
it will default to the version of the API used to make
such call. If not present during a subscriptions.modifyPushConfig
call, its value will not be changed. subscriptions.get
calls will always return a valid version, even if the
subscription was created without this attribute.
The possible values for this attribute are:
- v1beta1: uses the push format defined in the v1beta1 Pub/Sub API.
- v1 or v1beta2: uses the push format defined in the v1 Pub/Sub API.
- no
Wrapper Property Map - When set, the payload to the push endpoint is not wrapped.Sets the
data
field as the HTTP body for delivery. Structure is documented below. - oidc
Token Property Map - If specified, Pub/Sub will generate and attach an OIDC JWT token as an Authorization header in the HTTP request for every pushed message. Structure is documented below.
SubscriptionPushConfigNoWrapper, SubscriptionPushConfigNoWrapperArgs
- Write
Metadata bool - When true, writes the Pub/Sub message metadata to
x-goog-pubsub-<KEY>:<VAL>
headers of the HTTP request. Writes the Pub/Sub message attributes to<KEY>:<VAL>
headers of the HTTP request.
- Write
Metadata bool - When true, writes the Pub/Sub message metadata to
x-goog-pubsub-<KEY>:<VAL>
headers of the HTTP request. Writes the Pub/Sub message attributes to<KEY>:<VAL>
headers of the HTTP request.
- write
Metadata Boolean - When true, writes the Pub/Sub message metadata to
x-goog-pubsub-<KEY>:<VAL>
headers of the HTTP request. Writes the Pub/Sub message attributes to<KEY>:<VAL>
headers of the HTTP request.
- write
Metadata boolean - When true, writes the Pub/Sub message metadata to
x-goog-pubsub-<KEY>:<VAL>
headers of the HTTP request. Writes the Pub/Sub message attributes to<KEY>:<VAL>
headers of the HTTP request.
- write_
metadata bool - When true, writes the Pub/Sub message metadata to
x-goog-pubsub-<KEY>:<VAL>
headers of the HTTP request. Writes the Pub/Sub message attributes to<KEY>:<VAL>
headers of the HTTP request.
- write
Metadata Boolean - When true, writes the Pub/Sub message metadata to
x-goog-pubsub-<KEY>:<VAL>
headers of the HTTP request. Writes the Pub/Sub message attributes to<KEY>:<VAL>
headers of the HTTP request.
SubscriptionPushConfigOidcToken, SubscriptionPushConfigOidcTokenArgs
- Service
Account stringEmail - Service account email to be used for generating the OIDC token. The caller (for subscriptions.create, subscriptions.patch, and subscriptions.modifyPushConfig RPCs) must have the iam.serviceAccounts.actAs permission for the service account.
- Audience string
- Audience to be used when generating OIDC token. The audience claim identifies the recipients that the JWT is intended for. The audience value is a single case-sensitive string. Having multiple values (array) for the audience field is not supported. More info about the OIDC JWT token audience here: https://tools.ietf.org/html/rfc7519#section-4.1.3 Note: if not specified, the Push endpoint URL will be used.
- Service
Account stringEmail - Service account email to be used for generating the OIDC token. The caller (for subscriptions.create, subscriptions.patch, and subscriptions.modifyPushConfig RPCs) must have the iam.serviceAccounts.actAs permission for the service account.
- Audience string
- Audience to be used when generating OIDC token. The audience claim identifies the recipients that the JWT is intended for. The audience value is a single case-sensitive string. Having multiple values (array) for the audience field is not supported. More info about the OIDC JWT token audience here: https://tools.ietf.org/html/rfc7519#section-4.1.3 Note: if not specified, the Push endpoint URL will be used.
- service
Account StringEmail - Service account email to be used for generating the OIDC token. The caller (for subscriptions.create, subscriptions.patch, and subscriptions.modifyPushConfig RPCs) must have the iam.serviceAccounts.actAs permission for the service account.
- audience String
- Audience to be used when generating OIDC token. The audience claim identifies the recipients that the JWT is intended for. The audience value is a single case-sensitive string. Having multiple values (array) for the audience field is not supported. More info about the OIDC JWT token audience here: https://tools.ietf.org/html/rfc7519#section-4.1.3 Note: if not specified, the Push endpoint URL will be used.
- service
Account stringEmail - Service account email to be used for generating the OIDC token. The caller (for subscriptions.create, subscriptions.patch, and subscriptions.modifyPushConfig RPCs) must have the iam.serviceAccounts.actAs permission for the service account.
- audience string
- Audience to be used when generating OIDC token. The audience claim identifies the recipients that the JWT is intended for. The audience value is a single case-sensitive string. Having multiple values (array) for the audience field is not supported. More info about the OIDC JWT token audience here: https://tools.ietf.org/html/rfc7519#section-4.1.3 Note: if not specified, the Push endpoint URL will be used.
- service_
account_ stremail - Service account email to be used for generating the OIDC token. The caller (for subscriptions.create, subscriptions.patch, and subscriptions.modifyPushConfig RPCs) must have the iam.serviceAccounts.actAs permission for the service account.
- audience str
- Audience to be used when generating OIDC token. The audience claim identifies the recipients that the JWT is intended for. The audience value is a single case-sensitive string. Having multiple values (array) for the audience field is not supported. More info about the OIDC JWT token audience here: https://tools.ietf.org/html/rfc7519#section-4.1.3 Note: if not specified, the Push endpoint URL will be used.
- service
Account StringEmail - Service account email to be used for generating the OIDC token. The caller (for subscriptions.create, subscriptions.patch, and subscriptions.modifyPushConfig RPCs) must have the iam.serviceAccounts.actAs permission for the service account.
- audience String
- Audience to be used when generating OIDC token. The audience claim identifies the recipients that the JWT is intended for. The audience value is a single case-sensitive string. Having multiple values (array) for the audience field is not supported. More info about the OIDC JWT token audience here: https://tools.ietf.org/html/rfc7519#section-4.1.3 Note: if not specified, the Push endpoint URL will be used.
SubscriptionRetryPolicy, SubscriptionRetryPolicyArgs
- Maximum
Backoff string - The maximum delay between consecutive deliveries of a given message. Value should be between 0 and 600 seconds. Defaults to 600 seconds. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".
- Minimum
Backoff string - The minimum delay between consecutive deliveries of a given message. Value should be between 0 and 600 seconds. Defaults to 10 seconds. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".
- Maximum
Backoff string - The maximum delay between consecutive deliveries of a given message. Value should be between 0 and 600 seconds. Defaults to 600 seconds. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".
- Minimum
Backoff string - The minimum delay between consecutive deliveries of a given message. Value should be between 0 and 600 seconds. Defaults to 10 seconds. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".
- maximum
Backoff String - The maximum delay between consecutive deliveries of a given message. Value should be between 0 and 600 seconds. Defaults to 600 seconds. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".
- minimum
Backoff String - The minimum delay between consecutive deliveries of a given message. Value should be between 0 and 600 seconds. Defaults to 10 seconds. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".
- maximum
Backoff string - The maximum delay between consecutive deliveries of a given message. Value should be between 0 and 600 seconds. Defaults to 600 seconds. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".
- minimum
Backoff string - The minimum delay between consecutive deliveries of a given message. Value should be between 0 and 600 seconds. Defaults to 10 seconds. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".
- maximum_
backoff str - The maximum delay between consecutive deliveries of a given message. Value should be between 0 and 600 seconds. Defaults to 600 seconds. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".
- minimum_
backoff str - The minimum delay between consecutive deliveries of a given message. Value should be between 0 and 600 seconds. Defaults to 10 seconds. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".
- maximum
Backoff String - The maximum delay between consecutive deliveries of a given message. Value should be between 0 and 600 seconds. Defaults to 600 seconds. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".
- minimum
Backoff String - The minimum delay between consecutive deliveries of a given message. Value should be between 0 and 600 seconds. Defaults to 10 seconds. A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".
Import
Subscription can be imported using any of these accepted formats:
projects/{{project}}/subscriptions/{{name}}
{{project}}/{{name}}
{{name}}
When using the pulumi import
command, Subscription can be imported using one of the formats above. For example:
$ pulumi import gcp:pubsub/subscription:Subscription default projects/{{project}}/subscriptions/{{name}}
$ pulumi import gcp:pubsub/subscription:Subscription default {{project}}/{{name}}
$ pulumi import gcp:pubsub/subscription:Subscription default {{name}}
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Google Cloud (GCP) Classic pulumi/pulumi-gcp
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
google-beta
Terraform Provider.