Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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 @@ -18,7 +18,7 @@
# Make will use bash instead of sh
SHELL := /usr/bin/env bash

DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 0
DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 0.13
DOCKER_IMAGE_DEVELOPER_TOOLS := cft/developer-tools
REGISTRY_URL := gcr.io/cloud-foundation-cicd

Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ destinations (Cloud Pub/Sub, BigQuery, Cloud Monitoring). The infrastructure is
shared by all SLOs and a Pub/Sub topic created as input stream for SLO reports.

### Compatibility

This module is meant for use with Terraform 0.12.
This module is meant for use with Terraform 0.13. If you haven't
[upgraded](https://www.terraform.io/upgrade-guides/0-13.html) and need a Terraform
0.12.x-compatible version of this module, the last released version
intended for Terraform 0.12.x is [v1.0.2](https://registry.terraform.io/modules/terraform-google-modules/-slo/google/v1.0.2).

### Usage

Expand Down
2 changes: 1 addition & 1 deletion build/int.cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ tags:
- 'integration'
substitutions:
_DOCKER_IMAGE_DEVELOPER_TOOLS: 'cft/developer-tools'
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '0.8.0'
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '0.13'
2 changes: 1 addition & 1 deletion build/lint.cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ tags:
- 'lint'
substitutions:
_DOCKER_IMAGE_DEVELOPER_TOOLS: 'cft/developer-tools'
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '0.8.0'
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '0.13'
10 changes: 7 additions & 3 deletions examples/native/simple_example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@ To run this example, you'll need:
## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| app\_engine\_project\_id | App Engine project id | string | n/a | yes |
| project\_id | Project id | string | n/a | yes |
|------|-------------|------|---------|:--------:|
| app\_engine\_project\_id | App Engine project id | `any` | n/a | yes |
| project\_id | Project id | `any` | n/a | yes |

## Outputs

No output.

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

Expand Down
18 changes: 9 additions & 9 deletions examples/native/yaml_example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@ To run this example, you'll need:
## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| app\_engine\_project\_id | App Engine project id | string | n/a | yes |
| project\_id | Project id | string | n/a | yes |
|------|-------------|------|---------|:--------:|
| app\_engine\_project\_id | App Engine project id | `any` | n/a | yes |
| project\_id | Project id | `any` | n/a | yes |

## Outputs

| Name | Description |
|------|-------------|
| slo-cass-latency5ms-window | |
| slo-gae-latency500ms | |
| slo-gcp-latency400ms | |
| slo-gcp-latency500ms-window | |
| slo-uptime-latency500ms | |
| slo-uptime-pass | |
| slo-cass-latency5ms-window | n/a |
| slo-gae-latency500ms | n/a |
| slo-gcp-latency400ms | n/a |
| slo-gcp-latency500ms-window | n/a |
| slo-uptime-latency500ms | n/a |
| slo-uptime-pass | n/a |

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

Expand Down
12 changes: 6 additions & 6 deletions examples/slo-generator/simple_example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ To run this example, you'll need:
## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| labels | Project labels | map | `<map>` | no |
| project\_id | Project id | string | n/a | yes |
| region | Region | string | `"us-east1"` | no |
| schedule | Cron-like Cloud Scheduler schedule | string | `"* * * * */1"` | no |
| stackdriver\_host\_project\_id | Stackdriver host project id | string | n/a | yes |
|------|-------------|------|---------|:--------:|
| labels | Project labels | `map` | `{}` | no |
| project\_id | Project id | `any` | n/a | yes |
| region | Region | `string` | `"us-east1"` | no |
| schedule | Cron-like Cloud Scheduler schedule | `string` | `"* * * * */1"` | no |
| stackdriver\_host\_project\_id | Stackdriver host project id | `any` | n/a | yes |

## Outputs

Expand Down
4 changes: 2 additions & 2 deletions examples/slo-generator/simple_example/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
*/

provider "google" {
version = "~> 3.19"
version = "~> 3.61"
}

provider "google-beta" {
version = "~> 3.19"
version = "~> 3.61"
}

module "slo-pipeline" {
Expand Down
20 changes: 10 additions & 10 deletions examples/slo-generator/yaml_example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@ To run this example, you'll need:
## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| bucket\_name | Bucket name for SLO configs and GCF code zips | string | n/a | yes |
| labels | Project labels | map | `<map>` | no |
| project\_id | Project id | string | n/a | yes |
| region | Region | string | `"us-east1"` | no |
| schedule | Cron-like Cloud Scheduler schedule | string | `"* * * * */1"` | no |
| stackdriver\_host\_project\_id | Stackdriver host project id | string | n/a | yes |
|------|-------------|------|---------|:--------:|
| bucket\_name | Bucket name for SLO configs and GCF code zips | `any` | n/a | yes |
| labels | Project labels | `map` | `{}` | no |
| project\_id | Project id | `any` | n/a | yes |
| region | Region | `string` | `"us-east1"` | no |
| schedule | Cron-like Cloud Scheduler schedule | `string` | `"* * * * */1"` | no |
| stackdriver\_host\_project\_id | Stackdriver host project id | `any` | n/a | yes |

## Outputs

| Name | Description |
|------|-------------|
| slo-generator-bq-latency | |
| slo-generator-gcf-errors | |
| slo-generator-pubsub-ack | |
| slo-generator-bq-latency | n/a |
| slo-generator-gcf-errors | n/a |
| slo-generator-pubsub-ack | n/a |
| slo\_pipeline | SLO pipeline outputs |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
Expand Down
48 changes: 24 additions & 24 deletions modules/slo-pipeline/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,30 +42,30 @@ See the [fixture project](../../test/setup/main.tf) for an example to create thi
## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| dataset\_create | Whether to create the BigQuery dataset | bool | `"true"` | no |
| dataset\_default\_table\_expiration\_ms | The default lifetime of the slo table in the dataset, in milliseconds. Default is never (Recommended) | number | `"-1"` | no |
| exporters | SLO export destinations config | any | n/a | yes |
| extra\_files | Extra files to add to the Google Cloud Function code | object | `<list>` | no |
| function\_bucket\_name | Name of the bucket to create to store the Cloud Function code | string | `"slo-pipeline"` | no |
| function\_environment\_variables | Cloud Function environment variables | map | `<map>` | no |
| function\_memory | Memory in MB for the Cloud Function (increases with no. of SLOs) | string | `"128"` | no |
| function\_name | Cloud Function name | string | `"slo-pipeline"` | no |
| function\_source\_directory | The contents of this directory will be archived and used as the function source. (defaults to standard SLO generator code) | string | `""` | no |
| function\_timeout | Timeout (in seconds) | string | `"90"` | no |
| grant\_iam\_roles | Grant IAM roles to created service accounts | string | `"true"` | no |
| labels | Labels to apply to all resources created | map | `<map>` | no |
| project\_id | Project id to create SLO infrastructure | string | n/a | yes |
| pubsub\_topic\_name | Pub/Sub topic name | string | `"slo-export-topic"` | no |
| region | Region for the App Engine app | string | `"us-east1"` | no |
| service\_account\_email | Service account email (optional) | string | `""` | no |
| service\_account\_name | Name of the service account to create | string | `"slo-pipeline"` | no |
| slo\_generator\_version | SLO generator library version | string | `"1.4.0"` | no |
| storage\_bucket\_class | The Storage Class of the new bucket. Supported values include: STANDARD, MULTI_REGIONAL, REGIONAL, NEARLINE, COLDLINE | string | `"STANDARD"` | no |
| storage\_bucket\_location | The GCS location | string | `"US"` | no |
| use\_custom\_service\_account | Use a custom service account (pass service_account_email if true) | bool | `"false"` | no |
| vpc\_connector | VPC Connector. The format of this field is projects/*/locations/*/connectors/*. | string | `"null"` | no |
| vpc\_connector\_egress\_settings | VPC Connector Egress Settings. Allowed values are ALL_TRAFFIC and PRIVATE_RANGES_ONLY. | string | `"null"` | no |
|------|-------------|------|---------|:--------:|
| dataset\_create | Whether to create the BigQuery dataset | `bool` | `true` | no |
| dataset\_default\_table\_expiration\_ms | The default lifetime of the slo table in the dataset, in milliseconds. Default is never (Recommended) | `number` | `-1` | no |
| exporters | SLO export destinations config | `any` | n/a | yes |
| extra\_files | Extra files to add to the Google Cloud Function code | <pre>list(object({<br> content = string,<br> filename = string<br> }))</pre> | `[]` | no |
| function\_bucket\_name | Name of the bucket to create to store the Cloud Function code | `string` | `"slo-pipeline"` | no |
| function\_environment\_variables | Cloud Function environment variables | `map` | `{}` | no |
| function\_memory | Memory in MB for the Cloud Function (increases with no. of SLOs) | `number` | `128` | no |
| function\_name | Cloud Function name | `string` | `"slo-pipeline"` | no |
| function\_source\_directory | The contents of this directory will be archived and used as the function source. (defaults to standard SLO generator code) | `string` | `""` | no |
| function\_timeout | Timeout (in seconds) | `string` | `"90"` | no |
| grant\_iam\_roles | Grant IAM roles to created service accounts | `bool` | `true` | no |
| labels | Labels to apply to all resources created | `map` | `{}` | no |
| project\_id | Project id to create SLO infrastructure | `any` | n/a | yes |
| pubsub\_topic\_name | Pub/Sub topic name | `string` | `"slo-export-topic"` | no |
| region | Region for the App Engine app | `string` | `"us-east1"` | no |
| service\_account\_email | Service account email (optional) | `string` | `""` | no |
| service\_account\_name | Name of the service account to create | `string` | `"slo-pipeline"` | no |
| slo\_generator\_version | SLO generator library version | `string` | `"1.4.0"` | no |
| storage\_bucket\_class | The Storage Class of the new bucket. Supported values include: STANDARD, MULTI\_REGIONAL, REGIONAL, NEARLINE, COLDLINE | `string` | `"STANDARD"` | no |
| storage\_bucket\_location | The GCS location | `string` | `"US"` | no |
| use\_custom\_service\_account | Use a custom service account (pass service\_account\_email if true) | `bool` | `false` | no |
| vpc\_connector | VPC Connector. The format of this field is projects/\*/locations/\*/connectors/\*. | `any` | `null` | no |
| vpc\_connector\_egress\_settings | VPC Connector Egress Settings. Allowed values are ALL\_TRAFFIC and PRIVATE\_RANGES\_ONLY. | `any` | `null` | no |

## Outputs

Expand Down
16 changes: 14 additions & 2 deletions modules/slo-pipeline/versions.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2018 Google LLC
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,5 +15,17 @@
*/

terraform {
required_version = ">= 0.12"
required_version = ">= 0.13"
required_providers {

google = {
source = "hashicorp/google"
version = "~> 3.53"
}
}

provider_meta "google" {
module_name = "blueprints/terraform/terraform-google-slo:slo-pipeline/v1.0.0"
}

}
54 changes: 27 additions & 27 deletions modules/slo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,33 +45,33 @@ See the [fixture project](../../test/setup/main.tf) for an example to create thi
## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| bucket\_force\_destroy | When deleting the GCS bucket containing the cloud function, delete all objects in the bucket first. | string | `"true"` | no |
| config | SLO Configuration | object | n/a | yes |
| config\_bucket | SLO generator GCS bucket to store configs and GCF code. | string | `""` | no |
| config\_bucket\_region | Config bucket region | string | `"EU"` | no |
| error\_budget\_policy | Error budget policy config | object | `<list>` | no |
| extra\_files | Extra files to add to the Google Cloud Function code | object | `<list>` | no |
| function\_environment\_variables | Cloud Function environment variables. | map(string) | `<map>` | no |
| function\_labels | A set of key/value label pairs to assign to the function. | map(string) | `<map>` | no |
| function\_memory | Memory in MB for the Cloud Function (increases with no. of SLOs) | string | `"128"` | no |
| function\_name | Cloud Function name. Defaults to slo-{service}-{feature}-{slo} | string | `""` | no |
| function\_source\_archive\_bucket\_labels | A set of key/value label pairs to assign to the function source archive bucket. | map(string) | `<map>` | no |
| function\_source\_directory | The contents of this directory will be archived and used as the function source. (defaults to standard SLO generator code) | string | `""` | no |
| function\_timeout | The amount of time in seconds allotted for the execution of the function. | number | `"60"` | no |
| grant\_iam\_roles | Grant IAM roles to created service accounts | string | `"true"` | no |
| labels | Labels to apply to all resources created | map | `<map>` | no |
| message\_data | The data to send in the topic message. | string | `"dGVzdA=="` | no |
| project\_id | SLO project id | string | n/a | yes |
| region | Region to deploy the Cloud Function in | string | `"us-east1"` | no |
| schedule | Cron-like schedule for Cloud Scheduler | string | `"* * * * */1"` | no |
| service\_account\_email | Service account email (optional) | string | `""` | no |
| service\_account\_name | Service account name (in case the generated one is too long) | string | `""` | no |
| slo\_generator\_version | SLO generator library version | string | `"1.4.0"` | no |
| time\_zone | The timezone to use in scheduler | string | `"Etc/UTC"` | no |
| use\_custom\_service\_account | Use a custom service account (pass service_account_email if true) | bool | `"false"` | no |
| vpc\_connector | VPC Connector. The format of this field is projects/*/locations/*/connectors/*. | string | `"null"` | no |
| vpc\_connector\_egress\_settings | VPC Connector Egress Settings. Allowed values are ALL_TRAFFIC and PRIVATE_RANGES_ONLY. | string | `"null"` | no |
|------|-------------|------|---------|:--------:|
| bucket\_force\_destroy | When deleting the GCS bucket containing the cloud function, delete all objects in the bucket first. | `string` | `"true"` | no |
| config | SLO Configuration | <pre>object({<br> slo_name = string<br> slo_target = number<br> slo_description = string<br> service_name = string<br> feature_name = string<br> metadata = map(string)<br> backend = any<br> exporters = any<br> })</pre> | n/a | yes |
| config\_bucket | SLO generator GCS bucket to store configs and GCF code. | `string` | `""` | no |
| config\_bucket\_region | Config bucket region | `string` | `"EU"` | no |
| error\_budget\_policy | Error budget policy config | <pre>list(object({<br> error_budget_policy_step_name = string<br> measurement_window_seconds = number<br> alerting_burn_rate_threshold = number<br> urgent_notification = bool<br> overburned_consequence_message = string<br> achieved_consequence_message = string<br> }))</pre> | <pre>[<br> {<br> "achieved_consequence_message": "Last hour on track",<br> "alerting_burn_rate_threshold": 9,<br> "error_budget_policy_step_name": "a.Last 1 hour",<br> "measurement_window_seconds": 3600,<br> "overburned_consequence_message": "Page the SRE team to defend the SLO",<br> "urgent_notification": true<br> },<br> {<br> "achieved_consequence_message": "Last 12 hours on track",<br> "alerting_burn_rate_threshold": 3,<br> "error_budget_policy_step_name": "b.Last 12 hours",<br> "measurement_window_seconds": 43200,<br> "overburned_consequence_message": "Page the SRE team to defend the SLO",<br> "urgent_notification": true<br> },<br> {<br> "achieved_consequence_message": "Last week on track",<br> "alerting_burn_rate_threshold": 1.5,<br> "error_budget_policy_step_name": "c.Last 7 days",<br> "measurement_window_seconds": 604800,<br> "overburned_consequence_message": "Dev team dedicates two Engineers to the action items of the post-mortem",<br> "urgent_notification": false<br> },<br> {<br> "achieved_consequence_message": "Unfreeze release, per the agreed roll-out policy",<br> "alerting_burn_rate_threshold": 1,<br> "error_budget_policy_step_name": "d.Last 28 days",<br> "measurement_window_seconds": 2419200,<br> "overburned_consequence_message": "Freeze release, unless related to reliability or security",<br> "urgent_notification": false<br> }<br>]</pre> | no |
| extra\_files | Extra files to add to the Google Cloud Function code | <pre>list(object({<br> content = string,<br> filename = string<br> }))</pre> | `[]` | no |
| function\_environment\_variables | Cloud Function environment variables. | `map(string)` | `{}` | no |
| function\_labels | A set of key/value label pairs to assign to the function. | `map(string)` | `{}` | no |
| function\_memory | Memory in MB for the Cloud Function (increases with no. of SLOs) | `number` | `128` | no |
| function\_name | Cloud Function name. Defaults to slo-{service}-{feature}-{slo} | `string` | `""` | no |
| function\_source\_archive\_bucket\_labels | A set of key/value label pairs to assign to the function source archive bucket. | `map(string)` | `{}` | no |
| function\_source\_directory | The contents of this directory will be archived and used as the function source. (defaults to standard SLO generator code) | `string` | `""` | no |
| function\_timeout | The amount of time in seconds allotted for the execution of the function. | `number` | `60` | no |
| grant\_iam\_roles | Grant IAM roles to created service accounts | `bool` | `true` | no |
| labels | Labels to apply to all resources created | `map` | `{}` | no |
| message\_data | The data to send in the topic message. | `string` | `"dGVzdA=="` | no |
| project\_id | SLO project id | `any` | n/a | yes |
| region | Region to deploy the Cloud Function in | `string` | `"us-east1"` | no |
| schedule | Cron-like schedule for Cloud Scheduler | `string` | `"* * * * */1"` | no |
| service\_account\_email | Service account email (optional) | `string` | `""` | no |
| service\_account\_name | Service account name (in case the generated one is too long) | `string` | `""` | no |
| slo\_generator\_version | SLO generator library version | `string` | `"1.4.0"` | no |
| time\_zone | The timezone to use in scheduler | `string` | `"Etc/UTC"` | no |
| use\_custom\_service\_account | Use a custom service account (pass service\_account\_email if true) | `bool` | `false` | no |
| vpc\_connector | VPC Connector. The format of this field is projects/\*/locations/\*/connectors/\*. | `any` | `null` | no |
| vpc\_connector\_egress\_settings | VPC Connector Egress Settings. Allowed values are ALL\_TRAFFIC and PRIVATE\_RANGES\_ONLY. | `any` | `null` | no |

## Outputs

Expand Down
16 changes: 14 additions & 2 deletions modules/slo/versions.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2018 Google LLC
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,5 +15,17 @@
*/

terraform {
required_version = ">= 0.12"
required_version = ">= 0.13"
required_providers {

google = {
source = "hashicorp/google"
version = "~> 3.53"
}
}

provider_meta "google" {
module_name = "blueprints/terraform/terraform-google-slo:slo/v1.0.0"
}

}
2 changes: 1 addition & 1 deletion test/integration/simple_example/controls/gcp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
control "gcp" do
title "GCP Resources"

describe google_storage_bucket(name: slo_pipeline["function_bucket_name"]) do
describe google_storage_bucket(name: slo_pipeline[:function_bucket_name]) do
it { should exist }
end
end
2 changes: 1 addition & 1 deletion test/integration/simple_example/inspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: simple_example
depends:
- name: inspec-gcp
git: https://github.com/inspec/inspec-gcp.git
tag: v0.10.0
tag: v1.8.8

attributes:

Expand Down
Loading