Skip to content
Open
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: 2 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ resource "google_spanner_instance" "instance_num_node" {
config = var.instance_config
display_name = var.instance_display_name
name = var.instance_name
edition = var.edition
num_nodes = var.instance_size.num_nodes
labels = var.instance_labels
}
Expand All @@ -60,6 +61,7 @@ resource "google_spanner_instance" "instance_processing_units" {
config = var.instance_config
display_name = var.instance_display_name
name = var.instance_name
edition = var.edition
processing_units = var.instance_size.processing_units
labels = var.instance_labels
}
Expand Down
15 changes: 7 additions & 8 deletions modules/schedule_spanner_backup/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,25 @@
*/

module "service_account_scheduler" {
source = "terraform-google-modules/service-accounts/google"
version = "~> 4.1.1"
project_id = var.project_id
prefix = "spanner-backup-scheduler"
names = ["1"]

source = "terraform-google-modules/service-accounts/google"
version = "~> 4.4.0"
project_id = var.project_id
prefix = "spanner-backup-scheduler"
names = ["1"]
project_roles = ["${var.project_id}=>roles/workflows.invoker"]
}

module "service_account_workflow" {
source = "terraform-google-modules/service-accounts/google"
version = "~> 4.1.1"
version = "~> 4.4.0"
project_id = var.project_id
prefix = "spanner-backup-workflow"
names = ["1"]
project_roles = ["${var.project_id}=>roles/spanner.backupAdmin"]
}

module "workflow" {
source = "github.com/GoogleCloudPlatform/terraform-google-cloud-workflows?ref=v0.1.1"
source = "github.com/livechat/terraform-google-cloud-workflows"
project_id = var.project_id
workflow_name = "spanner-backup-workflow"
region = var.backup_schedule_region
Expand Down
2 changes: 1 addition & 1 deletion modules/schedule_spanner_backup/spanner_backup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ main:
call: create_backup
args:
parent: ${eachValue.parent}
backupId: ${eachValue.backupId}
backupId: ${eachValue.backupId+"-"+ text.replace_all(text.substring(time.format(sys.now()), 2, 10), "-","")}
database: ${eachValue.database}
expireTime: ${time.format(sys.now() + eachValue.expireTime)}
result: backup_result
Expand Down
4 changes: 2 additions & 2 deletions modules/schedule_spanner_backup/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
*/

terraform {
required_version = ">= 0.13"
required_version = ">= 1.5.0"
required_providers {
google = {
source = "hashicorp/google"
version = ">= 3.53, < 7"
version = ">= 6.8.0, < 7"
}
}

Expand Down
10 changes: 10 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ variable "instance_size" {
}
}

variable "edition" {
description = "The edition selected for this instance. Different editions provide different capabilities at different price points."
type = string
default = "STANDARD"
validation {
condition = can(regex("^(EDITION_UNSPECIFIED|STANDARD|ENTERPRISE|ENTERPRISE_PLUS)$", var.edition))
error_message = "The edition must be one of the following: STANDARD, ENTERPRISE, ENTERPRISE_PLUS or EDITION_UNSPECIFIED"
}
}

variable "create_instance" {
description = "Switch to use create OR use existing Spanner Instance "
type = bool
Expand Down
4 changes: 2 additions & 2 deletions versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
*/

terraform {
required_version = ">= 0.13"
required_version = ">= 1.5.0"
required_providers {
google = {
source = "hashicorp/google"
version = ">= 3.53, < 7"
version = ">= 6.8, < 7"
}
}

Expand Down
Loading