#terraform-aws-modules (2022-06)
Terraform Modules
Discussions related to https://github.com/terraform-aws-modules
Archive: https://archive.sweetops.com/terraform-aws-modules/
2022-06-09

Question regarding the RDS module
I’m not able to spin up a cluster with version aurora-mysql8.0
Here is my module invocation
module "rds_cluster_aurora_mysql" {
source = "git::<https://github.com/cloudposse/terraform-aws-rds-cluster.git?ref=tags/0.50.2>"
name = "${var.namespace}-${var.network_env}-db"
engine = "aurora-mysql"
cluster_family = "aurora-mysql8.0"
cluster_size = 1
admin_user = var.master_username
admin_password = random_string.master_password.result
db_port = var.db_port
db_name = var.db_name
allowed_cidr_blocks = [data.terraform_remote_state.network.outputs.vpc_cidr]
vpc_security_group_ids = [aws_security_group.db_sg.id]
instance_type = "db.t3.medium"
maintenance_window = "sun:14:00-sun:14:30"
backup_window = "08:00-08:30"
storage_encrypted = true
vpc_id = data.terraform_remote_state.network.outputs.vpc_id
subnets = data.terraform_remote_state.network.outputs.private_subnets
tags = {
Name = "${var.namespace}-${var.network_env}-rds"
Environment = var.network_env
}
}
And here’s the error
│ Error: error creating RDS cluster: InvalidParameterCombination: The Parameter Group some-service-dev-db-20220608115930742500000001 with DBParameterGroupFamily aurora-mysql8.0 cannot be used for this instance. Please use a Parameter Group with DBParameterGroupFamily aurora-mysql5.7
│ status code: 400, request id: 0aab02b6-5175-47b1-9548-61bb89f3a575
│
│ with module.rds_cluster_aurora_mysql.aws_rds_cluster.primary[0],
│ on terraform-aws-rds-cluster/main.tf line 60, in resource "aws_rds_cluster" "primary":
│ 60: resource "aws_rds_cluster" "primary" {
There is no reference to 5.7 in my code! Please help

This value needs to change
https://github.com/cloudposse/terraform-aws-rds-cluster#input_cluster_family
Cc: @Nikhil Owalekar

@RB What should that be set to?

Please use a Parameter Group with DBParameterGroupFamily aurora-mysql5.7

Find reference information for Aurora MySQL.

Well I want to use MySQL 8. Not 5.7

Someone responded me elsewhere. Looks like I need to explicitly set engine_version as well. I don’t think it’s ideal that the module uses 5.7 as default.

it’s open source, feel free to make it simpler

we accept pull requests that add value (as long as they don’t break current systems)

I’ll submit a PR soon


@Ashutosh Verma has joined the channel

Hey all trying to use the elasticache-memcached module to create a “simple” cluster, but getting errors about the cluster_id being invalid. Am I setting something wrong here? Tried tracing it back through the module.this code and got lost in the weeds, and hoping it’s something simple.
module "risk-memcached-staging" {
source = "cloudposse/elasticache-memcached/aws"
version = "0.15.1"
az_mode = "single-az"
availability_zone = "us-east-1a"
vpc_id = var.legacy_vpc_id
subnets = var.legacy_private_subnet_ids
cluster_size = "3"
instance_type = "cache.t2.micro"
engine_version = "1.6.12"
apply_immediately = true
elasticache_parameter_group_family = "default.memcached1.6"
}
And the errors:
Error: expected length of cluster_id to be in the range (1 - 50), got
on .terraform/modules/risk-memcached-staging/main.tf line 104, in resource "aws_elasticache_cluster" "default":
104: cluster_id = module.this.id
Error: invalid value for cluster_id (must contain only lowercase alphanumeric characters and hyphens)
on .terraform/modules/risk-memcached-staging/main.tf line 104, in resource "aws_elasticache_cluster" "default":
104: cluster_id = module.this.id
Error: invalid value for cluster_id (must begin with a lowercase letter)
on .terraform/modules/risk-memcached-staging/main.tf line 104, in resource "aws_elasticache_cluster" "default":
104: cluster_id = module.this.id

Hi @Jason Gilfoil! Are you familiar with https://github.com/cloudposse/terraform-null-label/tree/0.25.0 ?

i am not, i started looking at it, but is that required to use this module?

You would probably need to add [context.tf](http://context.tf)
in the same TF configuration directory where you define risk-memcached-staging
module and then in risk-memcached-staging
pass the values for naming schema by specifying
context = module.this.context

ok, thanks, i’ll dig into that

Take a look at the source of module you are calling: https://github.com/cloudposse/terraform-aws-elasticache-memcached/blob/0.15.1/main.tf#L104
cluster_id = module.this.id

module.this.id
gets computed from https://github.com/cloudposse/terraform-aws-elasticache-memcached/blob/0.15.1/context.tf
Once you study https://github.com/cloudposse/terraform-null-label/tree/0.25.0 , you will understand what vars you can pass down to risk-memcached-staging
…. but by default it would be {namespace}-{tenant}-{environment}-{stage}-{name}-{attributes}
(less the tenant). So you might get by by providing:
module "risk-memcached-staging" {
...
namespace = "" #your value
environment = "" #your value
stage = "" #your value
name = "" #your value
attributes = ["",""] #your values
...
}
in addition to what you already have …

gotcha, yea i think i can probably put this together. Was hoping for a simple module to throw a db up, but this will probably be better long term.

thanks azec, got this up yesterday without too much effort, as you suggested.