Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add examples #13

Merged
merged 4 commits into from Mar 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
102 changes: 84 additions & 18 deletions .README.md
@@ -1,31 +1,97 @@
## {{ (datasource "git").name }}
# {{ (datasource "git").name }} [![Build Status](https://travis-ci.org/cloudposse/{{ (datasource "git").name }}.svg?branch=master)](https://travis-ci.org/cloudposse/{{ (datasource "git").name }})

{{ (datasource "section").warning }}

Terraform module to provision an [`RDS Aurora`](https://aws.amazon.com/rds/aurora) Cluster
Terraform module to provision an [`RDS Aurora`](https://aws.amazon.com/rds/aurora) cluster for MySQL or Postgres.


## Usage

Include this repository as a module in your existing terraform code:
Basic [example](examples/basic)

```hcl
module "rds_cluster_aurora" {
source = "git::https://github.com/cloudposse/terraform-aws-rds-cluster.git?ref=master"
cluster_size = "2"
namespace = "app"
stage = "dev"
name = "db"
admin_user = "admin"
admin_password = "TestTest123"
db_name = "dbname"
instance_type = "db.t2.small"
vpc_id = "vpc-xxxxxxx"
availability_zones = ["us-east-1a", "us-east-1b"]
security_groups = ["sg-0a6d5a3a"]
subnets = ["subnet-8b03333", "subnet-8b0772a3"]
zone_id = "xxxxxxxx"
source = "git::https://github.com/cloudposse/terraform-aws-rds-cluster.git?ref=master"
engine = "aurora"
cluster_size = "2"
namespace = "cp"
stage = "dev"
name = "db"
admin_user = "admin"
admin_password = "Test123"
db_name = "dbname"
instance_type = "db.t2.small"
vpc_id = "vpc-xxxxxxx"
availability_zones = ["us-east-1a", "us-east-1b"]
security_groups = ["sg-0a6d5a3a"]
subnets = ["subnet-8b03333", "subnet-8b0772a3"]
zone_id = "xxxxxxxx"
}
```

With [cluster parameters](examples/with_cluster_parameters)

```hcl
module "rds_cluster_aurora" {
source = "../../"
engine = "aurora-postgresql"
cluster_size = "2"
namespace = "cp"
stage = "dev"
name = "db"
admin_user = "admin"
admin_password = "Test123"
db_name = "dbname"
instance_type = "db.t2.small"
vpc_id = "vpc-xxxxxxx"
availability_zones = ["us-east-1a", "us-east-1b"]
security_groups = ["sg-0a6d5a3a"]
subnets = ["subnet-8b03333", "subnet-8b0772a3"]
zone_id = "xxxxxxxx"

cluster_parameters = [
{
name = "character_set_client"
value = "utf8"
},
{
name = "character_set_connection"
value = "utf8"
},
{
name = "character_set_database"
value = "utf8"
},
{
name = "character_set_results"
value = "utf8"
},
{
name = "character_set_server"
value = "utf8"
},
{
name = "collation_connection"
value = "uft8_bin"
},
{
name = "collation_server"
value = "uft8_bin"
},
{
name = "lower_case_table_names"
value = "1"
apply_method = "pending-reboot"
},
{
name = "skip-character-set-client-handshake"
value = "1"
apply_method = "pending-reboot"
},
]
}
```

{{ (datasource "terraform").input }}

{{ (datasource "terraform").output }}
Expand All @@ -43,7 +109,7 @@ module "rds_cluster_aurora" {
|
{{- (datasource "contributor").erik }} |
{{- (datasource "contributor").igor }} |
{{- (datasource "contributor").andrew }} |
{{- (datasource "contributor").andriy }} |
{{- (datasource "contributor").sergey }} |
|---|---|---|---|

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -8,3 +8,4 @@
*.iml

.build-harness
build-harness
16 changes: 16 additions & 0 deletions .travis.yml
@@ -0,0 +1,16 @@
addons:
apt:
packages:
- git
- make
- curl

install:
- make init

script:
- make terraform/install
- make terraform/get-plugins
- make terraform/get-modules
- make terraform/lint
- make terraform/validate
2 changes: 1 addition & 1 deletion LICENSE
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2017 Cloud Posse, LLC
Copyright 2017-2018 Cloud Posse, LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
5 changes: 5 additions & 0 deletions Makefile
@@ -1 +1,6 @@
SHELL := /bin/bash

-include $(shell curl -sSL -o .build-harness "https://git.io/build-harness"; echo .build-harness)

lint:
$(SELF) terraform/install terraform/get-modules terraform/get-plugins terraform/lint terraform/validate
107 changes: 88 additions & 19 deletions README.md
@@ -1,41 +1,108 @@
## terraform-aws-rds-cluster
# terraform-aws-rds-cluster [![Build Status](https://travis-ci.org/cloudposse/terraform-aws-rds-cluster.svg?branch=master)](https://travis-ci.org/cloudposse/terraform-aws-rds-cluster)

<!---
--- This file was automatically generated by the `build-harness`
--- Make changes instead to `.README.md` and rebuild.
--->

Terraform module to provision an [`RDS Aurora`](https://aws.amazon.com/rds/aurora) Cluster
Terraform module to provision an [`RDS Aurora`](https://aws.amazon.com/rds/aurora) cluster for MySQL or Postgres.


## Usage

Include this repository as a module in your existing terraform code:
Basic [example](examples/basic)

```hcl
module "rds_cluster_aurora" {
source = "git::https://github.com/cloudposse/terraform-aws-rds-cluster.git?ref=master"
cluster_size = "2"
namespace = "app"
stage = "dev"
name = "db"
admin_user = "admin"
admin_password = "TestTest123"
db_name = "dbname"
instance_type = "db.t2.small"
vpc_id = "vpc-xxxxxxx"
availability_zones = ["us-east-1a", "us-east-1b"]
security_groups = ["sg-0a6d5a3a"]
subnets = ["subnet-8b03333", "subnet-8b0772a3"]
zone_id = "xxxxxxxx"
source = "git::https://github.com/cloudposse/terraform-aws-rds-cluster.git?ref=master"
engine = "aurora"
cluster_size = "2"
namespace = "cp"
stage = "dev"
name = "db"
admin_user = "admin"
admin_password = "Test123"
db_name = "dbname"
instance_type = "db.t2.small"
vpc_id = "vpc-xxxxxxx"
availability_zones = ["us-east-1a", "us-east-1b"]
security_groups = ["sg-0a6d5a3a"]
subnets = ["subnet-8b03333", "subnet-8b0772a3"]
zone_id = "xxxxxxxx"
}
```

With [cluster parameters](examples/with_cluster_parameters)

```hcl
module "rds_cluster_aurora" {
source = "../../"
engine = "aurora-postgresql"
cluster_size = "2"
namespace = "cp"
stage = "dev"
name = "db"
admin_user = "admin"
admin_password = "Test123"
db_name = "dbname"
instance_type = "db.t2.small"
vpc_id = "vpc-xxxxxxx"
availability_zones = ["us-east-1a", "us-east-1b"]
security_groups = ["sg-0a6d5a3a"]
subnets = ["subnet-8b03333", "subnet-8b0772a3"]
zone_id = "xxxxxxxx"

cluster_parameters = [
{
name = "character_set_client"
value = "utf8"
},
{
name = "character_set_connection"
value = "utf8"
},
{
name = "character_set_database"
value = "utf8"
},
{
name = "character_set_results"
value = "utf8"
},
{
name = "character_set_server"
value = "utf8"
},
{
name = "collation_connection"
value = "uft8_bin"
},
{
name = "collation_server"
value = "uft8_bin"
},
{
name = "lower_case_table_names"
value = "1"
apply_method = "pending-reboot"
},
{
name = "skip-character-set-client-handshake"
value = "1"
apply_method = "pending-reboot"
},
]
}
```

## Input

<!--------------------------------REQUIRE POSTPROCESSING-------------------------------->
| Name | Default | Description |
|:------|:---------:|:--------------:|
| admin_password |__REQUIRED__ |(Required unless a snapshot_identifier is provided) Password for the master DB user|
| admin_user |"admin" |(Required unless a snapshot_identifier is provided) Username for the master DB user|
| allowed_cidr_blocks |[] |List of CIDR blocks allowed to access|
| attributes |[] |Additional attributes (e.g. `policy` or `role`)|
| availability_zones |__REQUIRED__ |List of Availability Zones that instances in the DB cluster can be created in|
| backup_window |"07:00-09:00" |Daily time range during which the backups happen|
Expand All @@ -44,7 +111,9 @@ module "rds_cluster_aurora" {
| cluster_size |"2" |Number of DB instances to create in the cluster|
| db_name |__REQUIRED__ |Database name|
| db_port |"3306" |Database port|
| delimiter |"-" |Delimiter to be used between `name`, `namespace`, `stage`, etc.|
| delimiter |"-" |Delimiter to be used between `name`, `namespace`, `stage` and `attributes`|
| engine |"aurora" |The name of the database engine to be used for this DB cluster. Valid values: `aurora`, `aurora-postgresql`|
| engine_version |"" |The version number of the database engine to use|
| instance_type |"db.t2.small" |Instance type to use|
| maintenance_window |"wed:03:00-wed:04:00" |Weekly time range during which system maintenance can occur, in UTC|
| name |__REQUIRED__ |Name of the application|
Expand All @@ -54,7 +123,7 @@ module "rds_cluster_aurora" {
| snapshot_identifier |"" |Specifies whether or not to create this cluster from a snapshot|
| stage |__REQUIRED__ |Stage (e.g. `prod`, `dev`, `staging`)|
| subnets |__REQUIRED__ |List of VPC subnet IDs|
| tags |{} |Additional tags (e.g. `map('BusinessUnit`,`XYZ`)|
| tags |{} |Additional tags (e.g. map(`BusinessUnit`,`XYZ`)|
| vpc_id |__REQUIRED__ |VPC ID to create the cluster in (e.g. `vpc-a22222ee`)|
| zone_id |__REQUIRED__ |Route53 parent zone ID. The module will create sub-domain DNS records in the parent zone for the DB master and replicas|

Expand Down
17 changes: 17 additions & 0 deletions examples/basic/main.tf
@@ -0,0 +1,17 @@
module "rds_cluster_aurora" {
source = "../../"
engine = "aurora"
cluster_size = "2"
namespace = "cp"
stage = "dev"
name = "db"
admin_user = "admin"
admin_password = "Test123"
db_name = "dbname"
instance_type = "db.t2.small"
vpc_id = "vpc-xxxxxxx"
availability_zones = ["us-east-1a", "us-east-1b"]
security_groups = ["sg-0a6d5a3a"]
subnets = ["subnet-8b03333", "subnet-8b0772a3"]
zone_id = "xxxxxxxx"
}
58 changes: 58 additions & 0 deletions examples/with_cluster_parameters/main.tf
@@ -0,0 +1,58 @@
module "rds_cluster_aurora" {
source = "../../"
engine = "aurora-postgresql"
cluster_size = "2"
namespace = "cp"
stage = "dev"
name = "db"
admin_user = "admin"
admin_password = "Test123"
db_name = "dbname"
instance_type = "db.t2.small"
vpc_id = "vpc-xxxxxxx"
availability_zones = ["us-east-1a", "us-east-1b"]
security_groups = ["sg-0a6d5a3a"]
subnets = ["subnet-8b03333", "subnet-8b0772a3"]
zone_id = "xxxxxxxx"

cluster_parameters = [
{
name = "character_set_client"
value = "utf8"
},
{
name = "character_set_connection"
value = "utf8"
},
{
name = "character_set_database"
value = "utf8"
},
{
name = "character_set_results"
value = "utf8"
},
{
name = "character_set_server"
value = "utf8"
},
{
name = "collation_connection"
value = "uft8_bin"
},
{
name = "collation_server"
value = "uft8_bin"
},
{
name = "lower_case_table_names"
value = "1"
apply_method = "pending-reboot"
},
{
name = "skip-character-set-client-handshake"
value = "1"
apply_method = "pending-reboot"
},
]
}