Skip to content

Commit 8c35873

Browse files
authored
Use splat + join syntax for outputs from resources with counts (#11)
1 parent d4ec0a3 commit 8c35873

7 files changed

Lines changed: 131 additions & 15 deletions

File tree

.travis.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
addons:
2+
apt:
3+
packages:
4+
- git
5+
- make
6+
- curl
7+
8+
install:
9+
- make init
10+
11+
script:
12+
- make terraform/install
13+
- make terraform/get-plugins
14+
- make terraform/get-modules
15+
- make terraform/lint
16+
- make terraform/validate

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright 2017 Cloud Posse, LLC
189+
Copyright 2017-2018 Cloud Posse, LLC
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
SHELL := /bin/bash
2+
3+
-include $(shell curl -sSL -o .build-harness "https://git.io/build-harness"; echo .build-harness)
4+
5+
lint:
6+
$(SELF) terraform/install terraform/get-modules terraform/get-plugins terraform/lint terraform/validate

README.md

Lines changed: 85 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
# terraform-aws-rds
1+
# terraform-aws-rds [![Build Status](https://travis-ci.org/cloudposse/terraform-aws-rds.svg?branch=master)](https://travis-ci.org/cloudposse/terraform-aws-rds)
22

33
Terraform module to provision AWS [`RDS`](https://aws.amazon.com/rds/) instances
44

55

66
The module will create:
7+
78
* DB instance (MySQL, Postgres, SQL Server, Oracle)
89
* DB Parameter Group
910
* DB Subnet Group
1011
* DB Security Group
1112
* DNS Record in Route53 for the DB endpoint
1213

1314

14-
15-
## Input Variables
15+
## Inputs
1616

1717
- `stage` - The deployment stage (_e.g._ `prod`, `staging`, `dev`)
1818
- `namespace` - The namespace of the application the DB instance belongs to (_e.g._ `global`, `shared`, or the name of your company like `cloudposse`)
@@ -49,6 +49,7 @@ The module will create:
4949
- `final_snapshot_identifier` - Specifies whether or not to create a final snapshot for this database when destroing. This option **must** be set if `skip_final_snapshot` = `false`. E.g.: `"dbname-final-snapshot-${md5(timestamp())}"`
5050
- `parameter_group_name` - (Optional) Name of the DB parameter group to associate (e.g. `mysql-5-6`)
5151

52+
5253
## Outputs
5354

5455
- `instance_id` - ID of the instance
@@ -60,15 +61,13 @@ The module will create:
6061
- `hostname` - DNS host name of the instance
6162

6263

63-
6464
## Usage
6565

66-
6766
```hcl
6867
module "rds_instance" {
6968
source = "git::https://github.com/cloudposse/terraform-aws-rds.git?ref=master"
69+
namespace = "cp"
7070
stage = "prod"
71-
namespace = "cloudposse"
7271
name = "app"
7372
dns_zone_id = "Z89FN1IW975KPE"
7473
host_name = "db"
@@ -107,6 +106,85 @@ module "rds_instance" {
107106
```
108107

109108

109+
## Help
110+
111+
**Got a question?**
112+
113+
File a GitHub [issue](https://github.com/cloudposse/terraform-aws-rds/issues), send us an [email](mailto:hello@cloudposse.com) or reach out to us on [Gitter](https://gitter.im/cloudposse/).
114+
115+
116+
## Contributing
117+
118+
### Bug Reports & Feature Requests
119+
120+
Please use the [issue tracker](https://github.com/cloudposse/terraform-aws-rds/issues) to report any bugs or file feature requests.
121+
122+
### Developing
123+
124+
If you are interested in being a contributor and want to get involved in developing `terraform-aws-rds`, we would love to hear from you! Shoot us an [email](mailto:hello@cloudposse.com).
125+
126+
In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow.
127+
128+
1. **Fork** the repo on GitHub
129+
2. **Clone** the project to your own machine
130+
3. **Commit** changes to your own branch
131+
4. **Push** your work back up to your fork
132+
5. Submit a **Pull request** so that we can review your changes
133+
134+
**NOTE:** Be sure to merge the latest from "upstream" before making a pull request!
135+
136+
110137
## License
111138

112-
Apache 2 License. See [`LICENSE`](LICENSE) for full details.
139+
[APACHE 2.0](LICENSE) © 2018 [Cloud Posse, LLC](https://cloudposse.com)
140+
141+
See [LICENSE](LICENSE) for full details.
142+
143+
Licensed to the Apache Software Foundation (ASF) under one
144+
or more contributor license agreements. See the NOTICE file
145+
distributed with this work for additional information
146+
regarding copyright ownership. The ASF licenses this file
147+
to you under the Apache License, Version 2.0 (the
148+
"License"); you may not use this file except in compliance
149+
with the License. You may obtain a copy of the License at
150+
151+
http://www.apache.org/licenses/LICENSE-2.0
152+
153+
Unless required by applicable law or agreed to in writing,
154+
software distributed under the License is distributed on an
155+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
156+
KIND, either express or implied. See the License for the
157+
specific language governing permissions and limitations
158+
under the License.
159+
160+
161+
## About
162+
163+
`terraform-aws-rds` is maintained and funded by [Cloud Posse, LLC][website].
164+
165+
![Cloud Posse](https://cloudposse.com/logo-300x69.png)
166+
167+
168+
Like it? Please let us know at <hello@cloudposse.com>
169+
170+
We love [Open Source Software](https://github.com/cloudposse/)!
171+
172+
See [our other projects][community]
173+
or [hire us][hire] to help build your next cloud platform.
174+
175+
[website]: https://cloudposse.com/
176+
[community]: https://github.com/cloudposse/
177+
[hire]: https://cloudposse.com/contact/
178+
179+
180+
## Contributors
181+
182+
| [![Erik Osterman][erik_img]][erik_web]<br/>[Erik Osterman][erik_web] | [![Andriy Knysh][andriy_img]][andriy_web]<br/>[Andriy Knysh][andriy_web] |[![Igor Rodionov][igor_img]][igor_web]<br/>[Igor Rodionov][igor_img]
183+
|-------------------------------------------------------|------------------------------------------------------------------|------------------------------------------------------------------|
184+
185+
[erik_img]: http://s.gravatar.com/avatar/88c480d4f73b813904e00a5695a454cb?s=144
186+
[erik_web]: https://github.com/osterman/
187+
[andriy_img]: https://avatars0.githubusercontent.com/u/7356997?v=4&u=ed9ce1c9151d552d985bdf5546772e14ef7ab617&s=144
188+
[andriy_web]: https://github.com/aknysh/
189+
[igor_img]: http://s.gravatar.com/avatar/bc70834d32ed4517568a1feb0b9be7e2?s=144
190+
[igor_web]: https://github.com/goruha/
Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module "rds_instance" {
2-
source = "git::https://github.com/cloudposse/tf_rds.git?ref=tags/0.1.0"
2+
source = "git::https://github.com/cloudposse/terraform-aws-rds.git?ref=master"
3+
namespace = "cp"
34
stage = "prod"
4-
namespace = "cloudposse"
55
name = "app"
66
dns_zone_id = "Z89FN1IW975KPE"
77
host_name = "db"
@@ -13,14 +13,16 @@ module "rds_instance" {
1313
multi_az = "true"
1414
storage_type = "gp2"
1515
allocated_storage = "100"
16-
storage_encrypted = "false"
16+
storage_encrypted = "true"
1717
engine = "mysql"
1818
engine_version = "5.7.17"
1919
instance_class = "db.t2.medium"
2020
db_parameter_group = "mysql5.6"
21+
parameter_group_name = "mysql-5-6"
2122
publicly_accessible = "false"
2223
subnet_ids = ["sb-xxxxxxxxx", "sb-xxxxxxxxx"]
2324
vpc_id = "vpc-xxxxxxxx"
25+
snapshot_identifier = "rds:production-2015-06-26-06-05"
2426
auto_minor_version_upgrade = "true"
2527
allow_major_version_upgrade = "false"
2628
apply_immediately = "false"
@@ -29,4 +31,17 @@ module "rds_instance" {
2931
copy_tags_to_snapshot = "true"
3032
backup_retention_period = 7
3133
backup_window = "22:00-03:00"
34+
35+
db_parameter = [
36+
{
37+
name = "myisam_sort_buffer_size"
38+
39+
value = "1048576"
40+
},
41+
{
42+
name = "sort_buffer_size"
43+
44+
value = "2097152"
45+
},
46+
]
3247
}

main.tf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module "label" {
2-
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.2.1"
2+
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.3.3"
33
namespace = "${var.namespace}"
44
name = "${var.name}"
55
stage = "${var.stage}"
@@ -9,12 +9,13 @@ module "label" {
99
}
1010

1111
module "final_snapshot_label" {
12-
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.2.1"
12+
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.3.3"
1313
namespace = "${var.namespace}"
1414
name = "${var.name}"
1515
stage = "${var.stage}"
1616
delimiter = "${var.delimiter}"
1717
attributes = ["${compact(concat(var.attributes, list("final", "snapshot")))}"]
18+
tags = "${var.tags}"
1819
}
1920

2021
resource "aws_db_instance" "default" {
@@ -85,7 +86,7 @@ resource "aws_security_group" "default" {
8586
}
8687

8788
module "dns_host_name" {
88-
source = "git::https://github.com/cloudposse/terraform-aws-route53-cluster-hostname.git?ref=tags/0.1.1"
89+
source = "git::https://github.com/cloudposse/terraform-aws-route53-cluster-hostname.git?ref=tags/0.2.2"
8990
namespace = "${var.namespace}"
9091
name = "${var.host_name}"
9192
stage = "${var.stage}"

outputs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ output "security_group_id" {
1919
}
2020

2121
output "parameter_group_id" {
22-
value = "${aws_db_parameter_group.default.id}"
22+
value = "${join("", aws_db_parameter_group.default.*.id)}"
2323
}
2424

2525
output "hostname" {

0 commit comments

Comments
 (0)