Skip to content

Commit

Permalink
Issue cloudposse#30: Add deletion_protection parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
krsh-off committed Feb 11, 2021
1 parent d49e6cf commit bab76eb
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 2 deletions.
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,25 @@ Available targets:
|------|---------|
| aws | >= 2.0 |

## Modules

| Name | Source | Version |
|------|--------|---------|
| dns_master | cloudposse/route53-cluster-hostname/aws | 0.12.0 |
| dns_replicas | cloudposse/route53-cluster-hostname/aws | 0.12.0 |
| this | cloudposse/label/null | 0.24.1 |

## Resources

| Name |
|------|
| [aws_docdb_cluster](https://registry.terraform.io/providers/hashicorp/aws/2.0/docs/resources/docdb_cluster) |
| [aws_docdb_cluster_instance](https://registry.terraform.io/providers/hashicorp/aws/2.0/docs/resources/docdb_cluster_instance) |
| [aws_docdb_cluster_parameter_group](https://registry.terraform.io/providers/hashicorp/aws/2.0/docs/resources/docdb_cluster_parameter_group) |
| [aws_docdb_subnet_group](https://registry.terraform.io/providers/hashicorp/aws/2.0/docs/resources/docdb_subnet_group) |
| [aws_security_group](https://registry.terraform.io/providers/hashicorp/aws/2.0/docs/resources/security_group) |
| [aws_security_group_rule](https://registry.terraform.io/providers/hashicorp/aws/2.0/docs/resources/security_group_rule) |

## Inputs

| Name | Description | Type | Default | Required |
Expand All @@ -166,6 +185,7 @@ Available targets:
| cluster\_size | Number of DB instances to create in the cluster | `number` | `3` | no |
| context | Single object for setting entire context at once.<br>See description of individual variables for details.<br>Leave string and numeric variables as `null` to use default value.<br>Individual variable settings (non-null) override settings in context object,<br>except for attributes, tags, and additional\_tag\_map, which are merged. | `any` | <pre>{<br> "additional_tag_map": {},<br> "attributes": [],<br> "delimiter": null,<br> "enabled": true,<br> "environment": null,<br> "id_length_limit": null,<br> "label_key_case": null,<br> "label_order": [],<br> "label_value_case": null,<br> "name": null,<br> "namespace": null,<br> "regex_replace_chars": null,<br> "stage": null,<br> "tags": {}<br>}</pre> | no |
| db\_port | DocumentDB port | `number` | `27017` | no |
| deletion\_protection | A value that indicates whether the DB cluster has deletion protection enabled | `bool` | `false` | no |
| delimiter | Delimiter to be used between `namespace`, `environment`, `stage`, `name` and `attributes`.<br>Defaults to `-` (hyphen). Set to `""` to use no delimiter at all. | `string` | `null` | no |
| enabled | Set to false to prevent the module from creating any resources | `bool` | `null` | no |
| enabled\_cloudwatch\_logs\_exports | List of log types to export to cloudwatch. The following log types are supported: `audit`, `error`, `general`, `slowquery` | `list(string)` | `[]` | no |
Expand Down Expand Up @@ -210,7 +230,6 @@ Available targets:
| security\_group\_arn | ARN of the DocumentDB cluster Security Group |
| security\_group\_id | ID of the DocumentDB cluster Security Group |
| security\_group\_name | Name of the DocumentDB cluster Security Group |

<!-- markdownlint-restore -->


Expand Down
21 changes: 20 additions & 1 deletion docs/terraform.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,25 @@
|------|---------|
| aws | >= 2.0 |

## Modules

| Name | Source | Version |
|------|--------|---------|
| dns_master | cloudposse/route53-cluster-hostname/aws | 0.12.0 |
| dns_replicas | cloudposse/route53-cluster-hostname/aws | 0.12.0 |
| this | cloudposse/label/null | 0.24.1 |

## Resources

| Name |
|------|
| [aws_docdb_cluster](https://registry.terraform.io/providers/hashicorp/aws/2.0/docs/resources/docdb_cluster) |
| [aws_docdb_cluster_instance](https://registry.terraform.io/providers/hashicorp/aws/2.0/docs/resources/docdb_cluster_instance) |
| [aws_docdb_cluster_parameter_group](https://registry.terraform.io/providers/hashicorp/aws/2.0/docs/resources/docdb_cluster_parameter_group) |
| [aws_docdb_subnet_group](https://registry.terraform.io/providers/hashicorp/aws/2.0/docs/resources/docdb_subnet_group) |
| [aws_security_group](https://registry.terraform.io/providers/hashicorp/aws/2.0/docs/resources/security_group) |
| [aws_security_group_rule](https://registry.terraform.io/providers/hashicorp/aws/2.0/docs/resources/security_group_rule) |

## Inputs

| Name | Description | Type | Default | Required |
Expand All @@ -29,6 +48,7 @@
| cluster\_size | Number of DB instances to create in the cluster | `number` | `3` | no |
| context | Single object for setting entire context at once.<br>See description of individual variables for details.<br>Leave string and numeric variables as `null` to use default value.<br>Individual variable settings (non-null) override settings in context object,<br>except for attributes, tags, and additional\_tag\_map, which are merged. | `any` | <pre>{<br> "additional_tag_map": {},<br> "attributes": [],<br> "delimiter": null,<br> "enabled": true,<br> "environment": null,<br> "id_length_limit": null,<br> "label_key_case": null,<br> "label_order": [],<br> "label_value_case": null,<br> "name": null,<br> "namespace": null,<br> "regex_replace_chars": null,<br> "stage": null,<br> "tags": {}<br>}</pre> | no |
| db\_port | DocumentDB port | `number` | `27017` | no |
| deletion\_protection | A value that indicates whether the DB cluster has deletion protection enabled | `bool` | `false` | no |
| delimiter | Delimiter to be used between `namespace`, `environment`, `stage`, `name` and `attributes`.<br>Defaults to `-` (hyphen). Set to `""` to use no delimiter at all. | `string` | `null` | no |
| enabled | Set to false to prevent the module from creating any resources | `bool` | `null` | no |
| enabled\_cloudwatch\_logs\_exports | List of log types to export to cloudwatch. The following log types are supported: `audit`, `error`, `general`, `slowquery` | `list(string)` | `[]` | no |
Expand Down Expand Up @@ -73,5 +93,4 @@
| security\_group\_arn | ARN of the DocumentDB cluster Security Group |
| security\_group\_id | ID of the DocumentDB cluster Security Group |
| security\_group\_name | Name of the DocumentDB cluster Security Group |

<!-- markdownlint-restore -->
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ resource "aws_docdb_cluster" "default" {
preferred_maintenance_window = var.preferred_maintenance_window
final_snapshot_identifier = lower(module.this.id)
skip_final_snapshot = var.skip_final_snapshot
deletion_protection = var.deletion_protection
apply_immediately = var.apply_immediately
storage_encrypted = var.storage_encrypted
kms_key_id = var.kms_key_id
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ variable "skip_final_snapshot" {
default = true
}

variable "deletion_protection" {
type = bool
description = "A value that indicates whether the DB cluster has deletion protection enabled"
default = false
}

variable "apply_immediately" {
type = bool
description = "Specifies whether any cluster modifications are applied immediately, or during the next maintenance window"
Expand Down

0 comments on commit bab76eb

Please sign in to comment.