Commit cb99d7bf authored by Anton Babenko's avatar Anton Babenko

Minor fixes for db_option_group (#55) and prepared release

parent 236c2176
repos: repos:
- repo: git://github.com/antonbabenko/pre-commit-terraform - repo: git://github.com/antonbabenko/pre-commit-terraform
rev: v1.7.0 rev: v1.7.3
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: v1.2.3 rev: v1.3.0
hooks: hooks:
- id: check-merge-conflict - id: check-merge-conflict
...@@ -127,6 +127,7 @@ module "db" { ...@@ -127,6 +127,7 @@ module "db" {
| character_set_name | (Optional) The character set name to use for DB encoding in Oracle instances. This can't be changed. See Oracle Character Sets Supported in Amazon RDS for more information. | string | `` | no | | character_set_name | (Optional) The character set name to use for DB encoding in Oracle instances. This can't be changed. See Oracle Character Sets Supported in Amazon RDS for more information. | string | `` | no |
| copy_tags_to_snapshot | On delete, copy all Instance tags to the final snapshot (if final_snapshot_identifier is specified) | string | `false` | no | | copy_tags_to_snapshot | On delete, copy all Instance tags to the final snapshot (if final_snapshot_identifier is specified) | string | `false` | no |
| create_db_instance | Whether to create a database instance | string | `true` | no | | create_db_instance | Whether to create a database instance | string | `true` | no |
| create_db_option_group | Whether to create a database option group | string | `true` | no |
| create_db_parameter_group | Whether to create a database parameter group | string | `true` | no | | create_db_parameter_group | Whether to create a database parameter group | string | `true` | no |
| create_db_subnet_group | Whether to create a database subnet group | string | `true` | no | | create_db_subnet_group | Whether to create a database subnet group | string | `true` | no |
| create_monitoring_role | Create IAM role with a defined name that permits RDS to send enhanced monitoring metrics to CloudWatch Logs. | string | `false` | no | | create_monitoring_role | Create IAM role with a defined name that permits RDS to send enhanced monitoring metrics to CloudWatch Logs. | string | `false` | no |
...@@ -142,11 +143,15 @@ module "db" { ...@@ -142,11 +143,15 @@ module "db" {
| kms_key_id | The ARN for the KMS encryption key. If creating an encrypted replica, set this to the destination KMS ARN. If storage_encrypted is set to true and kms_key_id is not specified the default KMS key created in your account will be used | string | `` | no | | kms_key_id | The ARN for the KMS encryption key. If creating an encrypted replica, set this to the destination KMS ARN. If storage_encrypted is set to true and kms_key_id is not specified the default KMS key created in your account will be used | string | `` | no |
| license_model | License model information for this DB instance. Optional, but required for some DB engines, i.e. Oracle SE1 | string | `` | no | | license_model | License model information for this DB instance. Optional, but required for some DB engines, i.e. Oracle SE1 | string | `` | no |
| maintenance_window | The window to perform maintenance in. Syntax: 'ddd:hh24:mi-ddd:hh24:mi'. Eg: 'Mon:00:00-Mon:03:00' | string | - | yes | | maintenance_window | The window to perform maintenance in. Syntax: 'ddd:hh24:mi-ddd:hh24:mi'. Eg: 'Mon:00:00-Mon:03:00' | string | - | yes |
| major_engine_version | Specifies the major version of the engine that this option group should be associated with | string | `` | no |
| monitoring_interval | The interval, in seconds, between points when Enhanced Monitoring metrics are collected for the DB instance. To disable collecting Enhanced Monitoring metrics, specify 0. The default is 0. Valid Values: 0, 1, 5, 10, 15, 30, 60. | string | `0` | no | | monitoring_interval | The interval, in seconds, between points when Enhanced Monitoring metrics are collected for the DB instance. To disable collecting Enhanced Monitoring metrics, specify 0. The default is 0. Valid Values: 0, 1, 5, 10, 15, 30, 60. | string | `0` | no |
| monitoring_role_arn | The ARN for the IAM role that permits RDS to send enhanced monitoring metrics to CloudWatch Logs. Must be specified if monitoring_interval is non-zero. | string | `` | no | | monitoring_role_arn | The ARN for the IAM role that permits RDS to send enhanced monitoring metrics to CloudWatch Logs. Must be specified if monitoring_interval is non-zero. | string | `` | no |
| monitoring_role_name | Name of the IAM role which will be created when create_monitoring_role is enabled. | string | `rds-monitoring-role` | no | | monitoring_role_name | Name of the IAM role which will be created when create_monitoring_role is enabled. | string | `rds-monitoring-role` | no |
| multi_az | Specifies if the RDS instance is multi-AZ | string | `false` | no | | multi_az | Specifies if the RDS instance is multi-AZ | string | `false` | no |
| name | The DB name to create. If omitted, no database is created initially | string | `` | no | | name | The DB name to create. If omitted, no database is created initially | string | `` | no |
| option_group_description | The description of the option group | string | `` | no |
| option_group_name | Name of the DB option group to associate. Setting this automatically disables option_group creation | string | `` | no |
| options | A list of Options to apply. | list | `<list>` | no |
| parameter_group_name | Name of the DB parameter group to associate. Setting this automatically disables parameter_group creation | string | `` | no | | parameter_group_name | Name of the DB parameter group to associate. Setting this automatically disables parameter_group creation | string | `` | no |
| parameters | A list of DB parameters (map) to apply | string | `<list>` | no | | parameters | A list of DB parameters (map) to apply | string | `<list>` | no |
| password | Password for the master DB user. Note that this may show up in logs, and it will be stored in the state file | string | - | yes | | password | Password for the master DB user. Note that this may show up in logs, and it will be stored in the state file | string | - | yes |
...@@ -179,6 +184,8 @@ module "db" { ...@@ -179,6 +184,8 @@ module "db" {
| this_db_instance_resource_id | The RDS Resource ID of this instance | | this_db_instance_resource_id | The RDS Resource ID of this instance |
| this_db_instance_status | The RDS instance status | | this_db_instance_status | The RDS instance status |
| this_db_instance_username | The master username for the database | | this_db_instance_username | The master username for the database |
| this_db_option_group_arn | The ARN of the db option group |
| this_db_option_group_id | DB option group |
| this_db_parameter_group_arn | The ARN of the db parameter group | | this_db_parameter_group_arn | The ARN of the db parameter group |
| this_db_parameter_group_id | The db parameter group id | | this_db_parameter_group_id | The db parameter group id |
| this_db_subnet_group_arn | The ARN of the db subnet group | | this_db_subnet_group_arn | The ARN of the db subnet group |
......
...@@ -77,9 +77,9 @@ module "db" { ...@@ -77,9 +77,9 @@ module "db" {
# DB subnet group # DB subnet group
subnet_ids = ["${data.aws_subnet_ids.all.ids}"] subnet_ids = ["${data.aws_subnet_ids.all.ids}"]
# DB parameter group # DB parameter group
family = "mysql5.7" family = "mysql5.7"
# DB option group # DB option group
major_engine_version = "5.7" major_engine_version = "5.7"
monitoring_interval = "30" monitoring_interval = "30"
monitoring_role_arn = "${aws_iam_role.rds_enhanced_monitoring.arn}" monitoring_role_arn = "${aws_iam_role.rds_enhanced_monitoring.arn}"
} }
...@@ -37,6 +37,7 @@ module "db_option_group" { ...@@ -37,6 +37,7 @@ module "db_option_group" {
create = "${local.enable_create_db_option_group}" create = "${local.enable_create_db_option_group}"
identifier = "${var.identifier}" identifier = "${var.identifier}"
name_prefix = "${var.identifier}-" name_prefix = "${var.identifier}-"
option_group_description = "${var.option_group_description}"
engine_name = "${var.engine}" engine_name = "${var.engine}"
major_engine_version = "${var.major_engine_version}" major_engine_version = "${var.major_engine_version}"
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
| monitoring_role_name | Name of the IAM role which will be created when create_monitoring_role is enabled. | string | `rds-monitoring-role` | no | | monitoring_role_name | Name of the IAM role which will be created when create_monitoring_role is enabled. | string | `rds-monitoring-role` | no |
| multi_az | Specifies if the RDS instance is multi-AZ | string | `false` | no | | multi_az | Specifies if the RDS instance is multi-AZ | string | `false` | no |
| name | The DB name to create. If omitted, no database is created initially | string | `` | no | | name | The DB name to create. If omitted, no database is created initially | string | `` | no |
| option_group_name | Name of the DB option group to associate. | string | `` | no |
| parameter_group_name | Name of the DB parameter group to associate | string | `` | no | | parameter_group_name | Name of the DB parameter group to associate | string | `` | no |
| password | Password for the master DB user. Note that this may show up in logs, and it will be stored in the state file | string | - | yes | | password | Password for the master DB user. Note that this may show up in logs, and it will be stored in the state file | string | - | yes |
| port | The port on which the DB accepts connections | string | - | yes | | port | The port on which the DB accepts connections | string | - | yes |
......
# aws_db_option_group
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Inputs
| Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:|
| create | Whether to create this resource or not? | string | `true` | no |
| engine_name | Specifies the name of the engine that this option group should be associated with | string | - | yes |
| identifier | The identifier of the resource | string | - | yes |
| major_engine_version | Specifies the major version of the engine that this option group should be associated with | string | - | yes |
| name_prefix | Creates a unique name beginning with the specified prefix | string | - | yes |
| option_group_description | The description of the option group | string | `` | no |
| options | A list of Options to apply | list | `<list>` | no |
| tags | A mapping of tags to assign to the resource | map | `<map>` | no |
## Outputs
| Name | Description |
|------|-------------|
| this_db_option_group_arn | The ARN of the db option group |
| this_db_option_group_id | The db option group id |
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
#####################
# DB option group
#####################
resource "aws_db_option_group" "this" { resource "aws_db_option_group" "this" {
count = "${var.create ? 1 : 0}" count = "${var.create ? 1 : 0}"
...@@ -12,4 +9,8 @@ resource "aws_db_option_group" "this" { ...@@ -12,4 +9,8 @@ resource "aws_db_option_group" "this" {
option = ["${var.options}"] option = ["${var.options}"]
tags = "${merge(var.tags, map("Name", format("%s", var.identifier)))}" tags = "${merge(var.tags, map("Name", format("%s", var.identifier)))}"
lifecycle {
create_before_destroy = true
}
} }
# DB option group
output "this_db_option_group_id" { output "this_db_option_group_id" {
description = "The db option group id" description = "The db option group id"
value = "${element(split(",", join(",", aws_db_option_group.this.*.id)), 0)}" value = "${element(split(",", join(",", aws_db_option_group.this.*.id)), 0)}"
......
...@@ -26,7 +26,7 @@ variable "major_engine_version" { ...@@ -26,7 +26,7 @@ variable "major_engine_version" {
variable "options" { variable "options" {
type = "list" type = "list"
description = "A list of Options to apply." description = "A list of Options to apply"
default = [] default = []
} }
......
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