Skip to content

Commit 7c91316

Browse files
authored
Merge pull request #3 from leandevops/develop
Develop
2 parents 747936e + d8c5278 commit 7c91316

File tree

12 files changed

+58
-197
lines changed

12 files changed

+58
-197
lines changed

.circleci/config.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ jobs:
1010
- checkout
1111
- run:
1212
name: Terraform init
13-
command: |
14-
cd module
15-
terraform init -input=false
13+
command: make init
1614

1715
terraform-validate:
1816
<<: *docker
@@ -67,7 +65,7 @@ jobs:
6765

6866
- run:
6967
name: Run kitchen test
70-
command: bundle exec kitchen test
68+
command: make
7169

7270
workflows:
7371
version: 2

.gitignore

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
.kitchen/
21
.terraform/
3-
terraform.tfstate.d/
4-
test/fixtures/tf_module/function/*.zip
5-
out.terraform
62
terraform.tfstate
7-
terraform.tfstate.backup
3+
terraform.tfstate.backup
4+
.terraform.tfstate.lock.info
5+
*.zip

.kitchen.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

Gemfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
source 'https://rubygems.org/' do
22
gem 'awspec'
3-
gem 'kitchen-terraform'
4-
gem 'kitchen-verifier-awspec'
53
gem 'hcl-checker'
64
end

Gemfile.lock

Lines changed: 0 additions & 148 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4-
addressable (2.6.0)
5-
public_suffix (>= 2.0.2, < 4.0)
64
aws-eventstream (1.0.2)
75
aws-partitions (1.144.0)
86
aws-sdk (3.0.1)
@@ -717,115 +715,11 @@ GEM
717715
rspec-its
718716
term-ansicolor
719717
thor
720-
builder (3.2.3)
721-
coderay (1.1.2)
722-
concurrent-ruby (1.1.5)
723718
diff-lcs (1.3)
724-
docker-api (1.34.2)
725-
excon (>= 0.47.0)
726-
multi_json
727-
dry-configurable (0.8.2)
728-
concurrent-ruby (~> 1.0)
729-
dry-core (~> 0.4, >= 0.4.7)
730-
dry-container (0.7.0)
731-
concurrent-ruby (~> 1.0)
732-
dry-configurable (~> 0.1, >= 0.1.3)
733-
dry-core (0.4.7)
734-
concurrent-ruby (~> 1.0)
735-
dry-equalizer (0.2.2)
736719
dry-inflector (0.1.2)
737-
dry-logic (0.5.0)
738-
dry-container (~> 0.2, >= 0.2.6)
739-
dry-core (~> 0.2)
740-
dry-equalizer (~> 0.2)
741-
dry-types (0.14.0)
742-
concurrent-ruby (~> 1.0)
743-
dry-container (~> 0.3)
744-
dry-core (~> 0.4, >= 0.4.4)
745-
dry-equalizer (~> 0.2)
746-
dry-inflector (~> 0.1, >= 0.1.2)
747-
dry-logic (~> 0.5, >= 0.5)
748-
dry-validation (0.13.0)
749-
concurrent-ruby (~> 1.0)
750-
dry-configurable (~> 0.1, >= 0.1.3)
751-
dry-core (~> 0.2, >= 0.2.1)
752-
dry-equalizer (~> 0.2)
753-
dry-logic (~> 0.5, >= 0.5.0)
754-
dry-types (~> 0.14, >= 0.14)
755-
erubis (2.7.0)
756-
excon (0.62.0)
757-
faraday (0.15.4)
758-
multipart-post (>= 1.2, < 3)
759-
ffi (1.10.0)
760-
gssapi (1.2.0)
761-
ffi (>= 1.0.1)
762-
gyoku (1.3.1)
763-
builder (>= 2.1.2)
764-
hashie (3.6.0)
765720
hcl-checker (1.1.1)
766-
htmlentities (4.3.4)
767-
httpclient (2.8.3)
768-
inspec (1.51.25)
769-
addressable (~> 2.4)
770-
faraday (>= 0.9.0)
771-
hashie (~> 3.4)
772-
htmlentities
773-
json (>= 1.8, < 3.0)
774-
method_source (~> 0.8)
775-
mixlib-log
776-
parallel (~> 1.9)
777-
parslet (~> 1.5)
778-
pry (~> 0)
779-
rspec (~> 3)
780-
rspec-its (~> 1.2)
781-
rubyzip (~> 1.1)
782-
semverse
783-
sslshake (~> 1.2)
784-
thor (~> 0.19)
785-
tomlrb (~> 1.2)
786-
train (~> 0.32)
787721
ipaddress (0.8.3)
788722
jmespath (1.4.0)
789-
json (2.2.0)
790-
kitchen-inspec (0.26.0)
791-
hashie (~> 3.4)
792-
inspec (>= 0.34.0, < 4.0.0)
793-
test-kitchen (~> 1.6)
794-
kitchen-terraform (3.3.1)
795-
dry-types (~> 0.9)
796-
dry-validation (~> 0.10)
797-
kitchen-inspec (~> 0.18)
798-
mixlib-shellout (~> 2.2)
799-
test-kitchen (~> 1.16)
800-
kitchen-verifier-awspec (0.1.2)
801-
net-ssh (>= 3)
802-
test-kitchen (~> 1.4)
803-
little-plugger (1.1.4)
804-
logging (2.2.2)
805-
little-plugger (~> 1.1)
806-
multi_json (~> 1.10)
807-
method_source (0.9.2)
808-
mixlib-install (3.11.11)
809-
mixlib-shellout
810-
mixlib-versioning
811-
thor
812-
mixlib-log (3.0.1)
813-
mixlib-shellout (2.4.4)
814-
mixlib-versioning (1.2.7)
815-
multi_json (1.13.1)
816-
multipart-post (2.0.0)
817-
net-scp (1.2.1)
818-
net-ssh (>= 2.6.5)
819-
net-ssh (4.2.0)
820-
net-ssh-gateway (1.3.0)
821-
net-ssh (>= 2.6.5)
822-
nori (2.6.0)
823-
parallel (1.14.0)
824-
parslet (1.8.2)
825-
pry (0.12.2)
826-
coderay (~> 1.1.0)
827-
method_source (~> 0.9.0)
828-
public_suffix (3.0.3)
829723
rspec (3.8.0)
830724
rspec-core (~> 3.8.0)
831725
rspec-expectations (~> 3.8.0)
@@ -842,59 +736,17 @@ GEM
842736
diff-lcs (>= 1.2.0, < 2.0)
843737
rspec-support (~> 3.8.0)
844738
rspec-support (3.8.0)
845-
rubyntlm (0.6.2)
846-
rubyzip (1.2.2)
847-
semverse (3.0.0)
848-
sslshake (1.3.0)
849739
term-ansicolor (1.7.1)
850740
tins (~> 1.0)
851-
test-kitchen (1.24.0)
852-
mixlib-install (~> 3.6)
853-
mixlib-shellout (>= 1.2, < 3.0)
854-
net-scp (~> 1.1)
855-
net-ssh (>= 2.9, < 5.0)
856-
net-ssh-gateway (~> 1.2)
857-
thor (~> 0.19)
858-
winrm (~> 2.0)
859-
winrm-elevated (~> 1.0)
860-
winrm-fs (~> 1.1)
861741
thor (0.20.3)
862742
tins (1.20.2)
863-
tomlrb (1.2.8)
864-
train (0.32.0)
865-
docker-api (~> 1.26)
866-
json (>= 1.8, < 3.0)
867-
mixlib-shellout (~> 2.0)
868-
net-scp (~> 1.2)
869-
net-ssh (>= 2.9, < 5.0)
870-
winrm (~> 2.0)
871-
winrm-fs (~> 1.0)
872-
winrm (2.3.1)
873-
builder (>= 2.1.2)
874-
erubis (~> 2.7)
875-
gssapi (~> 1.2)
876-
gyoku (~> 1.0)
877-
httpclient (~> 2.2, >= 2.2.0.2)
878-
logging (>= 1.6.1, < 3.0)
879-
nori (~> 2.0)
880-
rubyntlm (~> 0.6.0, >= 0.6.1)
881-
winrm-elevated (1.1.1)
882-
winrm (~> 2.0)
883-
winrm-fs (~> 1.0)
884-
winrm-fs (1.3.2)
885-
erubis (~> 2.7)
886-
logging (>= 1.6.1, < 3.0)
887-
rubyzip (~> 1.1)
888-
winrm (~> 2.0)
889743

890744
PLATFORMS
891745
ruby
892746

893747
DEPENDENCIES
894748
awspec!
895749
hcl-checker!
896-
kitchen-terraform!
897-
kitchen-verifier-awspec!
898750

899751
BUNDLED WITH
900752
2.0.1

Makefile

Lines changed: 51 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,74 @@ RED = \033[0;31m
44
NC = \033[0m
55

66
# run all
7-
all: build plan apply
7+
all: init validate plan apply run-tests destroy
88
@echo "$(GREEN)✓ 'make all' has completed $(NC)\n"
99

1010
# initial terraform setup
1111
init: ; @echo "$(GREEN)✓ Initializing terraform $(NC)\n"
12-
@cd test/fixtures/tf_module/ && terraform get && terraform init
12+
@terraform init -input=false -lock=true \
13+
-upgrade -force-copy -backend=true -get=true \
14+
-get-plugins=true -verify-plugins=true \
15+
tests/fixtures/tf_module
1316
@$(MAKE) -s post-action
1417

15-
# building a function
16-
build: ; @echo "$(GREEN)✓ Building a function $(NC)\n"
17-
@cd test/fixtures/tf_module/function && zip function.zip *.py
18+
update: ; @echo "$(GREEN)✓ Updating terraform $(NC)\n"
19+
@terraform get -update tests/fixtures/tf_module
20+
@$(MAKE) -s post-action
21+
22+
validate: ; @echo "$(GREEN)✓ Updating terraform $(NC)\n"
23+
@terraform validate -check-variables=true \
24+
-var-file=tests/fixtures/tf_module/testing.tfvars \
25+
tests/fixtures/tf_module
1826
@$(MAKE) -s post-action
1927

20-
# plan terraform
28+
# terraform plan
2129
plan: ; @echo "$(GREEN)✓ Planning terraform $(NC)\n"
22-
@cd test/fixtures/tf_module/ && terraform plan -var-file=testing.tfvars --out out.terraform
30+
@terraform plan -lock=true -input=false \
31+
-parallelism=4 -refresh=true \
32+
-var-file=tests/fixtures/tf_module/testing.tfvars \
33+
tests/fixtures/tf_module
2334
@$(MAKE) -s post-action
2435

2536
# apply terraform
2637
apply: ; @echo "$(GREEN)✓ Applying terraform $(NC)\n"
27-
@cd test/fixtures/tf_module/ && terraform apply out.terraform
38+
@terraform apply -lock=true -input=false \
39+
-auto-approve=true -parallelism=4 -refresh=true \
40+
-var-file=tests/fixtures/tf_module/testing.tfvars \
41+
tests/fixtures/tf_module
42+
@$(MAKE) -s post-action
43+
44+
run-tests: ; @echo "$(GREEN)✓ Running rspec tests $(NC)\n"
45+
@bundle exec rspec -c -f doc --default-path '.' -P 'tests/scenarios/test_module.rb'
46+
@$(MAKE) -s post-action
47+
48+
# building a function
49+
build: ; @echo "$(GREEN)✓ Building a function $(NC)\n"
50+
@cd tests/fixtures/tf_module/function && zip function.zip *.py
2851
@$(MAKE) -s post-action
2952

30-
# destroy all resources and amivar.tf file
53+
# destroy all resources
3154
destroy: ; @echo "$(RED)✓ Destroying terraform resources $(NC)\n"
32-
@cd test/fixtures/tf_module/ && terraform destroy -force -var-file=testing.tfvars
55+
@terraform destroy -force -input=false -parallelism=4 -refresh=true \
56+
-var-file=tests/fixtures/tf_module/testing.tfvars \
57+
tests/fixtures/tf_module
58+
@rm terraform.tfstate*
59+
@$(MAKE) -s post-action
60+
61+
clean: ; @echo "$(RED)✓ Cleaning directory $(NC)\n"
62+
@rm -rf test/fixtures/tf_module/.terraform
63+
@rm -f terraform.tfstate*
64+
@rm -f test/fixtures/tf_module/function/function.zip
65+
@$(MAKE) -s post-action
66+
67+
tflint: ; @echo "$(RED)✓ Running tflint $(NC)\n"
68+
@cd module && tflint
69+
@$(MAKE) -s post-action
70+
71+
deps: ; @echo "$(RED)✓ Installing dependencies $(NC)\n"
72+
@gem install bundler
73+
@bundle check || bundle install
3374
@$(MAKE) -s post-action
34-
.PHONY: destroy
3575

36-
# run post actions
3776
post-action: ; @echo "$(BLUE)✓ Done. $(NC)\n"
3877
.PHONY: post-action
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)