Terraform Module to provision an AWS instance RDS Postgres and store credentials on Parameter Store.
This Terraform module creates the following AWS resources:
- RDS: instace Postgres RDS;
- Parameter Store
- identifier: save database identifier;
- endpoint: save database endpoint;
- username: save database superuser;
- passsword: save database superuser password (random generated);
- This module is meant for use with Terraform 1.0.3+. It has not been tested with previous versions of Terraform.
- An AWS account and your credentials (
aws_access_key_id
andaws_secret_access_key
) configured. There are several ways to do this (environment variables, shared credentials file, etc.): my preference is to store them in a credential file. More information in the AWS Provider documentation.
terraform {
required_version = ">= 1.0.3"
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.51.0"
}
random = {
source = "hashicorp/random"
version = "~> 3.1.0"
}
}
}
provider "aws" {
region = "sa-east-1"
shared_credentials_file = "~/.aws/credentials"
}
module "aws_rds_postgres" {
source = "victorcechinel/rds-ssm-postgres/aws"
version = "1.0.6"
identifier = "rds-identifier"
subnet_group = "my-subnet-group"
parameter_group = "my-parameter-group"
vpc_security_group_ids = ["vpc-security-group-ids"]
}
- To use in other zones, change the variable
availability_zone
.
Name | Description | Type | Default | Required |
---|---|---|---|---|
identifier | Database identifier | string | - | yes |
subnet_group | Database subnet group | string | - | yes |
parameter_group | Database parameter group | string | - | yes |
vpc_security_group_ids | Database VPC security group | list string | - | yes |
Name | Description |
---|---|
rds_postgres_endpoint | Database endpoint |
rds_postgres_username | Database superuser |
rds_postgres_password | Database superuser password |
Module written by @victorcechinel. Linkedin. Module Support: terraform-aws-rds-ssm-postgres. Contributions and comments are welcomed.
- Save parameter store secure;
- Lambda to connect database and create data;