Skip to content

Commit

Permalink
resource namig rule
Browse files Browse the repository at this point in the history
  • Loading branch information
Young-ook committed Aug 2, 2019
1 parent b37ce8b commit 3dbb6ea
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
You can use this module like as below example.

```
odule "mysql" {
module "mysql" {
source = "tf-mod/mysql/aws"
version = "1.0.0"
Expand Down
4 changes: 2 additions & 2 deletions label.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ resource "random_string" "suffix" {
### frigga naming rule
locals {
name = "${join("-", compact(list(var.name, var.stack, var.detail, random_string.suffix.result)))}"
cluster_name = "${local.name}"
cluster_id = "${local.name}"
cluster-name = "${local.name}"
cluster-id = "${local.name}"
}
8 changes: 4 additions & 4 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ resource "aws_security_group" "db" {
}"
}

resource "aws_security_group_rule" "db_ingress_rules" {
resource "aws_security_group_rule" "db-ingress-rules" {
type = "ingress"
from_port = "${var.mysql_port}"
to_port = "${var.mysql_port}"
Expand Down Expand Up @@ -69,7 +69,7 @@ resource "aws_db_parameter_group" "db" {

### rds (aurora)
resource "aws_rds_cluster" "db" {
cluster_identifier_prefix = "${local.cluster_id}-"
cluster_identifier_prefix = "${local.cluster-id}-"
engine = "aurora-mysql"
engine_version = "${var.mysql_version}"
engine_mode = "provisioned"
Expand All @@ -94,7 +94,7 @@ resource "aws_rds_cluster" "db" {
### instances
resource "aws_rds_cluster_instance" "db" {
count = "${var.mysql_node_count}"
identifier = "${local.cluster_id}-${count.index}"
identifier = "${local.cluster-id}-${count.index}"
cluster_identifier = "${aws_rds_cluster.db.id}"
instance_class = "${var.mysql_node_type}"
engine = "aurora-mysql"
Expand All @@ -106,7 +106,7 @@ resource "aws_rds_cluster_instance" "db" {
### dns records
resource "aws_route53_record" "db" {
zone_id = "${var.dns_zone_id}"
name = "${local.cluster_id}-db.${var.dns_zone}"
name = "${local.cluster-id}-db.${var.dns_zone}"
type = "CNAME"
ttl = 300
records = ["${coalescelist(aws_rds_cluster.db.*.endpoint, list(""))}"]
Expand Down

0 comments on commit 3dbb6ea

Please sign in to comment.