Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ docker_generate_docs:
-e ENABLE_BPMETADATA='1' \
-v "$(CURDIR)":/workspace \
$(REGISTRY_URL)/${DOCKER_IMAGE_DEVELOPER_TOOLS}:${DOCKER_TAG_VERSION_DEVELOPER_TOOLS} \
/bin/bash -c 'source /usr/local/bin/task_helper_functions.sh && generate_docs'
/bin/bash -c 'source /usr/local/bin/task_helper_functions.sh && generate_docs display'

# Alias for backwards compatibility
.PHONY: generate_docs
Expand Down
35 changes: 35 additions & 0 deletions examples/bigquery-separate-pub-sub/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Bigquery Example

This example illustrates how to use the `pub` amd `sub` module.

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| project\_id | The project ID to manage the Pub/Sub resources | `string` | n/a | yes |

## Outputs

| Name | Description |
|------|-------------|
| project\_id | The project ID |
| topic\_labels | The labels of the Pub/Sub topic created |
| topic\_name | The name of the Pub/Sub topic created |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

## Requirements

The following sections describe the requirements which must be met in
order to invoke this example. The requirements of the
[root module][root-module-requirements] must be met.

## Usage

To provision this example, populate `terraform.tfvars` with the [required variables](#inputs) and run the following commands within
this directory:
- `terraform init` to get the plugins
- `terraform plan` to see the infrastructure plan
- `terraform apply` to apply the infrastructure build
- `terraform destroy` to destroy the built infrastructure
75 changes: 75 additions & 0 deletions examples/bigquery-separate-pub-sub/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/**
* Copyright 2018 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

provider "google" {
region = "europe-west1"
}

module "pub" {
source = "terraform-google-modules/pubsub/google//modules/pub"
version = "~> 7.0"

project_id = var.project_id
topic = "cft-tf-pub-topic-bigquery"
topic_labels = {
foo_label = "foo_value"
bar_label = "bar_value"
}
}

module "sub" {
source = "terraform-google-modules/pubsub/google//modules/sub"
version = "~> 7.0"

project_id = var.project_id
topic = "cft-tf-pub-topic-bigquery"

bigquery_subscriptions = [
{
name = "sub_example_subscription"
table = "${var.project_id}:sub_example_dataset.sub_example_table"
},
]

depends_on = [
google_bigquery_table.test
]

}

resource "google_bigquery_dataset" "test" {
project = var.project_id
dataset_id = "sub_example_dataset"
location = "europe-west1"
}

resource "google_bigquery_table" "test" {
project = var.project_id
deletion_protection = false
table_id = "sub_example_table"
dataset_id = google_bigquery_dataset.test.dataset_id

schema = <<EOF
[
{
"name": "data",
"type": "STRING",
"mode": "NULLABLE",
"description": "The data"
}
]
EOF
}
30 changes: 30 additions & 0 deletions examples/bigquery-separate-pub-sub/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* Copyright 2018 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

output "project_id" {
value = var.project_id
description = "The project ID"
}

output "topic_name" {
value = module.pub.topic
description = "The name of the Pub/Sub topic created"
}

output "topic_labels" {
value = module.pub.topic_labels
description = "The labels of the Pub/Sub topic created"
}
20 changes: 20 additions & 0 deletions examples/bigquery-separate-pub-sub/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* Copyright 2018 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

variable "project_id" {
type = string
description = "The project ID to manage the Pub/Sub resources"
}
35 changes: 35 additions & 0 deletions examples/cloud_storage-separate-pub-sub/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Cloud Storage Example

This example illustrates how to use the `pub` and `sub` module.

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| project\_id | The project ID to manage the Pub/Sub resources | `string` | n/a | yes |

## Outputs

| Name | Description |
|------|-------------|
| bucket\_name | The name of the Cloud Storage bucket created |
| project\_id | The project ID |
| topic\_name | The name of the Pub/Sub topic created |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

## Requirements

The following sections describe the requirements which must be met in
order to invoke this example. The requirements of the
[root module][root-module-requirements] must be met.

## Usage

To provision this example, populate `terraform.tfvars` with the [required variables](#inputs) and run the following commands within
this directory:
- `terraform init` to get the plugins
- `terraform plan` to see the infrastructure plan
- `terraform apply` to apply the infrastructure build
- `terraform destroy` to destroy the built infrastructure
62 changes: 62 additions & 0 deletions examples/cloud_storage-separate-pub-sub/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/**
* Copyright 2018-2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

resource "random_id" "bucket_suffix" {
byte_length = 4
}

provider "google" {
region = "europe-west1"
}

module "pub" {
source = "terraform-google-modules/pubsub/google//modules/pub"
version = "~> 7.0"

project_id = var.project_id
topic = "cft-tf-pub-topic-cloud-storage"

topic_labels = {
foo_label = "foo_value"
}
}

module "sub" {
source = "terraform-google-modules/pubsub/google//modules/sub"
version = "~> 7.0"

project_id = var.project_id
topic = "cft-tf-pub-topic-cloud-storage"

cloud_storage_subscriptions = [
{
name = "sub_example_bucket_subscription"
bucket = google_storage_bucket.test.name

filename_prefix = "example_prefix_"
filename_suffix = "_example_suffix"
filename_datetime_format = "YYYY-MM-DD/hh_mm_ssZ"
ack_deadline_seconds = 300
},
]
}

resource "google_storage_bucket" "test" {
project = var.project_id
name = join("-", ["sub_test_bucket", random_id.bucket_suffix.hex])
location = "europe-west1"
uniform_bucket_level_access = true
}
30 changes: 30 additions & 0 deletions examples/cloud_storage-separate-pub-sub/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/**
* Copyright 2018-2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

output "project_id" {
value = var.project_id
description = "The project ID"
}

output "bucket_name" {
value = google_storage_bucket.test.name
description = "The name of the Cloud Storage bucket created"
}

output "topic_name" {
value = module.pub.topic
description = "The name of the Pub/Sub topic created"
}
20 changes: 20 additions & 0 deletions examples/cloud_storage-separate-pub-sub/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* Copyright 2018 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

variable "project_id" {
type = string
description = "The project ID to manage the Pub/Sub resources"
}
35 changes: 35 additions & 0 deletions examples/simple-separate-pub-sub/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Simple Example

This example illustrates how to use the `pub` and `sub` module.

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| project\_id | The project ID to manage the Pub/Sub resources | `string` | n/a | yes |

## Outputs

| Name | Description |
|------|-------------|
| project\_id | The project ID |
| topic\_labels | The labels of the Pub/Sub topic created |
| topic\_name | The name of the Pub/Sub topic created |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

## Requirements

The following sections describe the requirements which must be met in
order to invoke this example. The requirements of the
[root module][root-module-requirements] must be met.

## Usage

To provision this example, populate `terraform.tfvars` with the [required variables](#inputs) and run the following commands within
this directory:
- `terraform init` to get the plugins
- `terraform plan` to see the infrastructure plan
- `terraform apply` to apply the infrastructure build
- `terraform destroy` to destroy the built infrastructure
Loading