Skip to content

Commit 237e8e2

Browse files
authored
Fix terraform validate test (#11)
* Adds prerequisites to README * Fixes validate.bats issue with "region" error for modules. This is the same issue as cloudposse/build-harness#208. Without a default region, `terraform validate` fails when running against independent modules as they do not have a provider/region supplied. * Fixes validate.bats unsetting the wrong environment var I believe this was just a mistake but I may be wrong. setup() sets TF_CLI_ARGS_init, but teardown unsets TF_CLI_ARGS_plan. That seemed like a small typo to me, so I figured I would include this.
1 parent 476eb96 commit 237e8e2

File tree

3 files changed

+107
-43
lines changed

3 files changed

+107
-43
lines changed

README.md

Lines changed: 99 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,43 @@
1-
<!-- This file was automatically generated by the `build-harness`. Make all changes to `README.yaml` and run `make readme` to rebuild this file. -->
1+
<!--
2+
3+
4+
5+
6+
7+
8+
9+
10+
11+
12+
13+
14+
15+
16+
** DO NOT EDIT THIS FILE
17+
**
18+
** This file was automatically generated by the `build-harness`.
19+
** 1) Make all changes to `README.yaml`
20+
** 2) Run `make init` (you only need to do this once)
21+
** 3) Run`make readme` to rebuild this file.
22+
**
23+
** (We maintain HUNDREDS of open source projects. This is how we maintain our sanity.)
24+
**
25+
26+
27+
28+
29+
30+
31+
32+
33+
34+
35+
36+
37+
38+
39+
40+
-->
241
[![README Header][readme_header_img]][readme_header_link]
342

