Search code examples
terraformterraform-provider-aws

Clone RDS Parameter Group


Can I duplicate the current RDS cluster parameter group named template_mysql5.7, make adjustments to a specific parameter, and utilize it when setting up an RDS instance using Terraform?


Solution

  • I don't think you can directly clone it, if your setup is not managed in CloudFormation.

    If it is, you can check the CloudFormation template, which should contain the values.

    If you didn't create it via CloudFormation, you could get a nice JSON using aws cli

    aws rds describe-db-parameters --db-parameter-group-name {your_parameter_group_name}
    

    or even easier, check the network tab when you open your parameter group in AWS and look for requests to https://eu-west-1.console.aws.amazon.com/rds/console/proxy/rds

    some of them will contain this request body

    contentString="Action=DescribeDBParameters&DBParameterGroupName={your_group_name}&Version=2014-10-31"
    

    in the response of this request you will see a nice XML containging your parameters. Depending on the number of parameters, it could be multiple pages of data, but they should be there.

    <Parameters>
          <Parameter>
            <ApplyType>dynamic</ApplyType>
            <DataType>string</DataType>
            <Description>Sets the application name to be reported in statistics and logs.</Description>
            <ApplyMethod>pending-reboot</ApplyMethod>
            <ParameterName>application_name</ParameterName>
            <Source>engine-default</Source>
            <IsModifiable>true</IsModifiable>
          </Parameter>
          <Parameter>
          ........
    </Parameters>
    

    You can then easily construct the terraform parameters using the XML.