Skip to content

Commit

Permalink
Pin ruby version to 2.7.5, upgrade kitchen-terraform and expand check…
Browse files Browse the repository at this point in the history
… container (#16)

* Pin Ruby version to 2.7.5 and expand container checks to run a basic kitchen apply
* Update .ruby-version

Co-authored-by: Daniel.Hill <daniel.hill@engineering.digital.dwp.gov.uk>
  • Loading branch information
AndyMacDroo and dan-hill2802 authored Mar 10, 2022
1 parent 93f4ba8 commit 06908d5
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 3 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set Ruby Version
uses: ruby/setup-ruby@v1
- name: Build Docker image
run: docker build -t kitchen-terraform:latest .
- name: Check container
run: docker run --rm kitchen-terraform version | grep "Test Kitchen version"
- name: Check container [kitchen converge]
run: docker run --rm -v $(pwd)/examples/check-container:/usr/action kitchen-terraform:latest "converge"
- name: Check container [kitchen verify]
run: docker run --rm -v $(pwd)/examples/check-container:/usr/action kitchen-terraform:latest "verify"

kics-scan:
name: KICS Scan
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
**/.kitchen/*
**/.terraform/*
**/terraform.tfstate.d/*
.terraform.lock.hcl
test-file
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.7.5
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ruby '2.7.5'
source 'https://rubygems.org/' do
gem 'kitchen-terraform', '~> 5.6'
gem "kitchen-terraform", "6.0"
end
22 changes: 22 additions & 0 deletions examples/check-container/kitchen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
driver:
name: terraform
root_module_directory: test/fixtures/check_container
parallelism: 4

provisioner:
name: terraform

verifier:
name: terraform
systems:
- name: basic
backend: local
controls:
- check_container_file_exists

platforms:
- name: terraform

suites:
- name: check_container
5 changes: 5 additions & 0 deletions examples/check-container/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
resource "null_resource" "test_create" {
provisioner "local-exec" {
command = "echo 'This is a test' > test-file"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module "check_container" {
source = "../../.."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
control "check_container_file_exists" do
describe file('./test/fixtures/check_container/test-file') do
it { should exist }
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
name: default

0 comments on commit 06908d5

Please sign in to comment.