Adding new parameters to existing aws_db_parameter_group

2,623 views
Skip to first unread message

Ionut Cadariu

unread,
Jul 24, 2017, 9:19:31 AM7/24/17
to Terraform
Hi,

I created a Terraform module for AuororaDB  that is working as expected but I have one "little problem" and I can't find a proper solution to this.

Is it possible to add new parameters to an existing aws_db_parameter_group by using the attributes exported by the resource(arn/id) ?

I am using this code to create the resource, which is working fine and it modifies one parameter but I'm not sure how to do in case of multiple parameters (since it's running as a module i can't say how many parameters to be used because on some env i need 3, on others only one, etc)

# Aurora DB Parameter Group
resource "aws_db_parameter_group" "rds_db_param" {
  count = "${var.is_enabled_db_group_param}"

  description = "auroradb parameter group"
  name        = "${var.db_param_group_name}"
  family      = "${var.db_param_group_family}"

  parameter {
    name         = "${var.db_param_name}"
    value        = "${var.db_param_value}"
  }
}

But if later I will need to change a new DB parameter, this can't be done without modifying the entire RDS module and add a new parameter which will mess my other evn where I need only one parameter to be changed.

Is there a similar way of appending parameters as is the case of security groups? (where i can use a resource like aws_security_group_rule to add a new rule and append it to the existing security group)

Thanks,
Ionut

Ionut Cadariu

unread,
Jul 26, 2017, 6:36:30 AM7/26/17
to Terraform
Am I the only one that is trying to figure this out ? :(

Troy

unread,
Oct 17, 2017, 2:15:48 AM10/17/17
to Terraform
Hi

I'm not sure I understand your problem. If want you want to do is use a list for the parameter argument you can do that.

Check out https://github.com/terraform-aws-modules/terraform-aws-rds. Essentially just change your "parameter {...}", to "parameter = [{...},{...}]".

Cheers
Troy

Ionut Cadariu

unread,
Nov 8, 2017, 12:13:31 PM11/8/17
to terrafo...@googlegroups.com
Thanks, 

It worked.

Br,
Ionut

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/terraform/issues
IRC: #terraform-tool on Freenode
---
You received this message because you are subscribed to a topic in the Google Groups "Terraform" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/terraform-tool/6HQCuqYWVi0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to terraform-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/ec2ed3cd-b412-42c0-9b43-b4530417e580%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Ionut

Prakhar Budholiya

unread,
Dec 10, 2018, 4:47:10 AM12/10/18
to Terraform

Hi Ionut, 

I am also facing same problem, If i am writing each parameter as a block than i am able to create the db parameter group. But if i am using a loop instead it just create the parameter group with first parameter and gives error that parameter group already exists.
Did you face this issue ?

To unsubscribe from this group and all its topics, send an email to terraform-too...@googlegroups.com.



--
Ionut

Ionut Cadariu

unread,
Dec 10, 2018, 6:15:46 AM12/10/18
to Terraform
Hey Prakhar, 

In the db module I defined parameter like this:  parameter   = ["${var.rds_cluster_parameters}"] 
When I call the module, I am using this block of code to change parameters:

rds_cluster_parameters = [
    {
      name         = "binlog_format"
      value        = "ROW"
      apply_method = "pending-reboot"
    },
  ]


Let me know if you need more help.

Ionut
Reply all
Reply to author
Forward
0 new messages