From 55a7627568df6d66364e8b0ee4e2c0fa1afafe1a Mon Sep 17 00:00:00 2001 From: "PePe (Jose) Amengual" Date: Fri, 10 Apr 2020 16:46:13 -0400 Subject: [PATCH 1/2] Adding timeout for rds cluster resources and defaulting to TF default to 120m --- README.md | 6 ++++++ docs/terraform.md | 1 + main.tf | 9 +++++++++ variables.tf | 10 ++++++++++ 4 files changed, 26 insertions(+) diff --git a/README.md b/README.md index 2007d523..8593714e 100644 --- a/README.md +++ b/README.md @@ -341,6 +341,7 @@ Available targets: | storage_encrypted | Specifies whether the DB cluster is encrypted. The default is `false` for `provisioned` `engine_mode` and `true` for `serverless` `engine_mode` | bool | `false` | no | | subnets | List of VPC subnet IDs | list(string) | - | yes | | tags | Additional tags (e.g. `map('BusinessUnit','XYZ')` | map(string) | `` | no | +| timeouts_configuration | List of timeout values per action. Only valid actions are `create`, `update` and `delete` | object | `` | no | | vpc_id | VPC ID to create the cluster in (e.g. `vpc-a22222ee`) | string | - | yes | | vpc_security_group_ids | Additional security group IDs to apply to the cluster, in addition to the provisioned default security group with ingress traffic from existing CIDR blocks and existing security groups | list(string) | `` | no | | zone_id | Route53 parent zone ID. If provided (not empty), the module will create sub-domain DNS records for the DB master and replicas | string | `` | no | @@ -414,6 +415,10 @@ We deliver 10x the value for a fraction of the cost of a full-time engineer. Our Join our [Open Source Community][slack] on Slack. It's **FREE** for everyone! Our "SweetOps" community is where you get to talk with others who share a similar vision for how to rollout and manage infrastructure. This is the best place to talk shop, ask questions, solicit feedback, and work together as a community to build totally *sweet* infrastructure. +## Discourse Forums + +Participate in our [Discourse Forums][discourse]. Here you'll find answers to commonly asked questions. Most questions will be related to the enormous number of projects we support on our GitHub. Come here to collaborate on answers, find solutions, and get ideas about the products and services we value. It only takes a minute to get started! Just sign in with SSO using your GitHub account. + ## Newsletter Sign up for [our newsletter][newsletter] that covers everything on our technology radar. Receive updates on what we're up to on GitHub as well as awesome new projects we discover. @@ -537,6 +542,7 @@ Check out [our other projects][github], [follow us on twitter][twitter], [apply [testimonial]: https://cpco.io/leave-testimonial?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-rds-cluster&utm_content=testimonial [office_hours]: https://cloudposse.com/office-hours?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-rds-cluster&utm_content=office_hours [newsletter]: https://cpco.io/newsletter?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-rds-cluster&utm_content=newsletter + [discourse]: https://ask.sweetops.com/?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-rds-cluster&utm_content=discourse [email]: https://cpco.io/email?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-rds-cluster&utm_content=email [commercial_support]: https://cpco.io/commercial-support?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-rds-cluster&utm_content=commercial_support [we_love_open_source]: https://cpco.io/we-love-open-source?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/terraform-aws-rds-cluster&utm_content=we_love_open_source diff --git a/docs/terraform.md b/docs/terraform.md index 34e83cb9..ca806186 100644 --- a/docs/terraform.md +++ b/docs/terraform.md @@ -58,6 +58,7 @@ | storage_encrypted | Specifies whether the DB cluster is encrypted. The default is `false` for `provisioned` `engine_mode` and `true` for `serverless` `engine_mode` | bool | `false` | no | | subnets | List of VPC subnet IDs | list(string) | - | yes | | tags | Additional tags (e.g. `map('BusinessUnit','XYZ')` | map(string) | `` | no | +| timeouts_configuration | List of timeout values per action. Only valid actions are `create`, `update` and `delete` | object | `` | no | | vpc_id | VPC ID to create the cluster in (e.g. `vpc-a22222ee`) | string | - | yes | | vpc_security_group_ids | Additional security group IDs to apply to the cluster, in addition to the provisioned default security group with ingress traffic from existing CIDR blocks and existing security groups | list(string) | `` | no | | zone_id | Route53 parent zone ID. If provided (not empty), the module will create sub-domain DNS records for the DB master and replicas | string | `` | no | diff --git a/main.tf b/main.tf index f54dcde5..484a6c2e 100644 --- a/main.tf +++ b/main.tf @@ -79,6 +79,15 @@ resource "aws_rds_cluster" "default" { } } + dynamic "timeouts" { + for_each = var.timeouts_configuration + content { + create = lookup(timeouts_configuration.value, "create", "120m") + update = lookup(timeouts_configuration.value, "update", "120m") + delete = lookup(timeouts_configuration.value, "delete", "120m") + } + } + replication_source_identifier = var.replication_source_identifier enabled_cloudwatch_logs_exports = var.enabled_cloudwatch_logs_exports deletion_protection = var.deletion_protection diff --git a/variables.tf b/variables.tf index a1f9f92b..b302c812 100644 --- a/variables.tf +++ b/variables.tf @@ -183,6 +183,16 @@ variable "scaling_configuration" { description = "List of nested attributes with scaling properties. Only valid when `engine_mode` is set to `serverless`" } +variable "timeouts_configuration" { + type = list(object({ + create = string + update = string + delete = string + })) + default = [] + description = "List of timeout values per action. Only valid actions are `create`, `update` and `delete`" +} + variable "allowed_cidr_blocks" { type = list(string) default = [] From 997dde2312f127f0164e8caa4f1701586dd8e34b Mon Sep 17 00:00:00 2001 From: "PePe (Jose) Amengual" Date: Tue, 5 May 2020 00:19:05 -0400 Subject: [PATCH 2/2] Fixing bug in timeout config --- main.tf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.tf b/main.tf index 484a6c2e..6d92f25c 100644 --- a/main.tf +++ b/main.tf @@ -82,9 +82,9 @@ resource "aws_rds_cluster" "default" { dynamic "timeouts" { for_each = var.timeouts_configuration content { - create = lookup(timeouts_configuration.value, "create", "120m") - update = lookup(timeouts_configuration.value, "update", "120m") - delete = lookup(timeouts_configuration.value, "delete", "120m") + create = lookup(timeouts.value, "create", "120m") + update = lookup(timeouts.value, "update", "120m") + delete = lookup(timeouts.value, "delete", "120m") } }