Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better use of tags as map #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

myoung34
Copy link

No description provided.

Copy link

@X-Guardian X-Guardian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like the ability to use mapped tags, but suggest we don't force the use of the identifier prefix in the same commit.

envname = "${var.envname}"
envtype = "${var.envtype}"
}
tags = "${merge(var.tags, map("Name", format("%s", var.identifier_prefix)))}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are forcing the use of a Name tag assigned to the identifier_prefix, as well as any tags in the map. Can we not have this?

variable "identifier_prefix" {
type = "string"
default = ""

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we leave the default for the identifier_prefix?

}

// Create single DB instance
resource "aws_rds_cluster_instance" "cluster_instance_0" {
identifier = "${var.identifier_prefix != "" ? format("%s-node-0", var.identifier_prefix) : format("%s-aurora-node-0", var.envname)}"
identifier = "${format("%s-node-0", var.identifier_prefix)}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Allow the identifier_prefix to be empty

envname = "${var.envname}"
envtype = "${var.envtype}"
}
tags = "${merge(var.tags, map("Name", format("%s", var.identifier_prefix)))}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

@@ -201,7 +201,7 @@ resource "aws_rds_cluster_instance" "cluster_instance_n" {
count = "${var.replica_scale_enabled ? var.replica_scale_min : var.replica_count}"
engine = "${var.engine}"
engine_version = "${var.engine-version}"
identifier = "${var.identifier_prefix != "" ? format("%s-node-%d", var.identifier_prefix, count.index + 1) : format("%s-aurora-node-%d", var.envname, count.index + 1)}"
identifier = "${format("%s-node-%d", var.identifier_prefix, count.index + 1)}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

envname = "${var.envname}"
envtype = "${var.envtype}"
}
tags = "${merge(var.tags, map("Name", format("%s", var.identifier_prefix)))}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

}

// Create DB Cluster
resource "aws_rds_cluster" "default" {
cluster_identifier = "${var.identifier_prefix != "" ? format("%s-cluster", var.identifier_prefix) : format("%s-aurora-cluster", var.envname)}"
cluster_identifier = "${format("%s-cluster", var.identifier_prefix)}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

@@ -266,7 +263,7 @@ data "aws_iam_policy_document" "monitoring-rds-assume-role-policy" {

resource "aws_iam_role" "rds-enhanced-monitoring" {
count = "${var.monitoring_interval > 0 ? 1 : 0}"
name = "rds-enhanced-monitoring-${var.envname}"
name = "rds-enhanced-monitoring-${var.identifier_prefix}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest the iam_role name is parameterised

@raymondbutcher
Copy link
Contributor

My thoughts on this:

  1. Add var.tags so that I can choose what tags I want to put on these resources.
    • But don't alter the tags that I pass in. I don't want them prefixed, or maybe I do, but I can easily do that myself when passing the tags into this module.
  2. Remove var.envname and var.envtype because I don't use those concepts in every project.
    • I'm not really sure why there is both var.name (which is only used for db subnet) and var.identifier_prefix. I think I would always set them to be the same.
    • So I would delete var.envname and var.envtype and var.identifier_prefix and use var.name for naming things. The module user can choose to pass in name = "${var.envtype}-${var.envname}-mydbname" if they want.
    • But messing with these names is a big breaking change so I would probably just this alone and just focus on tags.

@zacharyabresch
Copy link

Any movement on this? Seems like a pretty big gap and is putting us in the position of having to maintain our own fork just for this feature.

@raymondbutcher
Copy link
Contributor

I think we should go with #32 because it's backwards compatible and only deals with tags, not names.

@zacharyabresch would #32 work for you?

@zacharyabresch
Copy link

Definitely. I'm also looking for just tags to be functional. In the meantime, we're maintaining a private fork but we'd rather not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants