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

Parameterized name as suffix for all resources tag #31

Closed
wants to merge 2 commits into from
Closed

Parameterized name as suffix for all resources tag #31

wants to merge 2 commits into from

Conversation

wellsiau-aws
Copy link
Collaborator

Resolve #29

Since for_each cannot resolve value from random-id provider, the best way to address this is by letting customer to choose the random id. This will keep it deterministic for each plan / apply.

I also externalized other parameters such as EKS version and CIDR. This allows end-user to use the module as-is from abstraction such as AWS Service Catalog or Terraform Cloud no-code provisioning without making changes to the locals.

@carlosrodlop
Copy link
Collaborator

Thanks for your contribution @wellsiau-aws I made a couple of comments for our review

Once you apply your final version, please remember to apply the same considerations for Blueprints 02 (at-scale)

@sboardwell your thought are welcome!

@@ -18,3 +32,19 @@ variable "temp_license" {
description = "Temporary license details"
type = map(string)
}

variable "k8s_version" {
Copy link
Collaborator

Choose a reason for hiding this comment

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

@wellsiau-aws I believe that K8 version is best to not be parametrised in alignment with the EKS Addons v5 https://github.com/aws-ia/terraform-aws-eks-blueprints-addons/blob/main/tests/complete/main.tf#L65 and blueprints patterns https://github.com/aws-ia/terraform-aws-eks-blueprints/blob/main/patterns/stateful/main.tf#L6 in benefit of maintenance and its support.

It is aligned with Blueprints Terraform caveats that differs from AWS Quickstart approach. In the second there were many parameters to be configured (including passing your existing VPC in our old CloudBees CI which makes things more complicated to maintain).

Consecutive releases of this addons increase the version of the K8s as well as the CloudBees CI charts https://github.com/cloudbees/terraform-aws-cloudbees-ci-eks-addon/blob/main/main.tf#L12 ==> That version bump requires to be tested and validated. Leaving the K8s version as variable could lead to a situation not tested and frustration for end-user.

Note: At the end blueprints are seen as pattern but users can modify locals for their requirements at their own risk (assuming they know what they are doing).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This variable makes it easier for user to run test without modifying the underlying .tf files.

That said, I recognized the concern of externalizing other cluster / EKS level attributes, which are not the purpose of this reference blueprint.

default = "1.26"
}

variable "vpc_cidr" {
Copy link
Collaborator

Choose a reason for hiding this comment

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

@wellsiau-aws I personally believe that CIDR for the EKS cluster VPC is best to not be parametrised in alignment with the EKS Addons v5 https://github.com/aws-ia/terraform-aws-eks-blueprints-addons/blob/main/tests/complete/main.tf#L47 and blueprints patterns https://github.com/aws-ia/terraform-aws-eks-blueprints/blob/main/patterns/stateful/main.tf#L38 in benefit of maintenance.

As it was said before, it is aligned with Blueprints Terraform caveats that differs from AWS Quickstart approach.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

same as above

@@ -5,18 +5,18 @@ data "aws_route53_zone" "this" {
data "aws_availability_zones" "available" {}

locals {
name = "cbci-bp01-i${random_integer.ramdom_id.result}"
region = "us-east-1"
name = "cbci-bp-${var.name}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggestions:

1.- Replace cbci-bp-${var.name} by cbci-bp01${local.name}. Note cbci-bp01 ==> it refers to CBCI Blueprints 01 (getting started). It does nothing to do with random
2.- Add to locals

locals {
      name  = var.name == "" ? "" : "-${var.name}"
}

3.- Please, repeat the same approach for cbci-bp02${local.name}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

sounds good, I will add the suggestion

@carlosrodlop
Copy link
Collaborator

It has been addressed in #36

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.

[Blueprints, 01-getting-started] Tag Invalid for_each argument
2 participants