Commit e4894dba authored by Sebastian Melchior's avatar Sebastian Melchior Committed by GitHub

feat: add handling for delete_automated_backups flag (#215)

parent b68b797d
repos: repos:
- repo: git://github.com/antonbabenko/pre-commit-terraform - repo: git://github.com/antonbabenko/pre-commit-terraform
rev: v1.27.0 rev: v1.31.0
hooks: hooks:
- id: terraform_fmt - id: terraform_fmt
- id: terraform_docs - id: terraform_docs
- repo: git://github.com/pre-commit/pre-commit-hooks - repo: git://github.com/pre-commit/pre-commit-hooks
rev: v2.5.0 rev: v3.1.0
hooks: hooks:
- id: check-merge-conflict - id: check-merge-conflict
...@@ -135,6 +135,13 @@ module "db" { ...@@ -135,6 +135,13 @@ module "db" {
1. This module does not create RDS security group. Use [terraform-aws-security-group](https://github.com/terraform-aws-modules/terraform-aws-security-group) module for this. 1. This module does not create RDS security group. Use [terraform-aws-security-group](https://github.com/terraform-aws-modules/terraform-aws-security-group) module for this.
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements
| Name | Version |
|------|---------|
| terraform | ~> 0.12.6 |
| aws | ~> 2.49 |
## Providers ## Providers
No provider. No provider.
...@@ -142,7 +149,7 @@ No provider. ...@@ -142,7 +149,7 @@ No provider.
## Inputs ## Inputs
| Name | Description | Type | Default | Required | | Name | Description | Type | Default | Required |
|------|-------------|------|---------|:-----:| |------|-------------|------|---------|:--------:|
| allocated\_storage | The allocated storage in gigabytes | `string` | n/a | yes | | allocated\_storage | The allocated storage in gigabytes | `string` | n/a | yes |
| allow\_major\_version\_upgrade | Indicates that major version upgrades are allowed. Changing this parameter does not result in an outage and the change is asynchronously applied as soon as possible | `bool` | `false` | no | | allow\_major\_version\_upgrade | Indicates that major version upgrades are allowed. Changing this parameter does not result in an outage and the change is asynchronously applied as soon as possible | `bool` | `false` | no |
| apply\_immediately | Specifies whether any database modifications are applied immediately, or during the next maintenance window | `bool` | `false` | no | | apply\_immediately | Specifies whether any database modifications are applied immediately, or during the next maintenance window | `bool` | `false` | no |
...@@ -159,12 +166,13 @@ No provider. ...@@ -159,12 +166,13 @@ No provider.
| create\_db\_subnet\_group | Whether to create a database subnet group | `bool` | `true` | no | | create\_db\_subnet\_group | Whether to create a database subnet group | `bool` | `true` | no |
| create\_monitoring\_role | Create IAM role with a defined name that permits RDS to send enhanced monitoring metrics to CloudWatch Logs. | `bool` | `false` | no | | create\_monitoring\_role | Create IAM role with a defined name that permits RDS to send enhanced monitoring metrics to CloudWatch Logs. | `bool` | `false` | no |
| db\_subnet\_group\_name | Name of DB subnet group. DB instance will be created in the VPC associated with the DB subnet group. If unspecified, will be created in the default VPC | `string` | `""` | no | | db\_subnet\_group\_name | Name of DB subnet group. DB instance will be created in the VPC associated with the DB subnet group. If unspecified, will be created in the default VPC | `string` | `""` | no |
| delete\_automated\_backups | Specifies whether to remove automated backups immediately after the DB instance is deleted | `bool` | `true` | no |
| deletion\_protection | The database can't be deleted when this value is set to true. | `bool` | `false` | no | | deletion\_protection | The database can't be deleted when this value is set to true. | `bool` | `false` | no |
| enabled\_cloudwatch\_logs\_exports | List of log types to enable for exporting to CloudWatch logs. If omitted, no logs will be exported. Valid values (depending on engine): alert, audit, error, general, listener, slowquery, trace, postgresql (PostgreSQL), upgrade (PostgreSQL). | `list(string)` | `[]` | no | | enabled\_cloudwatch\_logs\_exports | List of log types to enable for exporting to CloudWatch logs. If omitted, no logs will be exported. Valid values (depending on engine): alert, audit, error, general, listener, slowquery, trace, postgresql (PostgreSQL), upgrade (PostgreSQL). | `list(string)` | `[]` | no |
| engine | The database engine to use | `string` | n/a | yes | | engine | The database engine to use | `string` | n/a | yes |
| engine\_version | The engine version to use | `string` | n/a | yes | | engine\_version | The engine version to use | `string` | n/a | yes |
| family | The family of the DB parameter group | `string` | `""` | no | | family | The family of the DB parameter group | `string` | `""` | no |
| final\_snapshot\_identifier | The name of your final DB snapshot when this DB instance is deleted. | `string` | n/a | yes | | final\_snapshot\_identifier | The name of your final DB snapshot when this DB instance is deleted. | `string` | `null` | no |
| iam\_database\_authentication\_enabled | Specifies whether or mappings of AWS Identity and Access Management (IAM) accounts to database accounts is enabled | `bool` | `false` | no | | iam\_database\_authentication\_enabled | Specifies whether or mappings of AWS Identity and Access Management (IAM) accounts to database accounts is enabled | `bool` | `false` | no |
| identifier | The name of the RDS instance, if omitted, Terraform will assign a random, unique identifier | `string` | n/a | yes | | identifier | The name of the RDS instance, if omitted, Terraform will assign a random, unique identifier | `string` | n/a | yes |
| instance\_class | The instance type of the RDS instance | `string` | n/a | yes | | instance\_class | The instance type of the RDS instance | `string` | n/a | yes |
......
...@@ -17,6 +17,10 @@ $ terraform apply ...@@ -17,6 +17,10 @@ $ terraform apply
Note that this example may create resources which cost money. Run `terraform destroy` when you don't need these resources. Note that this example may create resources which cost money. Run `terraform destroy` when you don't need these resources.
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements
No requirements.
## Providers ## Providers
| Name | Version | | Name | Version |
......
...@@ -17,6 +17,10 @@ $ terraform apply ...@@ -17,6 +17,10 @@ $ terraform apply
Note that this example may create resources which cost money. Run `terraform destroy` when you don't need these resources. Note that this example may create resources which cost money. Run `terraform destroy` when you don't need these resources.
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements
No requirements.
## Providers ## Providers
| Name | Version | | Name | Version |
......
...@@ -17,6 +17,10 @@ $ terraform apply ...@@ -17,6 +17,10 @@ $ terraform apply
Note that this example may create resources which cost money. Run `terraform destroy` when you don't need these resources. Note that this example may create resources which cost money. Run `terraform destroy` when you don't need these resources.
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements
No requirements.
## Providers ## Providers
| Name | Version | | Name | Version |
......
...@@ -17,6 +17,10 @@ $ terraform apply ...@@ -17,6 +17,10 @@ $ terraform apply
Note that this example may create resources which cost money. Run `terraform destroy` when you don't need these resources. Note that this example may create resources which cost money. Run `terraform destroy` when you don't need these resources.
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements
No requirements.
## Providers ## Providers
| Name | Version | | Name | Version |
......
...@@ -19,6 +19,10 @@ $ terraform apply ...@@ -19,6 +19,10 @@ $ terraform apply
Note that this example may create resources which cost money. Run `terraform destroy` when you don't need these resources. Note that this example may create resources which cost money. Run `terraform destroy` when you don't need these resources.
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements
No requirements.
## Providers ## Providers
| Name | Version | | Name | Version |
......
...@@ -17,6 +17,10 @@ $ terraform apply ...@@ -17,6 +17,10 @@ $ terraform apply
Note that this example may create resources which cost money. Run `terraform destroy` when you don't need these resources. Note that this example may create resources which cost money. Run `terraform destroy` when you don't need these resources.
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements
No requirements.
## Providers ## Providers
| Name | Version | | Name | Version |
......
...@@ -17,6 +17,10 @@ $ terraform apply ...@@ -17,6 +17,10 @@ $ terraform apply
Note that this example may create resources which cost money. Run `terraform destroy` when you don't need these resources. Note that this example may create resources which cost money. Run `terraform destroy` when you don't need these resources.
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements
No requirements.
## Providers ## Providers
| Name | Version | | Name | Version |
......
...@@ -114,7 +114,8 @@ module "db_instance" { ...@@ -114,7 +114,8 @@ module "db_instance" {
timeouts = var.timeouts timeouts = var.timeouts
deletion_protection = var.deletion_protection deletion_protection = var.deletion_protection
delete_automated_backups = var.delete_automated_backups
tags = var.tags tags = var.tags
} }
......
# aws_db_instance # aws_db_instance
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements
No requirements.
## Providers ## Providers
| Name | Version | | Name | Version |
...@@ -10,7 +14,7 @@ ...@@ -10,7 +14,7 @@
## Inputs ## Inputs
| Name | Description | Type | Default | Required | | Name | Description | Type | Default | Required |
|------|-------------|------|---------|:-----:| |------|-------------|------|---------|:--------:|
| allocated\_storage | The allocated storage in gigabytes | `string` | n/a | yes | | allocated\_storage | The allocated storage in gigabytes | `string` | n/a | yes |
| allow\_major\_version\_upgrade | Indicates that major version upgrades are allowed. Changing this parameter does not result in an outage and the change is asynchronously applied as soon as possible | `bool` | `false` | no | | allow\_major\_version\_upgrade | Indicates that major version upgrades are allowed. Changing this parameter does not result in an outage and the change is asynchronously applied as soon as possible | `bool` | `false` | no |
| apply\_immediately | Specifies whether any database modifications are applied immediately, or during the next maintenance window | `bool` | `false` | no | | apply\_immediately | Specifies whether any database modifications are applied immediately, or during the next maintenance window | `bool` | `false` | no |
...@@ -24,11 +28,12 @@ ...@@ -24,11 +28,12 @@
| create | Whether to create this resource or not? | `bool` | `true` | no | | create | Whether to create this resource or not? | `bool` | `true` | no |
| create\_monitoring\_role | Create IAM role with a defined name that permits RDS to send enhanced monitoring metrics to CloudWatch Logs. | `bool` | `false` | no | | create\_monitoring\_role | Create IAM role with a defined name that permits RDS to send enhanced monitoring metrics to CloudWatch Logs. | `bool` | `false` | no |
| db\_subnet\_group\_name | Name of DB subnet group. DB instance will be created in the VPC associated with the DB subnet group. If unspecified, will be created in the default VPC | `string` | `""` | no | | db\_subnet\_group\_name | Name of DB subnet group. DB instance will be created in the VPC associated with the DB subnet group. If unspecified, will be created in the default VPC | `string` | `""` | no |
| delete\_automated\_backups | Specifies whether to remove automated backups immediately after the DB instance is deleted | `bool` | `true` | no |
| deletion\_protection | The database can't be deleted when this value is set to true. | `bool` | `false` | no | | deletion\_protection | The database can't be deleted when this value is set to true. | `bool` | `false` | no |
| enabled\_cloudwatch\_logs\_exports | List of log types to enable for exporting to CloudWatch logs. If omitted, no logs will be exported. Valid values (depending on engine): alert, audit, error, general, listener, slowquery, trace, postgresql (PostgreSQL), upgrade (PostgreSQL). | `list(string)` | `[]` | no | | enabled\_cloudwatch\_logs\_exports | List of log types to enable for exporting to CloudWatch logs. If omitted, no logs will be exported. Valid values (depending on engine): alert, audit, error, general, listener, slowquery, trace, postgresql (PostgreSQL), upgrade (PostgreSQL). | `list(string)` | `[]` | no |
| engine | The database engine to use | `string` | n/a | yes | | engine | The database engine to use | `string` | n/a | yes |
| engine\_version | The engine version to use | `string` | n/a | yes | | engine\_version | The engine version to use | `string` | n/a | yes |
| final\_snapshot\_identifier | The name of your final DB snapshot when this DB instance is deleted. | `string` | n/a | yes | | final\_snapshot\_identifier | The name of your final DB snapshot when this DB instance is deleted. | `string` | `null` | no |
| iam\_database\_authentication\_enabled | Specifies whether or mappings of AWS Identity and Access Management (IAM) accounts to database accounts is enabled | `bool` | `false` | no | | iam\_database\_authentication\_enabled | Specifies whether or mappings of AWS Identity and Access Management (IAM) accounts to database accounts is enabled | `bool` | `false` | no |
| identifier | The name of the RDS instance, if omitted, Terraform will assign a random, unique identifier | `string` | n/a | yes | | identifier | The name of the RDS instance, if omitted, Terraform will assign a random, unique identifier | `string` | n/a | yes |
| instance\_class | The instance type of the RDS instance | `string` | n/a | yes | | instance\_class | The instance type of the RDS instance | `string` | n/a | yes |
......
...@@ -93,7 +93,8 @@ resource "aws_db_instance" "this" { ...@@ -93,7 +93,8 @@ resource "aws_db_instance" "this" {
enabled_cloudwatch_logs_exports = var.enabled_cloudwatch_logs_exports enabled_cloudwatch_logs_exports = var.enabled_cloudwatch_logs_exports
deletion_protection = var.deletion_protection deletion_protection = var.deletion_protection
delete_automated_backups = var.delete_automated_backups
tags = merge( tags = merge(
var.tags, var.tags,
......
...@@ -279,3 +279,9 @@ variable "ca_cert_identifier" { ...@@ -279,3 +279,9 @@ variable "ca_cert_identifier" {
type = string type = string
default = "rds-ca-2019" default = "rds-ca-2019"
} }
variable "delete_automated_backups" {
description = "Specifies whether to remove automated backups immediately after the DB instance is deleted"
type = bool
default = true
}
# aws_db_option_group # aws_db_option_group
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements
No requirements.
## Providers ## Providers
| Name | Version | | Name | Version |
...@@ -10,7 +14,7 @@ ...@@ -10,7 +14,7 @@
## Inputs ## Inputs
| Name | Description | Type | Default | Required | | Name | Description | Type | Default | Required |
|------|-------------|------|---------|:-----:| |------|-------------|------|---------|:--------:|
| create | Whether to create this resource or not? | `bool` | `true` | no | | create | Whether to create this resource or not? | `bool` | `true` | no |
| engine\_name | Specifies the name of the engine that this option group should be associated with | `string` | n/a | yes | | engine\_name | Specifies the name of the engine that this option group should be associated with | `string` | n/a | yes |
| identifier | The identifier of the resource | `string` | n/a | yes | | identifier | The identifier of the resource | `string` | n/a | yes |
......
# aws_db_parameter_group # aws_db_parameter_group
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements
No requirements.
## Providers ## Providers
| Name | Version | | Name | Version |
...@@ -10,7 +14,7 @@ ...@@ -10,7 +14,7 @@
## Inputs ## Inputs
| Name | Description | Type | Default | Required | | Name | Description | Type | Default | Required |
|------|-------------|------|---------|:-----:| |------|-------------|------|---------|:--------:|
| create | Whether to create this resource or not? | `bool` | `true` | no | | create | Whether to create this resource or not? | `bool` | `true` | no |
| description | The description of the DB parameter group | `string` | `""` | no | | description | The description of the DB parameter group | `string` | `""` | no |
| family | The family of the DB parameter group | `string` | n/a | yes | | family | The family of the DB parameter group | `string` | n/a | yes |
......
# aws_db_subnet_group # aws_db_subnet_group
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements
No requirements.
## Providers ## Providers
| Name | Version | | Name | Version |
...@@ -10,7 +14,7 @@ ...@@ -10,7 +14,7 @@
## Inputs ## Inputs
| Name | Description | Type | Default | Required | | Name | Description | Type | Default | Required |
|------|-------------|------|---------|:-----:| |------|-------------|------|---------|:--------:|
| create | Whether to create this resource or not? | `bool` | `true` | no | | create | Whether to create this resource or not? | `bool` | `true` | no |
| identifier | The identifier of the resource | `string` | n/a | yes | | identifier | The identifier of the resource | `string` | n/a | yes |
| name\_prefix | Creates a unique name beginning with the specified prefix | `string` | n/a | yes | | name\_prefix | Creates a unique name beginning with the specified prefix | `string` | n/a | yes |
......
...@@ -356,3 +356,9 @@ variable "ca_cert_identifier" { ...@@ -356,3 +356,9 @@ variable "ca_cert_identifier" {
type = string type = string
default = "rds-ca-2019" default = "rds-ca-2019"
} }
variable "delete_automated_backups" {
description = "Specifies whether to remove automated backups immediately after the DB instance is deleted"
type = bool
default = true
}
...@@ -2,6 +2,6 @@ terraform { ...@@ -2,6 +2,6 @@ terraform {
required_version = "~> 0.12.6" required_version = "~> 0.12.6"
required_providers { required_providers {
aws = "~> 2.37" aws = "~> 2.49"
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment