Skip to content

Commit

Permalink
feat: Add security_group_use_name_prefix variable to enable/disable…
Browse files Browse the repository at this point in the history
… name prefix usage (#289)
  • Loading branch information
naseemkullah committed May 2, 2022
1 parent 0fc15c3 commit 75ffb30
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ No modules.
| <a name="input_security_group_description"></a> [security\_group\_description](#input\_security\_group\_description) | The description of the security group. If value is set to empty string it will contain cluster name in the description | `string` | `null` | no |
| <a name="input_security_group_egress_rules"></a> [security\_group\_egress\_rules](#input\_security\_group\_egress\_rules) | A map of security group egress rule defintions to add to the security group created | `map(any)` | `{}` | no |
| <a name="input_security_group_tags"></a> [security\_group\_tags](#input\_security\_group\_tags) | Additional tags for the security group | `map(string)` | `{}` | no |
| <a name="input_security_group_use_name_prefix"></a> [security\_group\_use\_name\_prefix](#input\_security\_group\_use\_name\_prefix) | Determines whether the security group name (`name`) is used as a prefix | `bool` | `true` | no |
| <a name="input_serverlessv2_scaling_configuration"></a> [serverlessv2\_scaling\_configuration](#input\_serverlessv2\_scaling\_configuration) | Map of nested attributes with serverless v2 scaling properties. Only valid when `engine_mode` is set to `provisioned` | `map(string)` | `{}` | no |
| <a name="input_skip_final_snapshot"></a> [skip\_final\_snapshot](#input\_skip\_final\_snapshot) | Determines whether a final snapshot is created before the cluster is deleted. If true is specified, no snapshot is created | `bool` | `null` | no |
| <a name="input_snapshot_identifier"></a> [snapshot\_identifier](#input\_snapshot\_identifier) | Specifies whether or not to create this cluster from a snapshot. You can use either the name or ARN when specifying a DB cluster snapshot, or the ARN when specifying a DB snapshot | `string` | `null` | no |
Expand Down
2 changes: 2 additions & 0 deletions examples/mysql/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ module "aurora" {
db_cluster_parameter_group_name = aws_rds_cluster_parameter_group.example.id
enabled_cloudwatch_logs_exports = ["audit", "error", "general", "slowquery"]

security_group_use_name_prefix = false

tags = local.tags
}

Expand Down
3 changes: 2 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,8 @@ resource "aws_appautoscaling_policy" "this" {
resource "aws_security_group" "this" {
count = local.create_cluster && var.create_security_group ? 1 : 0

name_prefix = "${var.name}-"
name = var.security_group_use_name_prefix ? null : var.name
name_prefix = var.security_group_use_name_prefix ? "${var.name}-" : null
vpc_id = var.vpc_id
description = coalesce(var.security_group_description, "Control traffic to/from RDS Aurora ${var.name}")

Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,12 @@ variable "security_group_egress_rules" {
default = {}
}

variable "security_group_use_name_prefix" {
description = "Determines whether the security group name (`name`) is used as a prefix"
type = bool
default = true
}

variable "putin_khuylo" {
description = "Do you agree that Putin doesn't respect Ukrainian sovereignty and territorial integrity? More info: https://en.wikipedia.org/wiki/Putin_khuylo!"
type = bool
Expand Down

0 comments on commit 75ffb30

Please sign in to comment.