-
-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create policy document even if there is no principal to attach it to (#…
…30)
- Loading branch information
Showing
15 changed files
with
180 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,9 +5,6 @@ | |
*.tfstate | ||
*.tfstate.* | ||
|
||
# .tfvars files | ||
*.tfvars | ||
|
||
**/.idea | ||
**/*.iml | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
version: '1.0' | ||
|
||
stages: | ||
- Prepare | ||
- Test | ||
|
||
steps: | ||
wait: | ||
title: Wait | ||
stage: Prepare | ||
image: codefresh/cli:latest | ||
commands: | ||
- codefresh get builds --pipeline=${{CF_REPO_NAME}} --status running --limit 1000 -o json | jq --arg id ${{CF_BUILD_ID}} -ser 'flatten|.[-1].id==$id' | ||
retry: | ||
maxAttempts: 10 | ||
delay: 20 | ||
exponentialFactor: 1.1 | ||
|
||
main_clone: | ||
title: "Clone repository" | ||
type: git-clone | ||
stage: Prepare | ||
description: "Initialize" | ||
repo: ${{CF_REPO_OWNER}}/${{CF_REPO_NAME}} | ||
git: CF-default | ||
revision: ${{CF_REVISION}} | ||
|
||
clean_init: | ||
title: Prepare build-harness and test-harness | ||
image: ${{TEST_IMAGE}} | ||
stage: Prepare | ||
commands: | ||
- cf_export PATH="/usr/local/terraform/0.11/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" | ||
- which terraform | ||
- terraform version | ||
- make init | ||
- git -C build-harness checkout master | ||
- make -C test/ clean init TEST_HARNESS_BRANCH=master | ||
- find . -type d -name '.terraform' | xargs rm -rf | ||
- find . -type f -name 'terraform.tfstate*' -exec rm -f {} \; | ||
|
||
test: | ||
type: "parallel" | ||
title: "Run tests" | ||
description: "Run all tests in parallel" | ||
stage: Test | ||
steps: | ||
test_readme_lint: | ||
title: "Test README.md updated" | ||
stage: "Test" | ||
image: ${{TEST_IMAGE}} | ||
description: Test "readme/lint" | ||
commands: | ||
- make readme/lint | ||
|
||
test_module: | ||
title: Test module with bats | ||
image: ${{TEST_IMAGE}} | ||
stage: Test | ||
commands: | ||
- make -C test/ module | ||
|
||
test_examples_complete: | ||
title: Test "examples/complete" with bats | ||
image: ${{TEST_IMAGE}} | ||
stage: Test | ||
commands: | ||
- make -C test/ examples/complete |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
region = "us-west-1" | ||
|
||
namespace = "eg" | ||
|
||
stage = "test" | ||
|
||
name = "ecr-test" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
provider "aws" { | ||
region = "${var.region}" | ||
} | ||
|
||
module "ecr" { | ||
source = "../../" | ||
namespace = "${var.namespace}" | ||
stage = "${var.stage}" | ||
name = "${var.name}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
output "registry_id" { | ||
value = "${module.ecr.registry_id}" | ||
description = "Registry ID" | ||
} | ||
|
||
output "registry_url" { | ||
value = "${module.ecr.registry_url}" | ||
description = "Registry URL" | ||
} | ||
|
||
output "repository_name" { | ||
value = "${module.ecr.repository_name}" | ||
description = "Registry name" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
variable "region" { | ||
type = "string" | ||
} | ||
|
||
variable "namespace" { | ||
type = "string" | ||
} | ||
|
||
variable "name" { | ||
type = "string" | ||
} | ||
|
||
variable "stage" { | ||
type = "string" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.test-harness |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
TEST_HARNESS ?= https://github.com/cloudposse/test-harness.git | ||
TEST_HARNESS_BRANCH ?= master | ||
TEST_HARNESS_PATH = $(realpath .test-harness) | ||
BATS_ARGS ?= --tap | ||
BATS_LOG ?= test.log | ||
|
||
# Define a macro to run the tests | ||
define RUN_TESTS | ||
@echo "Running tests in $(1)" | ||
@cd $(1) && bats $(BATS_ARGS) $(addsuffix .bats,$(addprefix $(TEST_HARNESS_PATH)/test/terraform/,$(TESTS))) | ||
endef | ||
|
||
default: all | ||
|
||
-include Makefile.* | ||
|
||
## Provision the test-harnesss | ||
.test-harness: | ||
[ -d $@ ] || git clone --depth=1 -b $(TEST_HARNESS_BRANCH) $(TEST_HARNESS) $@ | ||
|
||
## Initialize the tests | ||
init: .test-harness | ||
|
||
## Install all dependencies (OS specific) | ||
deps:: | ||
@exit 0 | ||
|
||
## Clean up the test harness | ||
clean: | ||
[ "$(TEST_HARNESS_PATH)" == "/" ] || rm -rf $(TEST_HARNESS_PATH) | ||
|
||
## Run all tests | ||
all: module examples/complete | ||
|
||
## Run basic sanity checks against the module itself | ||
module: export TESTS ?= installed lint get-modules module-pinning get-plugins validate terraform-docs input-descriptions output-descriptions | ||
module: deps | ||
$(call RUN_TESTS, ../) | ||
|
||
## Run tests against example | ||
examples/complete: export TESTS ?= installed lint get-modules get-plugins validate | ||
examples/complete: deps | ||
$(call RUN_TESTS, ../$@) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
ifneq (,$(wildcard /sbin/apk)) | ||
## Install all dependencies for alpine | ||
deps:: init | ||
@apk add --update terraform-docs@cloudposse json2hcl@cloudposse | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
terraform { | ||
required_version = "~> 0.11.0" | ||
} |