443
[![Cloud Posse][logo]](https://cpco.io/homepage)
@@ -8,6 +47,12 @@
847

948
Collection of Makefiles and test scripts to facilitate testing Terraform modules, Kubernetes resources, Helm charts, and more.
1049

50+
## Prerequisites
51+
52+
1. [Bats-core](https://github.com/bats-core/bats-core)
53+
1. Bash v5+
54+
- If you're on Mac, you're possibly running Bash v3. You can upgrade via homebrew: `brew install bash`
55+
1156

1257
---
1358

@@ -83,38 +128,51 @@ For additional context, refer to some of these links.
83128

84129
## Help
85130

86-
**Got a question?**
131+
**Got a question?** We got answers.
87132

88133
File a GitHub [issue](https://github.com/cloudposse/test-harness/issues), send us an [email][email] or join our [Slack Community][slack].
89134

90135
[![README Commercial Support][readme_commercial_support_img]][readme_commercial_support_link]
91136

92-
## Commercial Support
93-
94-
Work directly with our team of DevOps experts via email, slack, and video conferencing.
137+
## DevOps Accelerator for Startups
95138

96-
We provide [*commercial support*][commercial_support] for all of our [Open Source][github] projects. As a *Dedicated Support* customer, you have access to our team of subject matter experts at a fraction of the cost of a full-time engineer.
97139

98-
[![E-Mail](https://img.shields.io/badge/[email protected])][email]
140+
We are a [**DevOps Accelerator**][commercial_support]. We'll help you build your cloud infrastructure from the ground up so you can own it. Then we'll show you how to operate it and stick around for as long as you need us.
99141

100-
- **Questions.** We'll use a Shared Slack channel between your team and ours.
101-
- **Troubleshooting.** We'll help you triage why things aren't working.
102-
- **Code Reviews.** We'll review your Pull Requests and provide constructive feedback.
103-
- **Bug Fixes.** We'll rapidly work to fix any bugs in our projects.
104-
- **Build New Terraform Modules.** We'll [develop original modules][module_development] to provision infrastructure.
105-
- **Cloud Architecture.** We'll assist with your cloud strategy and design.
106-
- **Implementation.** We'll provide hands-on support to implement our reference architectures.
142+
[![Learn More](https://img.shields.io/badge/learn%20more-success.svg?style=for-the-badge)][commercial_support]
107143

144+
Work directly with our team of DevOps experts via email, slack, and video conferencing.
108145

146+
We deliver 10x the value for a fraction of the cost of a full-time engineer. Our track record is not even funny. If you want things done right and you need it done FAST, then we're your best bet.
109147

148+
- **Reference Architecture.** You'll get everything you need from the ground up built using 100% infrastructure as code.
149+
- **Release Engineering.** You'll have end-to-end CI/CD with unlimited staging environments.
150+
- **Site Reliability Engineering.** You'll have total visibility into your apps and microservices.
151+
- **Security Baseline.** You'll have built-in governance with accountability and audit logs for all changes.
152+
- **GitOps.** You'll be able to operate your infrastructure via Pull Requests.
153+
- **Training.** You'll receive hands-on training so your team can operate what we build.
154+
- **Questions.** You'll have a direct line of communication between our teams via a Shared Slack channel.
155+
- **Troubleshooting.** You'll get help to triage when things aren't working.
156+
- **Code Reviews.** You'll receive constructive feedback on Pull Requests.
157+
- **Bug Fixes.** We'll rapidly work with you to fix any bugs in our projects.
110158

111159
## Slack Community
112160

113161
Join our [Open Source Community][slack] on Slack. It's **FREE** for everyone! Our "SweetOps" community is where you get to talk with others who share a similar vision for how to rollout and manage infrastructure. This is the best place to talk shop, ask questions, solicit feedback, and work together as a community to build totally *sweet* infrastructure.
114162

163+
## Discourse Forums
164+
165+
Participate in our [Discourse Forums][discourse]. Here you'll find answers to commonly asked questions. Most questions will be related to the enormous number of projects we support on our GitHub. Come here to collaborate on answers, find solutions, and get ideas about the products and services we value. It only takes a minute to get started! Just sign in with SSO using your GitHub account.
166+
115167
## Newsletter
116168

117-
Signup for [our newsletter][newsletter] that covers everything on our technology radar. Receive updates on what we're up to on GitHub as well as awesome new projects we discover.
169+
Sign up for [our newsletter][newsletter] that covers everything on our technology radar. Receive updates on what we're up to on GitHub as well as awesome new projects we discover.
170+
171+
## Office Hours
172+
173+
[Join us every Wednesday via Zoom][office_hours] for our weekly "Lunch & Learn" sessions. It's **FREE** for everyone!
174+
175+
[![zoom](https://img.cloudposse.com/fit-in/200x200/https://cloudposse.com/wp-content/uploads/2019/08/Powered-by-Zoom.png")][office_hours]
118176

119177
## Contributing
120178

@@ -139,7 +197,7 @@ In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow.
139197

140198
## Copyright
141199

142-
Copyright © 2017-2019 [Cloud Posse, LLC](https://cpco.io/copyright)
200+
Copyright © 2017-2020 [Cloud Posse, LLC](https://cpco.io/copyright)
143201

144202

145203

@@ -198,39 +256,38 @@ Check out [our other projects][github], [follow us on twitter][twitter], [apply
198256
|---|---|---|
199257

200258
[osterman_homepage]: https://github.com/osterman
201-
[osterman_avatar]: https://github.com/osterman.png?size=150
259+
[osterman_avatar]: https://img.cloudposse.com/150x150/https://github.com/osterman.png
202260
[aknysh_homepage]: https://github.com/aknysh
203-
[aknysh_avatar]: https://github.com/aknysh.png?size=150
261+
[aknysh_avatar]: https://img.cloudposse.com/150x150/https://github.com/aknysh.png
204262
[goruha_homepage]: https://github.com/goruha
205-
[goruha_avatar]: https://github.com/goruha.png?size=150
206-
207-
263+
[goruha_avatar]: https://img.cloudposse.com/150x150/https://github.com/goruha.png
208264

209265
[![README Footer][readme_footer_img]][readme_footer_link]
210266
[![Beacon][beacon]][website]
211267

212268
[logo]: https://cloudposse.com/logo-300x69.svg
213-
[docs]: https://cpco.io/docs
214-
[website]: https://cpco.io/homepage
215-
[github]: https://cpco.io/github
216-
[jobs]: https://cpco.io/jobs
217-
[hire]: https://cpco.io/hire
218-
[slack]: https://cpco.io/slack
219-
[linkedin]: https://cpco.io/linkedin
220-
[twitter]: https://cpco.io/twitter
221-
[testimonial]: https://cpco.io/leave-testimonial
222-
[newsletter]: https://cpco.io/newsletter
223-
[email]: https://cpco.io/email
224-
[commercial_support]: https://cpco.io/commercial-support
225-
[we_love_open_source]: https://cpco.io/we-love-open-source
226-
[module_development]: https://cpco.io/module-development
227-
[terraform_modules]: https://cpco.io/terraform-modules
228-
[readme_header_img]: https://cloudposse.com/readme/header/img?repo=cloudposse/test-harness
229-
[readme_header_link]: https://cloudposse.com/readme/header/link?repo=cloudposse/test-harness
230-
[readme_footer_img]: https://cloudposse.com/readme/footer/img?repo=cloudposse/test-harness
231-
[readme_footer_link]: https://cloudposse.com/readme/footer/link?repo=cloudposse/test-harness
232-
[readme_commercial_support_img]: https://cloudposse.com/readme/commercial-support/img?repo=cloudposse/test-harness
233-
[readme_commercial_support_link]: https://cloudposse.com/readme/commercial-support/link?repo=cloudposse/test-harness
269+
[docs]: https://cpco.io/docs?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/test-harness&utm_content=docs
270+
[website]: https://cpco.io/homepage?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/test-harness&utm_content=website
271+
[github]: https://cpco.io/github?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/test-harness&utm_content=github
272+
[jobs]: https://cpco.io/jobs?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/test-harness&utm_content=jobs
273+
[hire]: https://cpco.io/hire?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/test-harness&utm_content=hire
274+
[slack]: https://cpco.io/slack?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/test-harness&utm_content=slack
275+
[linkedin]: https://cpco.io/linkedin?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/test-harness&utm_content=linkedin
276+
[twitter]: https://cpco.io/twitter?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/test-harness&utm_content=twitter
277+
[testimonial]: https://cpco.io/leave-testimonial?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/test-harness&utm_content=testimonial
278+
[office_hours]: https://cloudposse.com/office-hours?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/test-harness&utm_content=office_hours
279+
[newsletter]: https://cpco.io/newsletter?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/test-harness&utm_content=newsletter
280+
[discourse]: https://ask.sweetops.com/?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/test-harness&utm_content=discourse
281+
[email]: https://cpco.io/email?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/test-harness&utm_content=email
282+
[commercial_support]: https://cpco.io/commercial-support?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/test-harness&utm_content=commercial_support
283+
[we_love_open_source]: https://cpco.io/we-love-open-source?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/test-harness&utm_content=we_love_open_source
284+
[terraform_modules]: https://cpco.io/terraform-modules?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/test-harness&utm_content=terraform_modules
285+
[readme_header_img]: https://cloudposse.com/readme/header/img
286+
[readme_header_link]: https://cloudposse.com/readme/header/link?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/test-harness&utm_content=readme_header_link
287+
[readme_footer_img]: https://cloudposse.com/readme/footer/img
288+
[readme_footer_link]: https://cloudposse.com/readme/footer/link?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/test-harness&utm_content=readme_footer_link
289+
[readme_commercial_support_img]: https://cloudposse.com/readme/commercial-support/img
290+
[readme_commercial_support_link]: https://cloudposse.com/readme/commercial-support/link?utm_source=github&utm_medium=readme&utm_campaign=cloudposse/test-harness&utm_content=readme_commercial_support_link
234291
[share_twitter]: https://twitter.com/intent/tweet/?text=test-harness&url=https://github.com/cloudposse/test-harness
235292
[share_linkedin]: https://www.linkedin.com/shareArticle?mini=true&title=test-harness&url=https://github.com/cloudposse/test-harness
236293
[share_reddit]: https://reddit.com/submit/?url=https://github.com/cloudposse/test-harness

README.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@ references:
3737
description: |-
3838
Collection of Makefiles and test scripts to facilitate testing Terraform modules, Kubernetes resources, Helm charts, and more.
3939
40+
## Prerequisites
41+
42+
1. [Bats-core](https://github.com/bats-core/bats-core)
43+
1. Bash v5+
44+
- If you're on Mac, you're possibly running Bash v3. You can upgrade via homebrew: `brew install bash`
4045
4146
# How to use this project
4247
usage: |-

test/terraform/validate.bats

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ function setup() {
99

1010
function teardown() {
1111
clean
12-
unset TF_CLI_ARGS_plan
12+
unset TF_CLI_ARGS_init
13+
unset AWS_DEFAULT_REGION
1314
}
1415

1516
@test "check if terraform code is valid" {
1617
skip_unless_terraform
1718
if [[ "`terraform version | head -1`" =~ 0\.12 ]]; then
19+
export AWS_DEFAULT_REGION="us-west-2"
1820
run terraform validate .
1921
[ $status -eq 0 ]
2022
else

0 commit comments

Comments
 (0)