Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
terraform-aws-rds
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Terraform Modules
terraform-aws-rds
Commits
363432ea
Commit
363432ea
authored
Oct 12, 2017
by
Anton Babenko
Committed by
GitHub
Oct 12, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9 from yamaszone/master
Added complete example for Postgres RDS
parents
d86b10ba
d888609f
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
170 additions
and
5 deletions
+170
-5
README.md
README.md
+3
-2
README.md
examples/complete/mysql/README.md
+2
-2
main.tf
examples/complete/mysql/main.tf
+1
-1
outputs.tf
examples/complete/mysql/outputs.tf
+0
-0
README.md
examples/complete/postgres/README.md
+19
-0
main.tf
examples/complete/postgres/main.tf
+63
-0
outputs.tf
examples/complete/postgres/outputs.tf
+82
-0
No files found.
README.md
View file @
363432ea
...
@@ -56,7 +56,7 @@ module "db" {
...
@@ -56,7 +56,7 @@ module "db" {
# Snapshot name upon DB deletion
# Snapshot name upon DB deletion
final_snapshot_identifier
=
"demodb"
final_snapshot_identifier
=
"demodb"
parameters
=
[
parameters
=
[
{
{
name
=
"character_set_client"
name
=
"character_set_client"
...
@@ -73,7 +73,8 @@ module "db" {
...
@@ -73,7 +73,8 @@ module "db" {
Examples
Examples
--------
--------
*
[
Complete RDS example
](
https://github.com/terraform-aws-modules/terraform-aws-rds/tree/master/examples/complete
)
*
[
Complete RDS example for MySQL
](
https://github.com/terraform-aws-modules/terraform-aws-rds/tree/master/examples/complete/mysql
)
*
[
Complete RDS example for PostgreSQL
](
https://github.com/terraform-aws-modules/terraform-aws-rds/tree/master/examples/complete/postgres
)
*
[
Enhanced monitoring example
](
https://github.com/terraform-aws-modules/terraform-aws-rds/tree/master/examples/enhanced_monitoring
)
*
[
Enhanced monitoring example
](
https://github.com/terraform-aws-modules/terraform-aws-rds/tree/master/examples/enhanced_monitoring
)
Limitations
Limitations
...
...
examples/complete/README.md
→
examples/complete/
mysql/
README.md
View file @
363432ea
Complete RDS example
Complete RDS example
for MySQL
====================
====================
==========
Configuration in this directory creates set of RDS resources including DB instance, DB subnet group and DB parameter group.
Configuration in this directory creates set of RDS resources including DB instance, DB subnet group and DB parameter group.
...
...
examples/complete/main.tf
→
examples/complete/m
ysql/m
ain.tf
View file @
363432ea
...
@@ -22,7 +22,7 @@ data "aws_security_group" "default" {
...
@@ -22,7 +22,7 @@ data "aws_security_group" "default" {
# DB
# DB
#####
#####
module
"db"
{
module
"db"
{
source
=
"../../"
source
=
"../../
../
"
identifier
=
"demodb"
identifier
=
"demodb"
...
...
examples/complete/outputs.tf
→
examples/complete/
mysql/
outputs.tf
View file @
363432ea
File moved
examples/complete/postgres/README.md
0 → 100644
View file @
363432ea
Complete RDS example for PostgreSQL
===================================
Configuration in this directory creates set of RDS resources including DB instance, DB subnet group and DB parameter group.
Data sources are used to discover existing VPC resources (VPC, subnet and security group).
Usage
=====
To run this example you need to execute:
```
bash
$
terraform init
$
terraform plan
$
terraform apply
```
Note that this example may create resources which cost money. Run
`terraform destroy`
when you don't need these resources.
examples/complete/postgres/main.tf
0 → 100644
View file @
363432ea
provider
"aws"
{
region
=
"us-west-1"
}
##############################################################
# Data sources to get VPC, subnets and security group details
##############################################################
data
"aws_vpc"
"default"
{
default
=
true
}
data
"aws_subnet_ids"
"all"
{
vpc_id
=
"
${data
.
aws_vpc
.
default
.
id
}
"
}
data
"aws_security_group"
"default"
{
vpc_id
=
"
${data
.
aws_vpc
.
default
.
id
}
"
name
=
"default"
}
#####
# DB
#####
module
"db"
{
source
=
"../../../"
identifier
=
"demodb"
engine
=
"postgres"
engine_version
=
"9.6.3"
instance_class
=
"db.t2.large"
allocated_storage
=
5
storage_encrypted
=
false
# kms_key_id = "arm:aws:kms:<region>:<accound id>:key/<kms key id>"
name
=
"demodb"
# NOTE: Do NOT use 'user' as the value for 'username' as it throws:
# "Error creating DB Instance: InvalidParameterValue: MasterUsername
# user cannot be used as it is a reserved word used by the engine"
username
=
"demouser"
password
=
"YourPwdShouldBeLongAndSecure!"
port
=
"5432"
vpc_security_group_ids
=
[
"
${data
.
aws_security_group
.
default
.
id
}
"
]
maintenance_window
=
"Mon:00:00-Mon:03:00"
backup_window
=
"03:00-06:00"
backup_retention_period
=
0
// disable backups to create DB faster
tags
=
{
Owner
=
"user"
Environment
=
"dev"
}
# DB subnet group
subnet_ids
=
[
"
${data
.
aws_subnet_ids
.
all
.
ids
}
"
]
# DB parameter group
family
=
"postgres9.6"
# Snapshot name upon DB deletion
final_snapshot_identifier
=
"demodb"
}
examples/complete/postgres/outputs.tf
0 → 100644
View file @
363432ea
# DB instance
output
"this_db_instance_address"
{
description
=
"The address of the RDS instance"
value
=
"
${module
.
db
.
this_db_instance_address
}
"
}
output
"this_db_instance_arn"
{
description
=
"The ARN of the RDS instance"
value
=
"
${module
.
db
.
this_db_instance_arn
}
"
}
output
"this_db_instance_availability_zone"
{
description
=
"The availability zone of the RDS instance"
value
=
"
${module
.
db
.
this_db_instance_availability_zone
}
"
}
output
"this_db_instance_endpoint"
{
description
=
"The connection endpoint"
value
=
"
${module
.
db
.
this_db_instance_endpoint
}
"
}
output
"this_db_instance_hosted_zone_id"
{
description
=
"The canonical hosted zone ID of the DB instance (to be used in a Route 53 Alias record)"
value
=
"
${module
.
db
.
this_db_instance_hosted_zone_id
}
"
}
output
"this_db_instance_id"
{
description
=
"The RDS instance ID"
value
=
"
${module
.
db
.
this_db_instance_id
}
"
}
output
"this_db_instance_resource_id"
{
description
=
"The RDS Resource ID of this instance"
value
=
"
${module
.
db
.
this_db_instance_resource_id
}
"
}
output
"this_db_instance_status"
{
description
=
"The RDS instance status"
value
=
"
${module
.
db
.
this_db_instance_status
}
"
}
output
"this_db_instance_name"
{
description
=
"The database name"
value
=
"
${module
.
db
.
this_db_instance_name
}
"
}
output
"this_db_instance_username"
{
description
=
"The master username for the database"
value
=
"
${module
.
db
.
this_db_instance_username
}
"
}
output
"this_db_instance_password"
{
description
=
"The database password (this password may be old, because Terraform doesn't track it after initial creation)"
value
=
"
${module
.
db
.
this_db_instance_password
}
"
}
output
"this_db_instance_port"
{
description
=
"The database port"
value
=
"
${module
.
db
.
this_db_instance_port
}
"
}
# DB subnet group
output
"this_db_subnet_group_id"
{
description
=
"The db subnet group name"
value
=
"
${module
.
db
.
this_db_subnet_group_id
}
"
}
output
"this_db_subnet_group_arn"
{
description
=
"The ARN of the db subnet group"
value
=
"
${module
.
db
.
this_db_subnet_group_arn
}
"
}
# DB parameter group
output
"this_db_parameter_group_id"
{
description
=
"The db parameter group id"
value
=
"
${module
.
db
.
this_db_parameter_group_id
}
"
}
output
"this_db_parameter_group_arn"
{
description
=
"The ARN of the db parameter group"
value
=
"
${module
.
db
.
this_db_parameter_group_arn
}
"
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment