├── .codeclimate.yml ├── .devcontainer ├── Dockerfile ├── base.Dockerfile └── devcontainer.json ├── .github ├── codeql │ └── config.yml ├── dependabot.yml └── workflows │ └── delivery.yml ├── .gitignore ├── .mdlrc ├── .reek.yml ├── .rspec ├── .terraform-version ├── .tool-versions ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Guardfile ├── LICENSE ├── README.md ├── Rakefile ├── assets ├── copado_logo.png ├── email_logo.png ├── github_logo.png ├── linkedin_logo.png ├── logo.png └── twitter_logo.png ├── bin ├── _guard-core ├── bundle ├── code_climate_reek ├── guard ├── kitchen ├── list-undocumented-objects.sh ├── middleman ├── pry ├── rake ├── reek ├── rspec ├── rufo ├── update-gems-locked.sh ├── yard ├── yardoc └── yri ├── certs └── gem-public_cert.pem ├── config.rb ├── docs ├── about.html ├── apple-touch-icon-114x114-precomposed.png ├── apple-touch-icon-120x120-precomposed.png ├── apple-touch-icon-144x144-precomposed.png ├── apple-touch-icon-152x152-precomposed.png ├── apple-touch-icon-180x180-precomposed.png ├── apple-touch-icon-57x57-precomposed.png ├── apple-touch-icon-60x60-precomposed.png ├── apple-touch-icon-72x72-precomposed.png ├── apple-touch-icon-76x76-precomposed.png ├── apple-touch-icon-precomposed.png ├── apple-touch-icon.png ├── browserconfig.xml ├── community │ └── index.html ├── favicon-160x160.png ├── favicon-16x16.png ├── favicon-196x196.png ├── favicon-32x32.png ├── favicon-96x96.png ├── favicon.ico ├── favicon.png ├── getting_started.html ├── images │ ├── .keep │ ├── copado_logo.png │ ├── github.png │ └── kitchen_terraform_logo.png ├── index.html ├── javascripts │ └── site.js ├── mstile-144x144.png ├── mstile-150x150.png ├── mstile-310x150.png ├── mstile-310x310.png ├── mstile-70x70.png ├── stylesheets │ ├── highlighting.css │ ├── material.css │ └── site.css └── tutorials │ ├── amazon_provider_ec2.html │ ├── docker_provider.html │ ├── extensive_kitchen_terraform.html │ ├── index.html │ └── openstack_provider.html ├── examples └── extensive_kitchen_terraform │ ├── .ruby-version │ ├── Gemfile │ ├── execute_kitchen_terraform.bash │ ├── generate_ssh_key.bash │ ├── iam_user_policy.json │ ├── install_ruby_gem_dependencies.bash │ ├── kitchen.yml │ ├── main.tf │ ├── outputs.tf │ ├── prepare_inspec_profile.bash │ ├── prepare_terraform_module.bash │ ├── prepare_test_fixture_terraform_configuration.bash │ ├── test │ ├── fixtures │ │ └── wrapper │ │ │ ├── main.tf │ │ │ ├── outputs.tf │ │ │ └── variables.tf │ └── integration │ │ └── extensive_suite │ │ ├── centos_attributes.yml │ │ ├── controls │ │ ├── inspec_attributes.rb │ │ ├── operating_system.rb │ │ ├── reachable_other_host.rb │ │ └── state_file.rb │ │ ├── inspec.yml │ │ └── ubuntu_attributes.yml │ └── variables.tf ├── gems.rb ├── kitchen-terraform.gemspec ├── kitchen.yml ├── lib └── kitchen │ ├── driver │ └── terraform.rb │ ├── provisioner │ └── terraform.rb │ ├── terraform.rb │ ├── terraform │ ├── breaking.rb │ ├── command.rb │ ├── command │ │ ├── apply.rb │ │ ├── destroy.rb │ │ ├── get.rb │ │ ├── init.rb │ │ ├── init │ │ │ ├── post_zero_fifteen_zero.rb │ │ │ └── pre_zero_fifteen_zero.rb │ │ ├── init_factory.rb │ │ ├── output.rb │ │ ├── validate.rb │ │ ├── validate │ │ │ ├── post_zero_fifteen_zero.rb │ │ │ └── pre_zero_fifteen_zero.rb │ │ ├── validate_factory.rb │ │ ├── version.rb │ │ ├── workspace_delete.rb │ │ ├── workspace_new.rb │ │ └── workspace_select.rb │ ├── command_flag.rb │ ├── command_flag │ │ ├── backend_config.rb │ │ ├── color.rb │ │ ├── lock_timeout.rb │ │ ├── plugin_dir.rb │ │ ├── upgrade.rb │ │ ├── var.rb │ │ └── var_file.rb │ ├── config_attribute.rb │ ├── config_attribute │ │ ├── backend_configurations.rb │ │ ├── client.rb │ │ ├── color.rb │ │ ├── command_timeout.rb │ │ ├── fail_fast.rb │ │ ├── lock.rb │ │ ├── lock_timeout.rb │ │ ├── parallelism.rb │ │ ├── plugin_directory.rb │ │ ├── root_module_directory.rb │ │ ├── systems.rb │ │ ├── variable_files.rb │ │ ├── variables.rb │ │ └── verify_version.rb │ ├── config_attribute_cacher.rb │ ├── config_attribute_contract.rb │ ├── config_attribute_contract │ │ ├── array_of_strings.rb │ │ ├── boolean.rb │ │ ├── hash_of_symbols_and_strings.rb │ │ ├── integer.rb │ │ ├── optional_string.rb │ │ ├── string.rb │ │ └── systems.rb │ ├── config_attribute_definer.rb │ ├── config_attribute_type.rb │ ├── config_attribute_type │ │ ├── hash_of_symbols_and_strings.rb │ │ └── integer.rb │ ├── configurable.rb │ ├── debug_logger.rb │ ├── deprecating.rb │ ├── driver.rb │ ├── driver │ │ ├── create.rb │ │ └── destroy.rb │ ├── error.rb │ ├── file_path_config_attribute_definer.rb │ ├── inspec.rb │ ├── inspec │ │ ├── fail_fast_with_hosts.rb │ │ ├── fail_slow_with_hosts.rb │ │ └── without_hosts.rb │ ├── inspec_factory.rb │ ├── inspec_options_factory.rb │ ├── inspec_runner.rb │ ├── outputs_manager.rb │ ├── outputs_parser.rb │ ├── outputs_reader.rb │ ├── provisioner.rb │ ├── provisioner │ │ └── converge.rb │ ├── raise.rb │ ├── raise │ │ ├── action_failed.rb │ │ └── client_error.rb │ ├── system.rb │ ├── system_attrs_inputs_resolver.rb │ ├── system_attrs_outputs_resolver.rb │ ├── system_bastion_host_resolver.rb │ ├── system_hosts_resolver.rb │ ├── system_inspec_map.rb │ ├── systems_verifier.rb │ ├── systems_verifier │ │ ├── fail_fast.rb │ │ └── fail_slow.rb │ ├── systems_verifier_factory.rb │ ├── transport.rb │ ├── transport │ │ └── connection.rb │ ├── unsupported_client_version_error.rb │ ├── variables_manager.rb │ ├── verifier.rb │ ├── verify_version.rb │ ├── verify_version_rescue_strategy.rb │ ├── verify_version_rescue_strategy │ │ ├── permissive.rb │ │ └── strict.rb │ ├── verify_version_rescue_strategy_factory.rb │ ├── version.rb │ ├── version_verifier.rb │ ├── version_verifier_strategy.rb │ ├── version_verifier_strategy │ │ ├── supported.rb │ │ └── unsupported.rb │ └── version_verifier_strategy_factory.rb │ ├── transport │ └── terraform.rb │ └── verifier │ └── terraform.rb ├── rubygems └── credentials.gpg ├── source ├── about.html.erb ├── browserconfig.xml ├── community │ └── index.html.erb ├── getting_started.html.erb ├── images │ ├── .keep │ ├── copado_logo.png │ ├── github.png │ └── kitchen_terraform_logo.png ├── index.html.erb ├── javascripts │ └── site.js ├── layouts │ └── layout.erb ├── stylesheets │ ├── highlighting.css.scss.erb │ ├── material.css.scss │ └── site.css.scss └── tutorials │ ├── amazon_provider_ec2.html.erb │ ├── docker_provider.html.erb │ ├── extensive_kitchen_terraform.html.erb │ ├── index.html.erb │ └── openstack_provider.html.erb ├── spec ├── lib │ └── kitchen │ │ ├── driver │ │ └── terraform_spec.rb │ │ ├── provisioner │ │ └── terraform_spec.rb │ │ ├── terraform │ │ ├── command │ │ │ ├── apply_spec.rb │ │ │ ├── destroy_spec.rb │ │ │ ├── get_spec.rb │ │ │ ├── init │ │ │ │ ├── post_zero_fifteen_zero_spec.rb │ │ │ │ └── pre_zero_fifteen_zero_spec.rb │ │ │ ├── init_factory_spec.rb │ │ │ ├── output_spec.rb │ │ │ ├── validate │ │ │ │ ├── post_zero_fifteen_zero_spec.rb │ │ │ │ └── pre_zero_fifteen_zero_spec.rb │ │ │ ├── validate_factory_spec.rb │ │ │ ├── version_spec.rb │ │ │ ├── workspace_delete_spec.rb │ │ │ ├── workspace_new_spec.rb │ │ │ └── workspace_select_spec.rb │ │ ├── command_flag │ │ │ ├── backend_config_spec.rb │ │ │ ├── color_spec.rb │ │ │ ├── lock_timeout_spec.rb │ │ │ ├── plugin_dir_spec.rb │ │ │ ├── upgrade_spec.rb │ │ │ ├── var_file_spec.rb │ │ │ └── var_spec.rb │ │ ├── config_attribute_contract │ │ │ ├── array_of_strings_spec.rb │ │ │ ├── boolean_spec.rb │ │ │ ├── hash_of_symbols_and_strings_spec.rb │ │ │ ├── integer_spec.rb │ │ │ ├── optional_string_spec.rb │ │ │ ├── string_spec.rb │ │ │ └── systems_spec.rb │ │ ├── debug_logger_spec.rb │ │ ├── driver │ │ │ ├── create_spec.rb │ │ │ └── destroy_spec.rb │ │ ├── inspec │ │ │ ├── fail_fast_with_hosts_spec.rb │ │ │ ├── fail_slow_with_hosts_spec.rb │ │ │ └── without_hosts_spec.rb │ │ ├── inspec_factory_spec.rb │ │ ├── inspec_options_factory_spec.rb │ │ ├── inspec_runner_spec.rb │ │ ├── outputs_manager_spec.rb │ │ ├── outputs_parser_spec.rb │ │ ├── outputs_reader_spec.rb │ │ ├── provisioner │ │ │ └── converge_spec.rb │ │ ├── system_attrs_outputs_resolver_spec.rb │ │ ├── system_bastion_host_resolver_spec.rb │ │ ├── system_hosts_resolver_spec.rb │ │ ├── system_spec.rb │ │ ├── systems_verifier │ │ │ ├── fail_fast_spec.rb │ │ │ └── fail_slow_spec.rb │ │ ├── systems_verifier_factory_spec.rb │ │ ├── transport │ │ │ └── connection_spec.rb │ │ ├── variables_manager_spec.rb │ │ ├── verify_version_rescue_strategy │ │ │ ├── permissive_spec.rb │ │ │ └── strict_spec.rb │ │ ├── verify_version_spec.rb │ │ ├── version_spec.rb │ │ ├── version_verifier_spec.rb │ │ ├── version_verifier_strategy │ │ │ ├── supported_spec.rb │ │ │ └── unsupported_spec.rb │ │ └── version_verifier_strategy_factory_spec.rb │ │ ├── transport │ │ └── terraform_spec.rb │ │ └── verifier │ │ └── terraform_spec.rb ├── spec_helper.rb └── support │ ├── coverage.rb │ └── kitchen │ ├── logger_context.rb │ └── terraform │ ├── config_attribute │ ├── backend_configurations_examples.rb │ ├── client_examples.rb │ ├── color_examples.rb │ ├── command_timeout_examples.rb │ ├── fail_fast_examples.rb │ ├── lock_examples.rb │ ├── lock_timeout_examples.rb │ ├── parallelism_examples.rb │ ├── plugin_directory_examples.rb │ ├── root_module_directory_examples.rb │ ├── systems_examples.rb │ ├── variable_files_examples.rb │ ├── variables_examples.rb │ └── verify_version_examples.rb │ ├── config_attribute_context.rb │ ├── config_attribute_contract │ ├── array_of_strings_examples.rb │ ├── boolean_examples.rb │ ├── optional_string_examples.rb │ └── string_examples.rb │ ├── config_attribute_type │ ├── hash_of_symbols_and_strings_examples.rb │ └── integer_examples.rb │ └── configurable_examples.rb └── test ├── integration ├── attributes │ ├── Attribute File.yml │ ├── controls │ │ ├── attrs_outputs.rb │ │ ├── default.rb │ │ └── precedence.rb │ └── inspec.yml ├── backend-ssh │ ├── behaviour │ │ ├── controls │ │ │ └── command.rb │ │ └── inspec.yml │ └── state │ │ ├── controls │ │ └── operating_system.rb │ │ └── inspec.yml ├── plug-ins │ ├── controls │ │ └── static_file.rb │ └── inspec.yml ├── variables │ ├── controls │ │ ├── variable_files.rb │ │ └── variables.rb │ └── inspec.yml ├── workspace-one │ ├── controls │ │ └── workspace.rb │ └── inspec.yml └── workspace-two │ ├── controls │ └── workspace.rb │ └── inspec.yml ├── kitchen └── terraform │ └── rake_tasks.rb └── terraform ├── PlugIns ├── main.tf ├── outputs.tf ├── terragrunt.hcl └── versions.tf ├── attributes ├── outputs.tf ├── terragrunt.hcl ├── variables.tf └── versions.tf ├── backend-ssh ├── id_ed25519 ├── id_ed25519.pub ├── main.tf ├── outputs.tf └── versions.tf ├── variables ├── main.tf ├── outputs.tf ├── terragrunt.hcl ├── variable_files │ └── Variable File.tfvars ├── variables.tf └── versions.tf └── workspace ├── terragrunt.hcl ├── variables.tf └── versions.tf /.codeclimate.yml: -------------------------------------------------------------------------------- 1 | # https://codeclimate.com/github/newcontext-oss/kitchen-terraform 2 | version: "2" 3 | checks: 4 | file-lines: 5 | config: 6 | threshold: 300 7 | plugins: 8 | bundler-audit: 9 | enabled: false 10 | duplication: 11 | enabled: false 12 | config: 13 | languages: 14 | - "ruby" 15 | fixme: 16 | enabled: true 17 | flog: 18 | enabled: false 19 | markdownlint: 20 | enabled: true 21 | reek: 22 | enabled: true 23 | rubocop: 24 | enabled: false 25 | exclude_patterns: 26 | - "assets/" 27 | - "bin/" 28 | - "certs/" 29 | - "coverage/" 30 | - "doc/" 31 | - "docs/" 32 | - "examples/" 33 | - "rubygems/" 34 | - "source/" 35 | - "tmp/" 36 | - "vendor/" 37 | -------------------------------------------------------------------------------- /.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | # [Choice] Ruby version (use -bullseye variants on local arm64/Apple Silicon): 3, 3.0, 2, 2.7, 2.6, 3-bullseye, 3.0-bullseye, 2-bullseye, 2.7-bullseye, 2.6-bullseye, 3-buster, 3.0-buster, 2-buster, 2.7-buster, 2.6-buster 2 | ARG VARIANT=2-bullseye 3 | FROM mcr.microsoft.com/vscode/devcontainers/ruby:0-${VARIANT} 4 | 5 | # [Choice] Node.js version: none, lts/*, 16, 14, 12, 10 6 | ARG NODE_VERSION="none" 7 | RUN if [ "${NODE_VERSION}" != "none" ]; then su vscode -c "umask 0002 && . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi 8 | 9 | # [Optional] Uncomment this section to install additional OS packages. 10 | # RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ 11 | # && apt-get -y install --no-install-recommends 12 | 13 | # [Optional] Uncomment this line to install additional gems. 14 | # RUN gem install 15 | 16 | # [Optional] Uncomment this line to install global node packages. 17 | # RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && npm install -g " 2>&1 -------------------------------------------------------------------------------- /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | // For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: 2 | // https://github.com/microsoft/vscode-dev-containers/tree/v0.209.6/containers/ruby 3 | { 4 | "name": "Ruby", 5 | "build": { 6 | "dockerfile": "Dockerfile", 7 | "args": { 8 | // Update 'VARIANT' to pick a Ruby version: 3, 3.0, 2, 2.7, 2.6 9 | // Append -bullseye or -buster to pin to an OS version. 10 | // Use -bullseye variants on local on arm64/Apple Silicon. 11 | "VARIANT": "3-bullseye", 12 | // Options 13 | "NODE_VERSION": "17" 14 | } 15 | }, 16 | 17 | // Set *default* container specific settings.json values on container create. 18 | "settings": {}, 19 | 20 | // Add the IDs of extensions you want installed when the container is created. 21 | "extensions": [ 22 | "rebornix.Ruby" 23 | ], 24 | 25 | // Use 'forwardPorts' to make a list of ports inside the container available locally. 26 | // "forwardPorts": [], 27 | 28 | // Use 'postCreateCommand' to run commands after the container is created. 29 | // "postCreateCommand": "ruby --version", 30 | 31 | // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. 32 | "remoteUser": "vscode", 33 | "features": { 34 | "terraform": "latest" 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /.github/codeql/config.yml: -------------------------------------------------------------------------------- 1 | paths-ignore: 2 | - vendor 3 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | --- 2 | version: 2 3 | updates: 4 | - package-ecosystem: "github-actions" 5 | directory: "/" 6 | schedule: 7 | interval: "monthly" 8 | 9 | - package-ecosystem: "bundler" 10 | directory: "/" 11 | schedule: 12 | interval: "monthly" 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .cache/ 2 | .DS_Store/ 3 | .ruby-version 4 | .sass-cache/ 5 | .solargraph.yml 6 | .terraform.lock.hcl 7 | .vscode/ 8 | .yardoc/ 9 | *.gem 10 | *.tfstate.backup 11 | **/.idea/ 12 | **/.kitchen.local.yml 13 | **/.kitchen/ 14 | **/.terraform/ 15 | **/inspec.lock 16 | **/terraform.tfstate 17 | build/ 18 | certs/gem-private_key.pem 19 | coverage/ 20 | doc/ 21 | examples/*/Gemfile.lock 22 | examples/*/test/assets 23 | gems.locked 24 | rubygems/credentials 25 | terraform_*/ 26 | terraform.tfstate.d/ 27 | test/reports/ 28 | test/terraform/Plug Ins/Plug In Directory/ 29 | tmp/ 30 | vendor/ -------------------------------------------------------------------------------- /.mdlrc: -------------------------------------------------------------------------------- 1 | rules "~MD024", "~MD033" 2 | -------------------------------------------------------------------------------- /.reek.yml: -------------------------------------------------------------------------------- 1 | detectors: 2 | TooManyStatements: 3 | enabled: false 4 | -------------------------------------------------------------------------------- /.rspec: -------------------------------------------------------------------------------- 1 | --format doc 2 | --require spec_helper 3 | -------------------------------------------------------------------------------- /.terraform-version: -------------------------------------------------------------------------------- 1 | latest:^0.14 2 | -------------------------------------------------------------------------------- /.tool-versions: -------------------------------------------------------------------------------- 1 | # kitchen/rake_tasks raises a `NameError: undefined method `=~'` error on Ruby 3.2 2 | ruby 3.2.0 3 | terraform 1.3.7 4 | terragrunt 0.36.0 5 | -------------------------------------------------------------------------------- /Guardfile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | directories ["lib", "spec"] 4 | 5 | group :red_green_refactor, halt_on_fail: true do 6 | guard :yard, cli: "--reload" do 7 | watch /lib\/.+\.rb/ 8 | end 9 | 10 | guard( 11 | :rspec, 12 | all_after_pass: true, 13 | all_on_start: true, 14 | bundler_env: :inherit, 15 | cmd: "bundle exec rspec", 16 | failure_mode: :focus, 17 | ) do 18 | require "guard/rspec/dsl" 19 | dsl = Guard::RSpec::Dsl.new self 20 | 21 | # RSpec files 22 | rspec = dsl.rspec 23 | watch rspec.spec_helper do 24 | rspec.spec_dir 25 | end 26 | watch rspec.spec_support do 27 | rspec.spec_dir 28 | end 29 | watch rspec.spec_files 30 | 31 | # Ruby files 32 | ruby = dsl.ruby 33 | dsl.watch_spec_files_for ruby.lib_files 34 | end 35 | end 36 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | namespace :test do 4 | begin 5 | require "rspec/core/rake_task" 6 | ::RSpec::Core::RakeTask.new :rspec 7 | rescue ::LoadError 8 | puts "The gem named rspec is not available" 9 | end 10 | begin 11 | require_relative "test/kitchen/terraform/rake_tasks" 12 | ::Test::Kitchen::Terraform::RakeTasks.new 13 | rescue ::Kitchen::UserError => user_error 14 | puts "Terraform is not available; omitting Kitchen tasks", user_error, "" 15 | rescue ::LoadError => load_error 16 | puts "The gem named test-kitchen is not available", load_error, "" 17 | end 18 | end 19 | 20 | task default: "test:rspec" 21 | -------------------------------------------------------------------------------- /assets/copado_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newcontext-oss/kitchen-terraform/e23570368e3f004edbca8149840df3f23154fcd6/assets/copado_logo.png -------------------------------------------------------------------------------- /assets/email_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newcontext-oss/kitchen-terraform/e23570368e3f004edbca8149840df3f23154fcd6/assets/email_logo.png -------------------------------------------------------------------------------- /assets/github_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newcontext-oss/kitchen-terraform/e23570368e3f004edbca8149840df3f23154fcd6/assets/github_logo.png -------------------------------------------------------------------------------- /assets/linkedin_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newcontext-oss/kitchen-terraform/e23570368e3f004edbca8149840df3f23154fcd6/assets/linkedin_logo.png -------------------------------------------------------------------------------- /assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newcontext-oss/kitchen-terraform/e23570368e3f004edbca8149840df3f23154fcd6/assets/logo.png -------------------------------------------------------------------------------- /assets/twitter_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newcontext-oss/kitchen-terraform/e23570368e3f004edbca8149840df3f23154fcd6/assets/twitter_logo.png -------------------------------------------------------------------------------- /bin/_guard-core: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application '_guard-core' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../gems.rb", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("guard", "_guard-core") 30 | -------------------------------------------------------------------------------- /bin/code_climate_reek: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'code_climate_reek' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../gems.rb", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("reek", "code_climate_reek") 30 | -------------------------------------------------------------------------------- /bin/guard: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'guard' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../gems.rb", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("guard", "guard") 30 | -------------------------------------------------------------------------------- /bin/kitchen: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'kitchen' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../gems.rb", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("test-kitchen", "kitchen") 30 | -------------------------------------------------------------------------------- /bin/list-undocumented-objects.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | bundle exec yard stats --list-undoc 5 | 6 | -------------------------------------------------------------------------------- /bin/middleman: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'middleman' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../gems.rb", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("middleman-cli", "middleman") 30 | -------------------------------------------------------------------------------- /bin/pry: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'pry' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../gems.rb", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("pry", "pry") 30 | -------------------------------------------------------------------------------- /bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'rake' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../gems.rb", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("rake", "rake") 30 | -------------------------------------------------------------------------------- /bin/reek: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'reek' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../gems.rb", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("reek", "reek") 30 | -------------------------------------------------------------------------------- /bin/rspec: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'rspec' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../gems.rb", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("rspec-core", "rspec") 30 | -------------------------------------------------------------------------------- /bin/rufo: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'rufo' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../gems.rb", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("rufo", "rufo") 30 | -------------------------------------------------------------------------------- /bin/update-gems-locked.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | source /usr/local/share/chruby/chruby.sh 5 | set +x 6 | chruby ruby-3.0 7 | ruby --version 8 | set -x 9 | gem install bundler 10 | if [ -e gems.locked ] 11 | then 12 | bundle update --all 13 | else 14 | bundle install 15 | fi 16 | bundle binstubs --force bundler guard middleman-cli pry rake reek rspec-core rufo test-kitchen yard 17 | set +x 18 | -------------------------------------------------------------------------------- /bin/yard: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'yard' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../gems.rb", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("yard", "yard") 30 | -------------------------------------------------------------------------------- /bin/yardoc: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'yardoc' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../gems.rb", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("yard", "yardoc") 30 | -------------------------------------------------------------------------------- /bin/yri: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # frozen_string_literal: true 3 | 4 | # 5 | # This file was generated by Bundler. 6 | # 7 | # The application 'yri' is installed as part of a gem, and 8 | # this file is here to facilitate running it. 9 | # 10 | 11 | require "pathname" 12 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../gems.rb", 13 | Pathname.new(__FILE__).realpath) 14 | 15 | bundle_binstub = File.expand_path("../bundle", __FILE__) 16 | 17 | if File.file?(bundle_binstub) 18 | if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/ 19 | load(bundle_binstub) 20 | else 21 | abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. 22 | Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") 23 | end 24 | end 25 | 26 | require "rubygems" 27 | require "bundler/setup" 28 | 29 | load Gem.bin_path("yard", "yri") 30 | -------------------------------------------------------------------------------- /docs/apple-touch-icon-114x114-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newcontext-oss/kitchen-terraform/e23570368e3f004edbca8149840df3f23154fcd6/docs/apple-touch-icon-114x114-precomposed.png -------------------------------------------------------------------------------- /docs/apple-touch-icon-120x120-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newcontext-oss/kitchen-terraform/e23570368e3f004edbca8149840df3f23154fcd6/docs/apple-touch-icon-120x120-precomposed.png -------------------------------------------------------------------------------- /docs/apple-touch-icon-144x144-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newcontext-oss/kitchen-terraform/e23570368e3f004edbca8149840df3f23154fcd6/docs/apple-touch-icon-144x144-precomposed.png -------------------------------------------------------------------------------- /docs/apple-touch-icon-152x152-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newcontext-oss/kitchen-terraform/e23570368e3f004edbca8149840df3f23154fcd6/docs/apple-touch-icon-152x152-precomposed.png -------------------------------------------------------------------------------- /docs/apple-touch-icon-180x180-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newcontext-oss/kitchen-terraform/e23570368e3f004edbca8149840df3f23154fcd6/docs/apple-touch-icon-180x180-precomposed.png -------------------------------------------------------------------------------- /docs/apple-touch-icon-57x57-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newcontext-oss/kitchen-terraform/e23570368e3f004edbca8149840df3f23154fcd6/docs/apple-touch-icon-57x57-precomposed.png -------------------------------------------------------------------------------- /docs/apple-touch-icon-60x60-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newcontext-oss/kitchen-terraform/e23570368e3f004edbca8149840df3f23154fcd6/docs/apple-touch-icon-60x60-precomposed.png -------------------------------------------------------------------------------- /docs/apple-touch-icon-72x72-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newcontext-oss/kitchen-terraform/e23570368e3f004edbca8149840df3f23154fcd6/docs/apple-touch-icon-72x72-precomposed.png -------------------------------------------------------------------------------- /docs/apple-touch-icon-76x76-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newcontext-oss/kitchen-terraform/e23570368e3f004edbca8149840df3f23154fcd6/docs/apple-touch-icon-76x76-precomposed.png -------------------------------------------------------------------------------- /docs/apple-touch-icon-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newcontext-oss/kitchen-terraform/e23570368e3f004edbca8149840df3f23154fcd6/docs/apple-touch-icon-precomposed.png -------------------------------------------------------------------------------- /docs/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newcontext-oss/kitchen-terraform/e23570368e3f004edbca8149840df3f23154fcd6/docs/apple-touch-icon.png -------------------------------------------------------------------------------- /docs/browserconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | #ffffff 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/favicon-160x160.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newcontext-oss/kitchen-terraform/e23570368e3f004edbca8149840df3f23154fcd6/docs/favicon-160x160.png -------------------------------------------------------------------------------- /docs/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newcontext-oss/kitchen-terraform/e23570368e3f004edbca8149840df3f23154fcd6/docs/favicon-16x16.png -------------------------------------------------------------------------------- /docs/favicon-196x196.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newcontext-oss/kitchen-terraform/e23570368e3f004edbca8149840df3f23154fcd6/docs/favicon-196x196.png -------------------------------------------------------------------------------- /docs/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newcontext-oss/kitchen-terraform/e23570368e3f004edbca8149840df3f23154fcd6/docs/favicon-32x32.png -------------------------------------------------------------------------------- /docs/favicon-96x96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newcontext-oss/kitchen-terraform/e23570368e3f004edbca8149840df3f23154fcd6/docs/favicon-96x96.png -------------------------------------------------------------------------------- /docs/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newcontext-oss/kitchen-terraform/e23570368e3f004edbca8149840df3f23154fcd6/docs/favicon.ico -------------------------------------------------------------------------------- /docs/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newcontext-oss/kitchen-terraform/e23570368e3f004edbca8149840df3f23154fcd6/docs/favicon.png -------------------------------------------------------------------------------- /docs/images/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newcontext-oss/kitchen-terraform/e23570368e3f004edbca8149840df3f23154fcd6/docs/images/.keep -------------------------------------------------------------------------------- /docs/images/copado_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newcontext-oss/kitchen-terraform/e23570368e3f004edbca8149840df3f23154fcd6/docs/images/copado_logo.png -------------------------------------------------------------------------------- /docs/images/github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newcontext-oss/kitchen-terraform/e23570368e3f004edbca8149840df3f23154fcd6/docs/images/github.png -------------------------------------------------------------------------------- /docs/images/kitchen_terraform_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newcontext-oss/kitchen-terraform/e23570368e3f004edbca8149840df3f23154fcd6/docs/images/kitchen_terraform_logo.png -------------------------------------------------------------------------------- /docs/javascripts/site.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newcontext-oss/kitchen-terraform/e23570368e3f004edbca8149840df3f23154fcd6/docs/javascripts/site.js -------------------------------------------------------------------------------- /docs/mstile-144x144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newcontext-oss/kitchen-terraform/e23570368e3f004edbca8149840df3f23154fcd6/docs/mstile-144x144.png -------------------------------------------------------------------------------- /docs/mstile-150x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newcontext-oss/kitchen-terraform/e23570368e3f004edbca8149840df3f23154fcd6/docs/mstile-150x150.png -------------------------------------------------------------------------------- /docs/mstile-310x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newcontext-oss/kitchen-terraform/e23570368e3f004edbca8149840df3f23154fcd6/docs/mstile-310x150.png -------------------------------------------------------------------------------- /docs/mstile-310x310.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newcontext-oss/kitchen-terraform/e23570368e3f004edbca8149840df3f23154fcd6/docs/mstile-310x310.png -------------------------------------------------------------------------------- /docs/mstile-70x70.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newcontext-oss/kitchen-terraform/e23570368e3f004edbca8149840df3f23154fcd6/docs/mstile-70x70.png -------------------------------------------------------------------------------- /docs/stylesheets/highlighting.css: -------------------------------------------------------------------------------- 1 | .syntax-highlight table td{padding:5px}.syntax-highlight table pre{margin:0}.syntax-highlight,.syntax-highlight .w{color:#f8f8f2;background-color:#272822}.syntax-highlight .err{color:#272822;background-color:#f92672}.syntax-highlight .c,.syntax-highlight .ch,.syntax-highlight .cd,.syntax-highlight .cm,.syntax-highlight .cpf,.syntax-highlight .c1,.syntax-highlight .cs{color:#75715e}.syntax-highlight .cp{color:#f4bf75}.syntax-highlight .nt{color:#f4bf75}.syntax-highlight .o,.syntax-highlight .ow{color:#f8f8f2}.syntax-highlight .p,.syntax-highlight .pi{color:#f8f8f2}.syntax-highlight .gi{color:#a6e22e}.syntax-highlight .gd{color:#f92672}.syntax-highlight .gh{color:#66d9ef;background-color:#272822;font-weight:bold}.syntax-highlight .k,.syntax-highlight .kn,.syntax-highlight .kp,.syntax-highlight .kr,.syntax-highlight .kv{color:#ae81ff}.syntax-highlight .kc{color:#fd971f}.syntax-highlight .kt{color:#fd971f}.syntax-highlight .kd{color:#fd971f}.syntax-highlight .s,.syntax-highlight .sb,.syntax-highlight .sc,.syntax-highlight .dl,.syntax-highlight .sd,.syntax-highlight .s2,.syntax-highlight .sh,.syntax-highlight .sx,.syntax-highlight .s1{color:#a6e22e}.syntax-highlight .sa{color:#ae81ff}.syntax-highlight .sr{color:#a1efe4}.syntax-highlight .si{color:#cc6633}.syntax-highlight .se{color:#cc6633}.syntax-highlight .nn{color:#f4bf75}.syntax-highlight .nc{color:#f4bf75}.syntax-highlight .no{color:#f4bf75}.syntax-highlight .na{color:#66d9ef}.syntax-highlight .m,.syntax-highlight .mb,.syntax-highlight .mf,.syntax-highlight .mh,.syntax-highlight .mi,.syntax-highlight .il,.syntax-highlight .mo,.syntax-highlight .mx{color:#a6e22e}.syntax-highlight .ss{color:#a6e22e} -------------------------------------------------------------------------------- /docs/stylesheets/site.css: -------------------------------------------------------------------------------- 1 | body{background-color:#E5E3E3;font-family:-apple-system, BlinkMacSystemFont, "Avenir Next", "Avenir", "Segoe UI", "Lucida Grande", "Helvetica Neue", "Helvetica", "Fira Sans", "Roboto", "Noto", "Droid Sans", "Cantarell", "Oxygen", "Ubuntu", "Franklin Gothic Medium", "Century Gothic", "Liberation Sans", sans-serif;text-align:center}h1{font-size:45em}.header{background-color:#F0F4ED}.footer{padding:0px;bottom:0;width:100%;height:60px;line-height:60px;background-color:#F0F4ED}.syntax-highlight{padding:10px}.content{padding:10vh 1rem}hr{height:2px;background-color:#92af8f;margin-top:20px;margin-bottom:20px;width:100%}.jumbotron{background-color:#FCFDFB}.list-group-item.active{border-color:#9BD591;background-color:#9BD591}#blur{-webkit-filter:blur(7px);filter:blur(7px)}.navbar{padding:0px}.btn.btn-primary,.navbar .navbar-nav>li>a.btn.btn-primary,.btn.btn-primary:hover,.navbar .navbar-nav>li>a.btn.btn-primary:hover,.btn.btn-primary:focus,.navbar .navbar-nav>li>a.btn.btn-primary:focus,.btn.btn-primary:active,.navbar .navbar-nav>li>a.btn.btn-primary:active,.btn.btn-primary.active,.navbar .navbar-nav>li>a.btn.btn-primary.active,.btn.btn-primary:active:focus,.navbar .navbar-nav>li>a.btn.btn-primary:active:focus,.btn.btn-primary:active:hover,.navbar .navbar-nav>li>a.btn.btn-primary:active:hover,.btn.btn-primary.active:focus,.navbar .navbar-nav>li>a.btn.btn-primary.active:focus,.btn.btn-primary.active:hover,.navbar .navbar-nav>li>a.btn.btn-primary.active:hover,.open>.btn.btn-primary.dropdown-toggle,.open>.navbar .navbar-nav>li>a.btn.btn-primary.dropdown-toggle,.open>.btn.btn-primary.dropdown-toggle:focus,.open>.navbar .navbar-nav>li>a.btn.btn-primary.dropdown-toggle:focus,.open>.btn.btn-primary.dropdown-toggle:hover,.open>.navbar .navbar-nav>li>a.btn.btn-primary.dropdown-toggle:hover{background-color:#9BD591} -------------------------------------------------------------------------------- /examples/extensive_kitchen_terraform/.ruby-version: -------------------------------------------------------------------------------- 1 | 2.5.1 2 | -------------------------------------------------------------------------------- /examples/extensive_kitchen_terraform/Gemfile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | source "https://rubygems.org/" do 4 | gem "kitchen-terraform", "~> 7.0" 5 | end 6 | -------------------------------------------------------------------------------- /examples/extensive_kitchen_terraform/execute_kitchen_terraform.bash: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | # Unset AWS STS session environment variables 4 | function drop_aws_sts_session { 5 | unset AWS_ACCESS_KEY_ID 6 | unset AWS_DEFAULT_REGION 7 | unset AWS_SECRET_ACCESS_KEY 8 | unset AWS_SESSION_TOKEN 9 | } 10 | 11 | # Export AWS STS session environment variables 12 | function export_aws_sts_session { 13 | drop_aws_sts_session 14 | session="$(aws sts get-session-token --output=json)" 15 | AWS_ACCESS_KEY_ID="$(echo $session | jq -r .Credentials.AccessKeyId)" 16 | AWS_DEFAULT_REGION="$1" 17 | AWS_SECRET_ACCESS_KEY="$(echo $session | jq -r .Credentials.SecretAccessKey)" 18 | AWS_SESSION_TOKEN="$(echo $session | jq -r .Credentials.SessionToken)" 19 | export AWS_ACCESS_KEY_ID 20 | export AWS_DEFAULT_REGION 21 | export AWS_SECRET_ACCESS_KEY 22 | export AWS_SESSION_TOKEN 23 | } 24 | 25 | export_aws_sts_session "us-east-1" 26 | 27 | # Destroy any existing Terraform state in us-east-1 28 | bundle exec kitchen destroy centos 29 | 30 | # Initialize the Terraform working directory and select a new Terraform workspace 31 | # to test CentOS in us-east-1 32 | bundle exec kitchen create centos 33 | 34 | # Apply the Terraform root module to the Terraform state using the Terraform 35 | # fixture configuration 36 | bundle exec kitchen converge centos 37 | 38 | # Test the Terraform state using the InSpec controls 39 | bundle exec kitchen verify centos 40 | 41 | # Destroy the Terraform state using the Terraform fixture configuration 42 | bundle exec kitchen destroy centos 43 | 44 | export_aws_sts_session "us-west-2" 45 | 46 | # Perform the same steps for Ubuntu in us-west-2 47 | bundle exec kitchen test ubuntu 48 | 49 | drop_aws_sts_session 50 | -------------------------------------------------------------------------------- /examples/extensive_kitchen_terraform/generate_ssh_key.bash: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Make a directory to contain the key 4 | mkdir -p test/assets 5 | 6 | # Generate a 4096 bit RSA key with a blank passphrase in the directory 7 | ssh-keygen \ 8 | -b 4096 \ 9 | -C "Kitchen-Terraform AWS provider tutorial" \ 10 | -f test/assets/key_pair \ 11 | -N "" \ 12 | -t rsa 13 | -------------------------------------------------------------------------------- /examples/extensive_kitchen_terraform/iam_user_policy.json: -------------------------------------------------------------------------------- 1 | { 2 | "Version": "2012-10-17", 3 | "Statement": 4 | [ 5 | { 6 | "Sid": "Stmt1469773655000", 7 | "Effect": "Allow", 8 | "Action": ["ec2:*"], 9 | "Resource": ["*"] 10 | } 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /examples/extensive_kitchen_terraform/install_ruby_gem_dependencies.bash: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | gem install bundler 4 | bundle install 5 | -------------------------------------------------------------------------------- /examples/extensive_kitchen_terraform/outputs.tf: -------------------------------------------------------------------------------- 1 | output "reachable_other_host_ip_address" { 2 | description = "The IP address of the reachable_other_host instance" 3 | value = "${aws_instance.reachable_other_host.public_ip}" 4 | } 5 | 6 | output "remote_group_public_dns" { 7 | description = "The list of public DNS names of the remote_group instances" 8 | value = ["${aws_instance.remote_group.*.public_dns}"] 9 | } 10 | -------------------------------------------------------------------------------- /examples/extensive_kitchen_terraform/prepare_inspec_profile.bash: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | mkdir -p test/integration/extensive_suite/controls 4 | touch test/integration/extensive_suite/inspec.yml 5 | touch test/integration/extensive_suite/centos_attributes.yml 6 | touch test/integration/extensive_suite/ubuntu_attributes.yml 7 | touch test/integration/extensive_suite/controls/inspec_attributes.rb 8 | touch test/integration/extensive_suite/controls/operating_system.rb 9 | touch test/integration/extensive_suite/controls/reachable_other_host.rb 10 | touch test/integration/extensive_suite/controls/state_file.rb 11 | -------------------------------------------------------------------------------- /examples/extensive_kitchen_terraform/prepare_terraform_module.bash: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | touch main.tf variables.tf outputs.tf 4 | -------------------------------------------------------------------------------- /examples/extensive_kitchen_terraform/prepare_test_fixture_terraform_configuration.bash: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | mkdir -p test/fixtures/wrapper 4 | touch test/fixtures/wrapper/main.tf test/fixtures/wrapper/outputs.tf \ 5 | test/fixtures/wrapper/variables.tf -------------------------------------------------------------------------------- /examples/extensive_kitchen_terraform/test/fixtures/wrapper/main.tf: -------------------------------------------------------------------------------- 1 | module "extensive_kitchen_terraform" { 2 | instances_ami = "${var.instances_ami}" 3 | 4 | # The generated key pair will be used to configure SSH authentication 5 | key_pair_public_key = "${file("${path.module}/../../assets/key_pair.pub")}" 6 | 7 | # The source of the module is the root directory of the Terraform project 8 | source = "../../../" 9 | subnet_availability_zone = "${var.subnet_availability_zone}" 10 | } 11 | -------------------------------------------------------------------------------- /examples/extensive_kitchen_terraform/test/fixtures/wrapper/outputs.tf: -------------------------------------------------------------------------------- 1 | output "reachable_other_host_ip_address" { 2 | description = <= 3.0" 20 | 21 | gemspec 22 | 23 | gem "mini_racer", platforms: ["ruby"] 24 | -------------------------------------------------------------------------------- /lib/kitchen/terraform.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | # Dummy namespace for Test Kitchen to allow loading of Kitchen::Terraform::Version from gem specification. 18 | module Kitchen 19 | # The namespace for Kitchen-Terraform. 20 | module Terraform 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/breaking.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | module Kitchen 18 | module Terraform 19 | # The namespace for objects with breaking changes. 20 | module Breaking 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/command.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | module Kitchen 18 | module Terraform 19 | # The namespace for Terraform commands. 20 | module Command 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/command/get.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "shellwords" 18 | 19 | module Kitchen 20 | module Terraform 21 | module Command 22 | # The dependency modules are updated by running a command like the following example: 23 | # terraform get -update 24 | class Get 25 | # @return [String] the command with flags. 26 | def to_s 27 | "get -update" 28 | end 29 | end 30 | end 31 | end 32 | end 33 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/command/init.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | module Kitchen 18 | module Terraform 19 | module Command 20 | # Init is the namespace for Terraform Init commands. 21 | module Init 22 | end 23 | end 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/command/output.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | module Kitchen 18 | module Terraform 19 | module Command 20 | # The outputs are retrieved by running a command like the following example: 21 | # terraform output -json 22 | class Output 23 | # @return [String] the command with flags. 24 | def to_s 25 | "output -json" 26 | end 27 | end 28 | end 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/command/validate.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | module Kitchen 18 | module Terraform 19 | module Command 20 | # Validate is the namespace for Terraform Validate commands. 21 | module Validate 22 | end 23 | end 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/command/version.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | module Kitchen 18 | module Terraform 19 | module Command 20 | # Version is the class of objects which represent the terraform version command. 21 | class Version 22 | # @return [String] the command. 23 | def to_s 24 | "version" 25 | end 26 | end 27 | end 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/command/workspace_delete.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | module Kitchen 18 | module Terraform 19 | module Command 20 | # The workspace is deleted by running a command like the following example: 21 | # terraform workspace delete 22 | class WorkspaceDelete 23 | # @param config [Hash] the configuration of the driver. 24 | # @option config [String] :workspace_name the name of the Terraform workspace. 25 | # @return [Kitchen::Terraform::Command::WorkspaceDelete] 26 | def initialize(config:) 27 | self.workspace_name = config.fetch :workspace_name 28 | end 29 | 30 | # @return [String] the command. 31 | def to_s 32 | "workspace delete #{workspace_name}" 33 | end 34 | 35 | private 36 | 37 | attr_accessor :workspace_name 38 | end 39 | end 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/command/workspace_new.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | module Kitchen 18 | module Terraform 19 | module Command 20 | # The workspace is created by running a command like the following example: 21 | # terraform workspace new 22 | class WorkspaceNew 23 | # #initialize prepares a new instance of the class. 24 | # 25 | # @param config [Hash] the configuration of the driver. 26 | # @option config [String] :workspace_name the name of the Terraform workspace. 27 | # @return [Kitchen::Terraform::Command::WorkspaceNew] 28 | def initialize(config:) 29 | self.workspace_name = config.fetch :workspace_name 30 | end 31 | 32 | # @return [String] the command. 33 | def to_s 34 | "workspace new #{workspace_name}" 35 | end 36 | 37 | private 38 | 39 | attr_accessor :workspace_name 40 | end 41 | end 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/command/workspace_select.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | module Kitchen 18 | module Terraform 19 | module Command 20 | # The workspace is selected by running a command like the following example: 21 | # terraform workspace select 22 | class WorkspaceSelect 23 | # #initialize prepares a new instance of the class. 24 | # 25 | # @param config [Hash] the configuration of the driver. 26 | # @option config [String] :workspace_name the name of the Terraform workspace. 27 | # @return [Kitchen::Terraform::Command::WorkspaceSelect] 28 | def initialize(config:) 29 | self.workspace_name = config.fetch :workspace_name 30 | end 31 | 32 | # @return [String] the command. 33 | def to_s 34 | "workspace select #{workspace_name}" 35 | end 36 | 37 | private 38 | 39 | attr_accessor :workspace_name 40 | end 41 | end 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/command_flag.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | module Kitchen 18 | module Terraform 19 | # CommandFlag is the namespace for command flags. 20 | module CommandFlag 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/command_flag/backend_config.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | module Kitchen 18 | module Terraform 19 | module CommandFlag 20 | # BackendConfig is the class of objects which control the arguments to the backend configuration. 21 | class BackendConfig 22 | # #initialize prepares a new instance of the class. 23 | # 24 | # @param arguments [Hash{String=>String}] the arguments. 25 | # @return [Kitchen::Terraform::CommandFlag::BackendConfig] 26 | def initialize(arguments:) 27 | self.arguments = arguments 28 | end 29 | 30 | # @return [String] the backend configuration flag. 31 | def to_s 32 | arguments.map do |key, value| 33 | "-backend-config=\"#{key}=#{value}\"" 34 | end.join " " 35 | end 36 | 37 | private 38 | 39 | attr_accessor :arguments 40 | end 41 | end 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/command_flag/color.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | module Kitchen 18 | module Terraform 19 | module CommandFlag 20 | # Color is the class of objects which control coloured output. 21 | class Color 22 | # #initialize prepares a new instance of the class. 23 | # 24 | # @param enabled [Boolean] a toggle to enable or disable color. 25 | # @return [Kitchen::Terraform::CommandFlag::Color] 26 | def initialize(enabled:) 27 | self.enabled = enabled 28 | end 29 | 30 | # @return [String] the color flag. 31 | def to_s 32 | if enabled 33 | "" 34 | else 35 | "-no-color" 36 | end 37 | end 38 | 39 | private 40 | 41 | attr_accessor :enabled 42 | end 43 | end 44 | end 45 | end 46 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/command_flag/lock_timeout.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | module Kitchen 18 | module Terraform 19 | module CommandFlag 20 | # LockTimeout is the class of objects which control the duration in which to retry the acquisition of the state 21 | # lock. 22 | class LockTimeout 23 | # #initialize prepares a new instance of the class. 24 | # 25 | # @param duration [Integer] the duration in seconds. 26 | # @return [Kitchen::Terraform::CommandFlag::LockTimeout] 27 | def initialize(duration:) 28 | self.duration = duration 29 | end 30 | 31 | # @return [String] the backend configuration flag. 32 | def to_s 33 | "-lock-timeout=#{duration}s" 34 | end 35 | 36 | private 37 | 38 | attr_accessor :duration 39 | end 40 | end 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/command_flag/plugin_dir.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "shellwords" 18 | 19 | module Kitchen 20 | module Terraform 21 | module CommandFlag 22 | # PluginDir is the class of objects which control the location of the directory which contains plugin binaries. 23 | class PluginDir 24 | # #initialize prepares a new instance of the class. 25 | # 26 | # @param pathname [String] the pathname of the directory. 27 | # @return [Kitchen::Terraform::CommandFlag::PluginDir] 28 | def initialize(pathname:) 29 | self.pathname = pathname.to_s 30 | end 31 | 32 | # @return [String] the plugin directory flag. 33 | def to_s 34 | if pathname.empty? 35 | "" 36 | else 37 | "-plugin-dir=\"#{::Shellwords.shelljoin ::Shellwords.shellsplit pathname}\"" 38 | end 39 | end 40 | 41 | private 42 | 43 | attr_accessor :pathname 44 | end 45 | end 46 | end 47 | end 48 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/command_flag/upgrade.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | module Kitchen 18 | module Terraform 19 | module CommandFlag 20 | # Upgrade is the class of objects which control the upgrade of existing modules and plugins. 21 | class Upgrade 22 | # #initialize prepares a new instance of the class. 23 | # 24 | # @param enabled [Boolean] a toggle to enable or disable the upgrade. 25 | # @return [Kitchen::Terraform::CommandFlag::Upgrade] 26 | def initialize(enabled:) 27 | self.enabled = enabled 28 | end 29 | 30 | # @return [String] the upgrade flag. 31 | def to_s 32 | if enabled 33 | "-upgrade=true" 34 | else 35 | "" 36 | end 37 | end 38 | 39 | private 40 | 41 | attr_accessor :enabled 42 | end 43 | end 44 | end 45 | end 46 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/command_flag/var.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | module Kitchen 18 | module Terraform 19 | module CommandFlag 20 | # Var is the class of objects which control the configuration variables. 21 | class Var 22 | # #initialize prepares a new instance of the class. 23 | # 24 | # @param arguments [Hash{String=>String}] the arguments. 25 | # @return [Kitchen::Terraform::CommandFlag::Var] 26 | def initialize(arguments:) 27 | self.arguments = arguments 28 | end 29 | 30 | # @return [String] the backend configuration flag. 31 | def to_s 32 | arguments.map do |key, value| 33 | "-var=\"#{key}=#{value}\"" 34 | end.join " " 35 | end 36 | 37 | private 38 | 39 | attr_accessor :arguments 40 | end 41 | end 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/command_flag/var_file.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "shellwords" 18 | 19 | module Kitchen 20 | module Terraform 21 | module CommandFlag 22 | # VarFile is the class of objects which control the locations of configuration variables files. 23 | class VarFile 24 | # #initialize prepares a new instance of the class. 25 | # 26 | # @param pathnames [Array[String]] the pathnames. 27 | # @return [Kitchen::Terraform::CommandFlag::VarFile] 28 | def initialize(pathnames:) 29 | self.pathnames = pathnames 30 | end 31 | 32 | # @return [String] the backend configuration flag. 33 | def to_s 34 | pathnames.map do |path| 35 | "-var-file=\"#{::Shellwords.shelljoin ::Shellwords.shellsplit path}\"" 36 | end.join " " 37 | end 38 | 39 | private 40 | 41 | attr_accessor :pathnames 42 | end 43 | end 44 | end 45 | end 46 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/config_attribute/command_timeout.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen/terraform/config_attribute" 18 | require "kitchen/terraform/config_attribute_type/integer" 19 | 20 | module Kitchen 21 | module Terraform 22 | class ConfigAttribute 23 | # This attribute controls the number of seconds that the plugin will wait for Terraform commands to finish 24 | # running. 25 | # 26 | # Type:: {http://www.yaml.org/spec/1.2/spec.html#id2803828 Integer} 27 | # Required:: False 28 | # Default:: +600+ 29 | # Example:: command_timeout: 1200 30 | module CommandTimeout 31 | ::Kitchen::Terraform::ConfigAttributeType::Integer.apply( 32 | attribute: :command_timeout, 33 | config_attribute: self, 34 | default_value: lambda do 35 | 600 36 | end, 37 | ) 38 | end 39 | end 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/config_attribute/fail_fast.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen" 18 | require "kitchen/terraform/config_attribute" 19 | require "kitchen/terraform/config_attribute_contract/boolean" 20 | 21 | module Kitchen 22 | module Terraform 23 | class ConfigAttribute 24 | # This attribute toggles fail fast behaviour when verifying systems. 25 | # 26 | # If fail fast behaviour is enabled then Kitchen will halt on the first error raised by a system during 27 | # verification; else errors raised by systems will be queued until all systems have attempted verification. 28 | # 29 | # Type:: {http://www.yaml.org/spec/1.2/spec.html#id2803629 Boolean} 30 | # Required:: False 31 | # Default:: true 32 | # Example:: fail_fast: false 33 | module FailFast 34 | ::Kitchen::Terraform::ConfigAttribute.new( 35 | attribute: :fail_fast, 36 | default_value: lambda do 37 | true 38 | end, 39 | schema: ::Kitchen::Terraform::ConfigAttributeContract::Boolean.new, 40 | ).apply config_attribute: self 41 | end 42 | end 43 | end 44 | end 45 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/config_attribute/lock.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen" 18 | require "kitchen/terraform/config_attribute" 19 | require "kitchen/terraform/config_attribute_contract/boolean" 20 | 21 | module Kitchen 22 | module Terraform 23 | class ConfigAttribute 24 | # This attribute toggles {https://www.terraform.io/docs/state/locking.html locking of the Terraform state file}. 25 | # 26 | # Type:: {http://www.yaml.org/spec/1.2/spec.html#id2803629 Boolean} 27 | # Required:: False 28 | # Default:: +true+ 29 | # Example:: lock: false 30 | module Lock 31 | ::Kitchen::Terraform::ConfigAttribute.new( 32 | attribute: :lock, 33 | default_value: lambda do 34 | true 35 | end, 36 | schema: ::Kitchen::Terraform::ConfigAttributeContract::Boolean.new, 37 | ).apply config_attribute: self 38 | end 39 | end 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/config_attribute/lock_timeout.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen/terraform/config_attribute" 18 | require "kitchen/terraform/config_attribute_type/integer" 19 | 20 | module Kitchen 21 | module Terraform 22 | class ConfigAttribute 23 | # This attribute controls the number of seconds that Terraform will wait for a lock on the state to be obtained 24 | # during {https://www.terraform.io/docs/state/locking.html operations related to state}. 25 | # 26 | # Type:: {http://www.yaml.org/spec/1.2/spec.html#id2803828 Integer} 27 | # Required:: False 28 | # Default:: +0+ 29 | # Example:: lock_timeout: 10 30 | module LockTimeout 31 | ::Kitchen::Terraform::ConfigAttributeType::Integer.apply( 32 | attribute: :lock_timeout, 33 | config_attribute: self, 34 | default_value: lambda do 35 | 0 36 | end, 37 | ) 38 | end 39 | end 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/config_attribute/parallelism.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen/terraform/config_attribute" 18 | require "kitchen/terraform/config_attribute_type/integer" 19 | 20 | module Kitchen 21 | module Terraform 22 | class ConfigAttribute 23 | # This attribute controls the number of concurrent operations to use while Terraform 24 | # {https://www.terraform.io/docs/internals/graph.html#walking-the-graph walks the resource graph}. 25 | # 26 | # Type:: {http://www.yaml.org/spec/1.2/spec.html#id2803828 Integer} 27 | # Required:: False 28 | # Default:: +10+ 29 | # Example:: parallelism: 50 30 | module Parallelism 31 | ::Kitchen::Terraform::ConfigAttributeType::Integer.apply( 32 | attribute: :parallelism, 33 | config_attribute: self, 34 | default_value: lambda do 35 | 10 36 | end, 37 | ) 38 | end 39 | end 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/config_attribute/variables.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen/terraform/config_attribute" 18 | require "kitchen/terraform/config_attribute_type/hash_of_symbols_and_strings" 19 | 20 | module Kitchen 21 | module Terraform 22 | class ConfigAttribute 23 | # This attribute comprises {https://www.terraform.io/docs/configuration/variables.html Terraform variables}. 24 | # 25 | # Type:: {http://www.yaml.org/spec/1.2/spec.html#id2760142 Mapping of scalars to scalars} 26 | # Required:: False 27 | # Example:: 28 | # _ 29 | # variables: 30 | # image: image-1234 31 | # zone: zone-5 32 | module Variables 33 | ::Kitchen::Terraform::ConfigAttributeType::HashOfSymbolsAndStrings.apply( 34 | attribute: :variables, 35 | config_attribute: self, 36 | default_value: lambda do 37 | {} 38 | end, 39 | ) 40 | end 41 | end 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/config_attribute/verify_version.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen" 18 | require "kitchen/terraform/config_attribute" 19 | require "kitchen/terraform/config_attribute_contract/boolean" 20 | 21 | module Kitchen 22 | module Terraform 23 | class ConfigAttribute 24 | # This attribute toggles strict or permissive verification of support for the version of the Terraform client specified by the 25 | # client attribute. 26 | # 27 | # Type:: {http://www.yaml.org/spec/1.2/spec.html#id2803629 Boolean} 28 | # Required:: False 29 | # Default:: true 30 | # Example:: verify_version: false 31 | module VerifyVersion 32 | ::Kitchen::Terraform::ConfigAttribute.new( 33 | attribute: :verify_version, 34 | default_value: lambda do 35 | true 36 | end, 37 | schema: ::Kitchen::Terraform::ConfigAttributeContract::Boolean.new, 38 | ).apply config_attribute: self 39 | end 40 | end 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/config_attribute_contract.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | module Kitchen 18 | module Terraform 19 | # ConfigAttributeContract is the namespace for configuration attribute contracts. 20 | module ConfigAttributeContract 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/config_attribute_contract/array_of_strings.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "dry/validation" 18 | 19 | module Kitchen 20 | module Terraform 21 | module ConfigAttributeContract 22 | # ArrayOfStrings is the class of objects that provide a configuration attribute contract for an array of strings. 23 | class ArrayOfStrings < ::Dry::Validation::Contract 24 | schema do 25 | required(:value).array :filled?, :str? 26 | end 27 | end 28 | end 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/config_attribute_contract/boolean.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "dry/validation" 18 | 19 | module Kitchen 20 | module Terraform 21 | module ConfigAttributeContract 22 | # Boolean is the class of objects that provide a configuration attribute contract for a boolean. 23 | class Boolean < ::Dry::Validation::Contract 24 | schema do 25 | required(:value).filled :bool? 26 | end 27 | end 28 | end 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/config_attribute_contract/hash_of_symbols_and_strings.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "dry/validation" 18 | 19 | module Kitchen 20 | module Terraform 21 | module ConfigAttributeContract 22 | # HashOfSymbolsAndStrings is the class of objects that provide a configuration attribute contract for a hash 23 | # including only symbol keys and string values. 24 | class HashOfSymbolsAndStrings < ::Dry::Validation::Contract 25 | schema do 26 | required(:value).hash 27 | end 28 | 29 | rule :value do 30 | value.each_pair do |symbol, string| 31 | if ::Symbol != symbol.class 32 | key.failure "the key of the key-value pair '#{symbol} => #{string}' must be a scalar" 33 | elsif ::String != string.class 34 | key.failure "the value of the key-value pair '#{symbol} => #{string}' must be a scalar" 35 | end 36 | end 37 | end 38 | end 39 | end 40 | end 41 | end 42 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/config_attribute_contract/integer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "dry/validation" 18 | 19 | module Kitchen 20 | module Terraform 21 | module ConfigAttributeContract 22 | # Integer is the class of objects that provide a configuration attribute contract for an integer. 23 | class Integer < ::Dry::Validation::Contract 24 | schema do 25 | required(:value).value :int? 26 | end 27 | end 28 | end 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/config_attribute_contract/optional_string.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "dry/validation" 18 | 19 | module Kitchen 20 | module Terraform 21 | module ConfigAttributeContract 22 | # OptionalString is the class of objects that provide a configuration attribute contract for an optional string. 23 | class OptionalString < ::Dry::Validation::Contract 24 | schema do 25 | required(:value).maybe :filled?, :str? 26 | end 27 | end 28 | end 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/config_attribute_contract/string.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "dry/validation" 18 | 19 | module Kitchen 20 | module Terraform 21 | module ConfigAttributeContract 22 | # String is the class of objects that provide a configuration attribute contract for a string. 23 | class String < ::Dry::Validation::Contract 24 | schema do 25 | required(:value).filled :str? 26 | end 27 | end 28 | end 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/config_attribute_type.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | module Kitchen 18 | module Terraform 19 | # The namespace for configuration attribute types. 20 | module ConfigAttributeType 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/debug_logger.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "delegate" 18 | 19 | module Kitchen 20 | module Terraform 21 | # This class delegates to a logger but ensures the debug level is the default level used for logging messages. 22 | class DebugLogger < ::SimpleDelegator 23 | class << self 24 | # .new creates a new instance of the class. 25 | # 26 | # @return [Kitchen::Terraform::DebugLogger] 27 | def new(obj) 28 | if !obj.kind_of? ::Kitchen::Logger 29 | raise ::TypeError, "delegate must be a Kitchen::Logger; recevied #{obj.class}" 30 | end 31 | 32 | super 33 | end 34 | end 35 | 36 | # This method overrides the #<< method of the delegate to call #debug. 37 | # 38 | # @param message [#to_s] the message to be logged. 39 | # @return [nil, true] if the given severity is high enough for this particular logger then return 40 | # nil; else return true. 41 | def <<(message) 42 | debug message 43 | end 44 | end 45 | end 46 | end 47 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/deprecating.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | module Kitchen 18 | module Terraform 19 | # The namespace for objects with deprecating changes. 20 | module Deprecating 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/driver.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | module Kitchen 18 | module Terraform 19 | # Driver is the namespace for driver strategies. 20 | module Driver 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/error.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | module Kitchen 18 | module Terraform 19 | # Error is the class of objects which are raised Kitchen-Terraform experiences an error. 20 | class Error < ::StandardError 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/inspec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | module Kitchen 18 | module Terraform 19 | # InSpec is the namespace for the classes of objects which execute InSpec. 20 | module InSpec 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/outputs_parser.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "json" 18 | require "kitchen" 19 | 20 | module Kitchen 21 | module Terraform 22 | # OutputsParser parses Terraform output variables as JSON. 23 | class OutputsParser 24 | # #parse parses the outputs. 25 | # 26 | # @param json_outputs [String] the output variables as a string of JSON. 27 | # @raise [Kitchen::TransientFailure] if parsing the output variables fails. 28 | # @yieldparam parsed_outputs [Hash] the output variables as a hash. 29 | # @return [self] 30 | def parse(json_outputs:) 31 | yield parsed_outputs: ::JSON.parse(json_outputs) 32 | 33 | self 34 | rescue ::JSON::ParserError 35 | raise ::Kitchen::TransientFailure, "Parsing the Terraform output variables as JSON failed." 36 | end 37 | end 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/provisioner.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | module Kitchen 18 | module Terraform 19 | # Provisioner is the namespace for provisioner strategies. 20 | module Provisioner 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/raise.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | module Kitchen 18 | module Terraform 19 | # Raise is the namespace for objects which raise errors. 20 | module Raise 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/raise/action_failed.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen" 18 | 19 | module Kitchen 20 | module Terraform 21 | module Raise 22 | # ActionFailed is the class of objects which handle errors resulting in failed actions. 23 | class ActionFailed 24 | # #call logs an error message and raises an error with the message. 25 | # 26 | # @param message [String] the error message. 27 | # @raise [Kitchen::ActionFailed] 28 | # @return [void] 29 | def call(message:) 30 | logger.error message 31 | 32 | raise ::Kitchen::ActionFailed, message 33 | end 34 | 35 | # #initialize prepares a new instance of the class. 36 | # 37 | # @param logger [Kitchen::Logger] a logger to log messages. 38 | # @return [Kitchen::Terraform::ActionFailed] 39 | def initialize(logger:) 40 | self.logger = logger 41 | end 42 | 43 | private 44 | 45 | attr_accessor :logger 46 | end 47 | end 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/raise/client_error.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen" 18 | 19 | module Kitchen 20 | module Terraform 21 | module Raise 22 | # ClientError is the class of objects which handle errors that are caused by incorrect use of an API. 23 | class ClientError 24 | # #call logs an error message and raises an error with the message. 25 | # 26 | # @param message [String] the error message. 27 | # @raise [Kitchen::ClientError] 28 | # @return [void] 29 | def call(message:) 30 | logger.error message 31 | 32 | raise ::Kitchen::ClientError, message 33 | end 34 | 35 | # #initialize prepares a new instance of the class. 36 | # 37 | # @param logger [Kitchen::Logger] a logger to log messages. 38 | # @return [Kitchen::Terraform::ClientError] 39 | def initialize(logger:) 40 | self.logger = logger 41 | end 42 | 43 | private 44 | 45 | attr_accessor :logger 46 | end 47 | end 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/system_attrs_inputs_resolver.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen" 18 | 19 | module Kitchen 20 | module Terraform 21 | # SystemAttrsInputsResolver is the class of objects which resolve for systems the attributes derived from Terraform 22 | # variables. 23 | class SystemAttrsInputsResolver 24 | # #initialize prepares a new instance of the class. 25 | # 26 | # @param attrs [Hash] a container for attributes. 27 | # @return [Kitchen::Terraform::SystemAttrsInputsResolver] 28 | def initialize(attrs:) 29 | self.attrs = attrs 30 | end 31 | 32 | # #resolve stores the inputs as attributes. 33 | # 34 | # @param inputs [Hash{String=>String}] the variables to be stored as inputs. 35 | # @return self 36 | def resolve(inputs:) 37 | inputs.each_pair do |input_name, input_value| 38 | attrs.store "input_#{input_name}", input_value 39 | end 40 | 41 | self 42 | end 43 | 44 | private 45 | 46 | attr_accessor :attrs 47 | end 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/system_inspec_map.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | module Kitchen 18 | module Terraform 19 | # SYSTEM_INSPEC_MAP is a mapping of system configuration attribute keys to InSpec option keys. 20 | SYSTEM_INSPEC_MAP = { 21 | attrs: :input_file, 22 | backend_cache: :backend_cache, 23 | backend: :backend, 24 | bastion_port: :bastion_port, 25 | bastion_user: :bastion_user, 26 | color: "color", 27 | controls: :controls, 28 | enable_password: :enable_password, 29 | key_files: :key_files, 30 | password: :password, 31 | path: :path, 32 | port: :port, 33 | proxy_command: :proxy_command, 34 | reporter: "reporter", 35 | self_signed: :self_signed, 36 | shell_command: :shell_command, 37 | shell_options: :shell_options, 38 | shell: :shell, 39 | show_progress: :show_progress, 40 | ssl: :ssl, 41 | sudo_command: :sudo_command, 42 | sudo_options: :sudo_options, 43 | sudo_password: :sudo_password, 44 | sudo: :sudo, 45 | user: :user, 46 | vendor_cache: :vendor_cache, 47 | } 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/systems_verifier.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | module Kitchen 18 | module Terraform 19 | # SystemsVerifier is the namespace of the classes of objects which verify systems. 20 | module SystemsVerifier 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/transport.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | module Kitchen 18 | module Terraform 19 | # Transport is the namespace for transport strategies. 20 | module Transport 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/unsupported_client_version_error.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen/terraform/error" 18 | 19 | module Kitchen 20 | module Terraform 21 | # UnsupportedClientVersionError is the class of objects which are raised when the Terraform client version is 22 | # unsupported. 23 | class UnsupportedClientVersionError < ::Kitchen::Terraform::Error 24 | end 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/verifier.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | module Kitchen 18 | module Terraform 19 | # Verifier is the namespace for verifier strategies. 20 | module Verifier 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/verify_version_rescue_strategy.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | module Kitchen 18 | module Terraform 19 | # VerifyVersionRescueStrategy is the namespace for rescue strategies of instances of VerifyVersion. 20 | module VerifyVersionRescueStrategy 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/verify_version_rescue_strategy/permissive.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen" 18 | 19 | module Kitchen 20 | module Terraform 21 | module VerifyVersionRescueStrategy 22 | # Permissive is the class of objects which provide a permissive rescue strategy to handle a failure to verify the 23 | # Terraform client version. 24 | class Permissive 25 | # #call warns the user that the version is unsupported. 26 | # 27 | # @return [self] 28 | def call 29 | logger.warn message 30 | 31 | self 32 | end 33 | 34 | # #initialize prepares a new instance of the class. 35 | # 36 | # @param logger [Kitchen::Logger] a logger to log messages. 37 | # @return [Kitchen::Terraform::VerifyVersionRescueStrategy::Permissive] 38 | def initialize(logger:) 39 | self.logger = logger 40 | self.message = "Verifying the Terraform client version failed. Set `driver.verify_version: true` to " \ 41 | "upgrade this warning to an error." 42 | end 43 | 44 | private 45 | 46 | attr_accessor :logger, :message 47 | end 48 | end 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/verify_version_rescue_strategy/strict.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen/terraform/unsupported_client_version_error" 18 | 19 | module Kitchen 20 | module Terraform 21 | module VerifyVersionRescueStrategy 22 | # Strict is the class of objects which provide a strict strategy rescue strategy to handle a failure to verify the 23 | # Terraform client version. 24 | class Strict 25 | # #call raises an error. 26 | # 27 | # @raise [Kitchen::Terraform::UnsupportedClientVersionError] 28 | # @return [void] 29 | def call 30 | raise ::Kitchen::Terraform::UnsupportedClientVersionError, message 31 | end 32 | 33 | # #initialize prepares a new instance of the class. 34 | # 35 | # @return [Kitchen::Terraform::VerifyVersionRescueStrategy::Permissive] 36 | def initialize 37 | self.message = "Verifying the Terraform client version failed. Set `driver.verify_version: false` to " \ 38 | "downgrade this error to a warning." 39 | end 40 | 41 | private 42 | 43 | attr_accessor :message 44 | end 45 | end 46 | end 47 | end 48 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/version_verifier_strategy.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen" 18 | 19 | module Kitchen 20 | module Terraform 21 | # VersionVerifierStrategy is the module of objects which provide strategies for version verification. 22 | module VersionVerifierStrategy 23 | end 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/version_verifier_strategy/supported.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen" 18 | 19 | module Kitchen 20 | module Terraform 21 | module VersionVerifierStrategy 22 | # Supported is the class of objects which provide a strategy for supported Terraform client versions. 23 | class Supported 24 | # #call takes no action. 25 | # 26 | # @return [self] 27 | def call 28 | self 29 | end 30 | end 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /lib/kitchen/terraform/version_verifier_strategy/unsupported.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen/terraform/unsupported_client_version_error" 18 | 19 | module Kitchen 20 | module Terraform 21 | module VersionVerifierStrategy 22 | # Unsupported is the class of objects which provide a strategy for unsupported Terraform client versions. 23 | class Unsupported 24 | # #call fails the verification. 25 | # 26 | # @raise [Kitchen::Terraform::UnsupportedClientVersionError] 27 | # @return [void] 28 | def call 29 | raise ::Kitchen::Terraform::UnsupportedClientVersionError, "The Terraform client version is unsupported." 30 | end 31 | end 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /rubygems/credentials.gpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newcontext-oss/kitchen-terraform/e23570368e3f004edbca8149840df3f23154fcd6/rubygems/credentials.gpg -------------------------------------------------------------------------------- /source/about.html.erb: -------------------------------------------------------------------------------- 1 | --- 2 | title: About Kitchen-Terraform 3 | --- 4 | 5 |
6 |
7 |
8 |
9 |

10 | About Kitchen-Terraform 11 |

12 |

13 | Kitchen Terraform brings the benefits of test-driven development to Terraform projects. 14 |

15 |

16 | As use of Terraform continues to gain popularity in production environments, it is critical that this logic is thoroughly tested. Development cycle can now be driven by a suite of tests to verify new features and protect against regressions. 17 |

18 |
19 |

20 | Using Kitchen Terraform enables a test matrix that can vary in platforms, input variables and even fixture modules. 21 |

22 |

23 | Kitchen Terraform provides a consistent approach for testing Terraform projects locally and in continuous integration pipelines. 24 |

25 |
26 |
27 |
28 |
29 | -------------------------------------------------------------------------------- /source/browserconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | #ffffff 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /source/community/index.html.erb: -------------------------------------------------------------------------------- 1 | --- 2 | title: Community Resources for Kitchen-Terraform 3 | --- 4 | 5 |
6 |
7 |
8 |
9 |

10 | Community 11 |

12 |

13 | Contribute, report bugs and submit new features at our Github Page 14 |

15 |

16 | Check out Kitchen-Terraform on GitHub Actions 17 |

18 |

19 | Find Kitchen-Terraform on rubygems.org 20 |

21 |

22 | Thank you to everyone that has impacted this project, especially our contributors!! 23 |

24 |
25 |

26 | Anything else? Feel free to email us directly: kitchen-terraform@newcontext.com 27 |

28 |
29 |
30 |
31 |
32 | -------------------------------------------------------------------------------- /source/images/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newcontext-oss/kitchen-terraform/e23570368e3f004edbca8149840df3f23154fcd6/source/images/.keep -------------------------------------------------------------------------------- /source/images/copado_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newcontext-oss/kitchen-terraform/e23570368e3f004edbca8149840df3f23154fcd6/source/images/copado_logo.png -------------------------------------------------------------------------------- /source/images/github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newcontext-oss/kitchen-terraform/e23570368e3f004edbca8149840df3f23154fcd6/source/images/github.png -------------------------------------------------------------------------------- /source/images/kitchen_terraform_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/newcontext-oss/kitchen-terraform/e23570368e3f004edbca8149840df3f23154fcd6/source/images/kitchen_terraform_logo.png -------------------------------------------------------------------------------- /source/javascripts/site.js: -------------------------------------------------------------------------------- 1 | // This is where it all goes :) 2 | -------------------------------------------------------------------------------- /source/stylesheets/highlighting.css.scss.erb: -------------------------------------------------------------------------------- 1 | <%= Rouge::Themes::Base16::Monokai.render(:scope => ".syntax-highlight") %> 2 | -------------------------------------------------------------------------------- /spec/lib/kitchen/terraform/command/get_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen/terraform/command/get" 18 | 19 | ::RSpec.describe ::Kitchen::Terraform::Command::Get do 20 | subject do 21 | described_class.new 22 | end 23 | 24 | describe "#to_s" do 25 | specify "should return the command with flags" do 26 | expect(subject.to_s).to eq "get -update" 27 | end 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /spec/lib/kitchen/terraform/command/output_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen/terraform/command/output" 18 | 19 | ::RSpec.describe ::Kitchen::Terraform::Command::Output do 20 | subject do 21 | described_class.new 22 | end 23 | 24 | describe "#to_s" do 25 | specify "should return the command with flags" do 26 | expect(subject.to_s).to eq "output -json" 27 | end 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /spec/lib/kitchen/terraform/command/validate/post_zero_fifteen_zero_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen/terraform/command/validate/post_zero_fifteen_zero" 18 | 19 | ::RSpec.describe ::Kitchen::Terraform::Command::Validate::PostZeroFifteenZero do 20 | subject do 21 | described_class.new config: config 22 | end 23 | 24 | let :config do 25 | { 26 | color: false, 27 | } 28 | end 29 | 30 | describe "#to_s" do 31 | specify "should return the command with flags" do 32 | # -var and -var-file are included for compatibility with Terraform 0.11 33 | expect(subject.to_s).to eq "validate -no-color" 34 | end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /spec/lib/kitchen/terraform/command/validate/pre_zero_fifteen_zero_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen/terraform/command/validate/pre_zero_fifteen_zero" 18 | 19 | ::RSpec.describe ::Kitchen::Terraform::Command::Validate::PreZeroFifteenZero do 20 | subject do 21 | described_class.new config: config 22 | end 23 | 24 | let :config do 25 | { 26 | color: false, 27 | variable_files: ["/one.tfvars", "/two.tfvars"], 28 | variables: { 29 | string: "\\\"A String\\\"", 30 | map: "{ key = \\\"A Value\\\" }", 31 | list: "[ \\\"Element One\\\", \\\"Element Two\\\" ]", 32 | }, 33 | } 34 | end 35 | 36 | describe "#to_s" do 37 | specify "should return the command with flags" do 38 | # -var and -var-file are included for compatibility with Terraform 0.11 39 | expect(subject.to_s).to eq( 40 | "validate " \ 41 | "-no-color " \ 42 | "-var=\"string=\\\"A String\\\"\" " \ 43 | "-var=\"map={ key = \\\"A Value\\\" }\" " \ 44 | "-var=\"list=[ \\\"Element One\\\", \\\"Element Two\\\" ]\" " \ 45 | "-var-file=\"/one.tfvars\" " \ 46 | "-var-file=\"/two.tfvars\"" 47 | ) 48 | end 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /spec/lib/kitchen/terraform/command/version_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen/terraform/command/version" 18 | 19 | ::RSpec.describe ::Kitchen::Terraform::Command::Version do 20 | subject do 21 | described_class.new 22 | end 23 | 24 | describe "#to_s" do 25 | specify "should return the command" do 26 | expect(subject.to_s).to eq "version" 27 | end 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /spec/lib/kitchen/terraform/command/workspace_delete_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen/terraform/command/workspace_delete" 18 | 19 | ::RSpec.describe ::Kitchen::Terraform::Command::WorkspaceDelete do 20 | subject do 21 | described_class.new config: config 22 | end 23 | 24 | let :config do 25 | { workspace_name: "test" } 26 | end 27 | 28 | describe "#to_s" do 29 | specify "should return the command" do 30 | expect(subject.to_s).to eq "workspace delete test" 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /spec/lib/kitchen/terraform/command/workspace_new_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen/terraform/command/workspace_new" 18 | 19 | ::RSpec.describe ::Kitchen::Terraform::Command::WorkspaceNew do 20 | describe "#to_s" do 21 | subject do 22 | described_class.new config: config 23 | end 24 | 25 | let :config do 26 | { root_module_directory: "/root-module", workspace_name: "test" } 27 | end 28 | 29 | specify "should return the command" do 30 | expect(subject.to_s).to eq "workspace new test" 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /spec/lib/kitchen/terraform/command/workspace_select_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen/terraform/command/workspace_select" 18 | 19 | ::RSpec.describe ::Kitchen::Terraform::Command::WorkspaceSelect do 20 | subject do 21 | described_class.new config: config 22 | end 23 | 24 | let :config do 25 | { workspace_name: "test" } 26 | end 27 | 28 | describe "#to_s" do 29 | specify "should return the command" do 30 | expect(subject.to_s).to eq "workspace select test" 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /spec/lib/kitchen/terraform/command_flag/backend_config_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen/terraform/command_flag/backend_config" 18 | 19 | ::RSpec.describe ::Kitchen::Terraform::CommandFlag::BackendConfig do 20 | subject do 21 | described_class.new arguments: arguments 22 | end 23 | 24 | describe "#to_s" do 25 | let :arguments do 26 | { key_one: "value one", key_two: "value two" } 27 | end 28 | 29 | specify "should return -backend-config for each argument" do 30 | expect(subject.to_s).to eq "-backend-config=\"key_one=value one\" -backend-config=\"key_two=value two\"" 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /spec/lib/kitchen/terraform/command_flag/color_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen/terraform/command_flag/color" 18 | 19 | ::RSpec.describe ::Kitchen::Terraform::CommandFlag::Color do 20 | subject do 21 | described_class.new enabled: enabled 22 | end 23 | 24 | describe "#to_s" do 25 | context "when color is enabled" do 26 | let :enabled do 27 | true 28 | end 29 | 30 | specify "should return an empty string" do 31 | expect(subject.to_s).to eq "" 32 | end 33 | end 34 | 35 | context "when color is disabled" do 36 | let :enabled do 37 | false 38 | end 39 | 40 | specify "should return -no-color" do 41 | expect(subject.to_s).to eq "-no-color" 42 | end 43 | end 44 | end 45 | end 46 | -------------------------------------------------------------------------------- /spec/lib/kitchen/terraform/command_flag/lock_timeout_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen/terraform/command_flag/lock_timeout" 18 | 19 | ::RSpec.describe ::Kitchen::Terraform::CommandFlag::LockTimeout do 20 | subject do 21 | described_class.new duration: duration 22 | end 23 | 24 | describe "#to_s" do 25 | let :duration do 26 | 123 27 | end 28 | 29 | specify "should return -lock-timeout with the duration and a unit of seconds" do 30 | expect(subject.to_s).to eq "-lock-timeout=123s" 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /spec/lib/kitchen/terraform/command_flag/plugin_dir_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen/terraform/command_flag/plugin_dir" 18 | 19 | ::RSpec.describe ::Kitchen::Terraform::CommandFlag::PluginDir do 20 | subject do 21 | described_class.new pathname: pathname 22 | end 23 | 24 | describe "#to_s" do 25 | context "when pathname is empty" do 26 | let :pathname do 27 | "" 28 | end 29 | 30 | specify "should return an empty string" do 31 | expect(subject.to_s).to eq "" 32 | end 33 | end 34 | 35 | context "when pathname is not empty" do 36 | let :pathname do 37 | "/plugins" 38 | end 39 | 40 | specify "should return -plugin-dir with the pathname" do 41 | expect(subject.to_s).to eq "-plugin-dir=\"/plugins\"" 42 | end 43 | end 44 | end 45 | end 46 | -------------------------------------------------------------------------------- /spec/lib/kitchen/terraform/command_flag/upgrade_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen/terraform/command_flag/upgrade" 18 | 19 | ::RSpec.describe ::Kitchen::Terraform::CommandFlag::Upgrade do 20 | subject do 21 | described_class.new enabled: enabled 22 | end 23 | 24 | describe "#to_s" do 25 | context "when upgrade is enabled" do 26 | let :enabled do 27 | true 28 | end 29 | 30 | specify "should return -upgrade=true" do 31 | expect(subject.to_s).to eq "-upgrade=true" 32 | end 33 | end 34 | 35 | context "when upgrade is disabled" do 36 | let :enabled do 37 | false 38 | end 39 | 40 | specify "should return an empty string" do 41 | expect(subject.to_s).to eq "" 42 | end 43 | end 44 | end 45 | end 46 | -------------------------------------------------------------------------------- /spec/lib/kitchen/terraform/command_flag/var_file_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen/terraform/command_flag/var_file" 18 | 19 | ::RSpec.describe ::Kitchen::Terraform::CommandFlag::VarFile do 20 | subject do 21 | described_class.new pathnames: pathnames 22 | end 23 | 24 | describe "#to_s" do 25 | let :pathnames do 26 | ["/one.tfvars", "/two.tfvars"] 27 | end 28 | 29 | specify "should return -var-file for each argument" do 30 | expect(subject.to_s).to eq "-var-file=\"/one.tfvars\" -var-file=\"/two.tfvars\"" 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /spec/lib/kitchen/terraform/command_flag/var_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen/terraform/command_flag/var" 18 | 19 | ::RSpec.describe ::Kitchen::Terraform::CommandFlag::Var do 20 | subject do 21 | described_class.new arguments: arguments 22 | end 23 | 24 | describe "#to_s" do 25 | let :arguments do 26 | { key_one: "value one", key_two: "value two" } 27 | end 28 | 29 | specify "should return -var for each argument" do 30 | expect(subject.to_s).to eq "-var=\"key_one=value one\" -var=\"key_two=value two\"" 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /spec/lib/kitchen/terraform/config_attribute_contract/array_of_strings_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen/terraform/config_attribute_contract/array_of_strings" 18 | 19 | ::RSpec.describe ::Kitchen::Terraform::ConfigAttributeContract::ArrayOfStrings do 20 | describe "#call" do 21 | specify "should fail for a value that is not an array" do 22 | expect(subject.call(value: 123).errors.to_h).to include value: ["must be an array"] 23 | end 24 | 25 | specify "should pass for a value that an empty array" do 26 | expect(subject.call(value: []).errors.to_h).to be_empty 27 | end 28 | 29 | specify "should fail for a value that is an array with non-string elements" do 30 | expect(subject.call(value: [123]).errors.to_h.fetch(:value)).to include 0 => ["must be a string"] 31 | end 32 | 33 | specify "should pass for a value that is an array of strings" do 34 | expect(subject.call(value: ["abc"]).errors.to_h).to be_empty 35 | end 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /spec/lib/kitchen/terraform/config_attribute_contract/boolean_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen/terraform/config_attribute_contract/boolean" 18 | 19 | ::RSpec.describe ::Kitchen::Terraform::ConfigAttributeContract::Boolean do 20 | describe "#call" do 21 | specify "should fail for a value that is not boolean" do 22 | expect(subject.call(value: "abc").errors.to_h).to include value: ["must be boolean"] 23 | end 24 | 25 | specify "should pass for a value that is boolean" do 26 | expect(subject.call(value: true).errors.to_h).to be_empty 27 | end 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /spec/lib/kitchen/terraform/config_attribute_contract/integer_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen/terraform/config_attribute_contract/integer" 18 | 19 | ::RSpec.describe ::Kitchen::Terraform::ConfigAttributeContract::Integer do 20 | describe "#call" do 21 | specify "should fail for a value that is not an integer" do 22 | expect(subject.call(value: "abc").errors.to_h).to include value: ["must be an integer"] 23 | end 24 | 25 | specify "should pass for a value that is an integer" do 26 | expect(subject.call(value: 123).errors.to_h).to be_empty 27 | end 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /spec/lib/kitchen/terraform/config_attribute_contract/optional_string_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen/terraform/config_attribute_contract/optional_string" 18 | 19 | ::RSpec.describe ::Kitchen::Terraform::ConfigAttributeContract::OptionalString do 20 | describe "#call" do 21 | specify "should fail for a value that is not a string" do 22 | expect(subject.call(value: 123).errors.to_h).to include value: ["must be a string"] 23 | end 24 | 25 | specify "should pass for a value that is a string" do 26 | expect(subject.call(value: "abc").errors.to_h).to be_empty 27 | end 28 | 29 | specify "should pass for a value that is nil" do 30 | expect(subject.call(value: nil).errors.to_h).to be_empty 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /spec/lib/kitchen/terraform/config_attribute_contract/string_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen/terraform/config_attribute_contract/string" 18 | 19 | ::RSpec.describe ::Kitchen::Terraform::ConfigAttributeContract::String do 20 | describe "#call" do 21 | specify "should fail for a value that is not a string" do 22 | expect(subject.call(value: 123).errors.to_h).to include value: ["must be a string"] 23 | end 24 | 25 | specify "should pass for a value that is a string" do 26 | expect(subject.call(value: "abc").errors.to_h).to be_empty 27 | end 28 | end 29 | end 30 | -------------------------------------------------------------------------------- /spec/lib/kitchen/terraform/debug_logger_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen" 18 | require "kitchen/terraform/debug_logger" 19 | require "support/kitchen/logger_context" 20 | 21 | ::RSpec.describe ::Kitchen::Terraform::DebugLogger do 22 | describe ".new" do 23 | specify "raises an error if the delegate is not a Kitchen::Logger" do 24 | expect do 25 | described_class.new ::Object.new 26 | end.to raise_error ::TypeError 27 | end 28 | end 29 | 30 | subject do 31 | described_class.new ::Kitchen.logger 32 | end 33 | 34 | include_context "Kitchen::Logger" 35 | 36 | shared_examples "#debug" do 37 | after do 38 | subject << "message" 39 | end 40 | 41 | specify "forwards the message to #debug of the wrapped logger" do 42 | expect(::Kitchen.logger).to receive(:debug).with "message" 43 | end 44 | end 45 | 46 | describe "#<< " do 47 | it_behaves_like "#debug" 48 | end 49 | 50 | describe "#debug" do 51 | it_behaves_like "#debug" 52 | end 53 | end 54 | -------------------------------------------------------------------------------- /spec/lib/kitchen/terraform/inspec/without_hosts_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen/terraform/inspec/without_hosts" 18 | require "kitchen/terraform/inspec_runner" 19 | 20 | ::RSpec.describe ::Kitchen::Terraform::InSpec::WithoutHosts do 21 | subject do 22 | described_class.new options: options, profile_locations: profile_locations 23 | end 24 | 25 | let :options do 26 | { key: "value" } 27 | end 28 | 29 | let :profile_locations do 30 | [] 31 | end 32 | 33 | describe "#exec" do 34 | let :inspec_runner do 35 | instance_double ::Kitchen::Terraform::InSpecRunner 36 | end 37 | 38 | before do 39 | allow(::Kitchen::Terraform::InSpecRunner).to receive(:new).with( 40 | options: options, 41 | profile_locations: profile_locations, 42 | ).and_return inspec_runner 43 | end 44 | 45 | specify "should run InSpec" do 46 | expect(inspec_runner).to receive :exec 47 | end 48 | 49 | after do 50 | subject.exec 51 | end 52 | end 53 | end 54 | -------------------------------------------------------------------------------- /spec/lib/kitchen/terraform/outputs_manager_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen/terraform/outputs_manager" 18 | 19 | ::RSpec.describe ::Kitchen::Terraform::OutputsManager do 20 | subject do 21 | described_class.new 22 | end 23 | 24 | describe "#load" do 25 | let :outputs do 26 | {} 27 | end 28 | 29 | context "when the Kitchen instance state does not include the key 'kitchen-terraform.output-values'" do 30 | specify "it should raise a Kitchen::ClientError" do 31 | expect do 32 | subject.load outputs: outputs, state: {} 33 | end.to raise_error ::Kitchen::ClientError 34 | end 35 | end 36 | 37 | context "when the Kitchen instance state does include the key 'kitchen-terraform.output-values'" do 38 | before do 39 | subject.load( 40 | outputs: outputs, 41 | state: { kitchen_terraform_outputs: { "key" => "value" } }, 42 | ) 43 | end 44 | 45 | specify "it should load the outputs" do 46 | expect(outputs).to eq "key" => "value" 47 | end 48 | end 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /spec/lib/kitchen/terraform/outputs_parser_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen" 18 | require "kitchen/terraform/outputs_parser" 19 | 20 | ::RSpec.describe ::Kitchen::Terraform::OutputsParser do 21 | subject do 22 | described_class.new 23 | end 24 | 25 | describe "#parse" do 26 | context "when the outputs are not valid JSON" do 27 | specify "should raise a transient failure error" do 28 | expect do 29 | subject.parse json_outputs: "invalid" 30 | end.to raise_error ::Kitchen::TransientFailure 31 | end 32 | end 33 | 34 | context "when the outputs are valid JSON" do 35 | specify "should yield the parsed outputs" do 36 | expect do |block| 37 | subject.parse json_outputs: "{\"key\": \"value\"}", &block 38 | end.to yield_with_args parsed_outputs: { "key" => "value" } 39 | end 40 | end 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /spec/lib/kitchen/terraform/systems_verifier_factory_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen/terraform/systems_verifier_factory" 18 | require "kitchen/terraform/systems_verifier/fail_fast" 19 | require "kitchen/terraform/systems_verifier/fail_slow" 20 | 21 | ::RSpec.describe ::Kitchen::Terraform::SystemsVerifierFactory do 22 | subject do 23 | described_class.new fail_fast: fail_fast 24 | end 25 | 26 | let :fail_fast do 27 | true 28 | end 29 | 30 | describe "#build" do 31 | let :systems do 32 | [] 33 | end 34 | 35 | context "when fail fast is true" do 36 | specify "should return a fail fast strategy" do 37 | expect(subject.build(systems: systems)).to be_kind_of ::Kitchen::Terraform::SystemsVerifier::FailFast 38 | end 39 | end 40 | 41 | context "when fail fast is false" do 42 | let :fail_fast do 43 | false 44 | end 45 | 46 | specify "should return a fail slow strategy" do 47 | expect(subject.build(systems: systems)).to be_kind_of ::Kitchen::Terraform::SystemsVerifier::FailSlow 48 | end 49 | end 50 | end 51 | end 52 | -------------------------------------------------------------------------------- /spec/lib/kitchen/terraform/variables_manager_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen/terraform/variables_manager" 18 | 19 | ::RSpec.describe ::Kitchen::Terraform::VariablesManager do 20 | subject do 21 | described_class.new 22 | end 23 | 24 | describe "#load" do 25 | let :variables do 26 | {} 27 | end 28 | 29 | context "when the Kitchen instance state does not include the key 'kitchen-terraform.input-variables'" do 30 | specify "it should raise a Kitchen::ClientError" do 31 | expect do 32 | subject.load variables: variables, state: {} 33 | end.to raise_error ::Kitchen::ClientError 34 | end 35 | end 36 | 37 | context "when the Kitchen instance state does include the key 'kitchen-terraform.input-variables'" do 38 | before do 39 | subject.load( 40 | variables: variables, 41 | state: { kitchen_terraform_variables: { "key" => "value" } }, 42 | ) 43 | end 44 | 45 | specify "it should load the variables" do 46 | expect(variables).to eq "key" => "value" 47 | end 48 | end 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /spec/lib/kitchen/terraform/verify_version_rescue_strategy/permissive_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen" 18 | require "kitchen/terraform/verify_version_rescue_strategy/permissive" 19 | require "support/kitchen/logger_context" 20 | 21 | ::RSpec.describe ::Kitchen::Terraform::VerifyVersionRescueStrategy::Permissive do 22 | subject do 23 | described_class.new logger: ::Kitchen.logger 24 | end 25 | 26 | include_context "Kitchen::Logger" 27 | 28 | describe "#call" do 29 | specify "should warn the user that the Terraform client version is unsupported" do 30 | expect(::Kitchen.logger).to receive :warn 31 | end 32 | 33 | after do 34 | subject.call 35 | end 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /spec/lib/kitchen/terraform/verify_version_rescue_strategy/strict_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen/terraform/unsupported_client_version_error" 18 | require "kitchen/terraform/verify_version_rescue_strategy/strict" 19 | 20 | ::RSpec.describe ::Kitchen::Terraform::VerifyVersionRescueStrategy::Strict do 21 | subject do 22 | described_class.new 23 | end 24 | 25 | describe "#call" do 26 | specify "should raise an error because the action failed" do 27 | expect do 28 | subject.call 29 | end.to raise_error ::Kitchen::Terraform::UnsupportedClientVersionError 30 | end 31 | end 32 | end 33 | -------------------------------------------------------------------------------- /spec/lib/kitchen/terraform/version_verifier_strategy/supported_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen/terraform/version_verifier_strategy/supported" 18 | 19 | ::RSpec.describe ::Kitchen::Terraform::VersionVerifierStrategy::Supported do 20 | describe "#call" do 21 | subject do 22 | described_class.new 23 | end 24 | 25 | specify "should not raise an error" do 26 | expect do 27 | subject.call 28 | end.not_to raise_error 29 | end 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /spec/lib/kitchen/terraform/version_verifier_strategy/unsupported_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen/terraform/unsupported_client_version_error" 18 | require "kitchen/terraform/version_verifier_strategy/unsupported" 19 | 20 | ::RSpec.describe ::Kitchen::Terraform::VersionVerifierStrategy::Unsupported do 21 | describe "#call" do 22 | subject do 23 | described_class.new 24 | end 25 | 26 | specify "should raise an error because the Terraform client version is unsupported" do 27 | expect do 28 | subject.call 29 | end.to raise_error ::Kitchen::Terraform::UnsupportedClientVersionError 30 | end 31 | end 32 | end 33 | -------------------------------------------------------------------------------- /spec/lib/kitchen/terraform/version_verifier_strategy_factory_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen" 18 | require "kitchen/terraform/version_verifier_strategy_factory" 19 | require "kitchen/terraform/version_verifier_strategy/supported" 20 | require "kitchen/terraform/version_verifier_strategy/unsupported" 21 | require "rubygems" 22 | 23 | ::RSpec.describe ::Kitchen::Terraform::VersionVerifierStrategyFactory do 24 | describe "#build" do 25 | subject do 26 | described_class.new version_requirement: ::Gem::Requirement.new("~> 1.2.3") 27 | end 28 | 29 | context "when the version is supported" do 30 | specify "should return a supported strategy" do 31 | expect(subject.build(version: ::Gem::Version.new("1.2.4"))).to be_kind_of( 32 | ::Kitchen::Terraform::VersionVerifierStrategy::Supported 33 | ) 34 | end 35 | end 36 | 37 | context "when the version is unsupported" do 38 | specify "should return an unsupported strategy" do 39 | expect(subject.build(version: ::Gem::Version.new("1.2.2"))).to be_kind_of( 40 | ::Kitchen::Terraform::VersionVerifierStrategy::Unsupported 41 | ) 42 | end 43 | end 44 | end 45 | end 46 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "support/coverage" 18 | 19 | ::RSpec.configure do |configuration| 20 | configuration.color = true 21 | 22 | configuration.disable_monkey_patching! 23 | 24 | configuration.expect_with :rspec do |expect_configuration| 25 | expect_configuration.include_chain_clauses_in_custom_matcher_descriptions = true 26 | expect_configuration.max_formatted_output_length = nil 27 | end 28 | 29 | configuration.fail_fast = false 30 | 31 | configuration.mock_with :rspec do |mocks| 32 | mocks.verify_doubled_constant_names = true 33 | 34 | mocks.verify_partial_doubles = true 35 | end 36 | 37 | configuration.profile_examples = 10 38 | end 39 | 40 | module RSpec 41 | module Mocks 42 | # This is a patch to work around an issue that is fixed by rspec-mocks 3.12.2. 43 | # SEE: https://github.com/rspec/rspec-mocks/pull/1514 44 | class VerifyingMethodDouble 45 | ruby2_keywords :proxy_method_invoked if respond_to?(:ruby2_keywords, true) 46 | end 47 | end 48 | end 49 | -------------------------------------------------------------------------------- /spec/support/coverage.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "simplecov" 18 | 19 | ::SimpleCov.start do 20 | enable_coverage :branch 21 | enable_for_subprocesses 22 | end 23 | -------------------------------------------------------------------------------- /spec/support/kitchen/logger_context.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen/logger" 18 | 19 | ::RSpec.shared_context "Kitchen::Logger" do 20 | before do 21 | ::Kitchen.logger = ::Kitchen::Logger.new stdout: ::File.open(::File::NULL, "w") 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /spec/support/kitchen/terraform/config_attribute/backend_configurations_examples.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "support/kitchen/terraform/config_attribute_type/hash_of_symbols_and_strings_examples" 18 | 19 | ::RSpec.shared_examples "Kitchen::Terraform::ConfigAttribute::BackendConfigurations" do 20 | include_context( 21 | "Kitchen::Terraform::ConfigAttributeType::HashOfSymbolsAndStrings", 22 | attribute: :backend_configurations, 23 | ) 24 | end 25 | -------------------------------------------------------------------------------- /spec/support/kitchen/terraform/config_attribute/command_timeout_examples.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "support/kitchen/terraform/config_attribute_type/integer_examples" 18 | 19 | ::RSpec.shared_examples "Kitchen::Terraform::ConfigAttribute::CommandTimeout" do 20 | include_context( 21 | "Kitchen::Terraform::ConfigAttributeType::Integer", 22 | attribute: :command_timeout, 23 | default_value: 600, 24 | ) 25 | end 26 | -------------------------------------------------------------------------------- /spec/support/kitchen/terraform/config_attribute/lock_examples.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "support/kitchen/terraform/config_attribute_contract/boolean_examples" 18 | 19 | ::RSpec.shared_examples "Kitchen::Terraform::ConfigAttribute::Lock" do 20 | it_behaves_like "Kitchen::Terraform::ConfigAttributeContract::Boolean", attribute: :lock 21 | end 22 | -------------------------------------------------------------------------------- /spec/support/kitchen/terraform/config_attribute/lock_timeout_examples.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "support/kitchen/terraform/config_attribute_type/integer_examples" 18 | 19 | ::RSpec.shared_examples "Kitchen::Terraform::ConfigAttribute::LockTimeout" do 20 | include_context( 21 | "Kitchen::Terraform::ConfigAttributeType::Integer", 22 | attribute: :lock_timeout, 23 | default_value: 0, 24 | ) 25 | end 26 | -------------------------------------------------------------------------------- /spec/support/kitchen/terraform/config_attribute/parallelism_examples.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "support/kitchen/terraform/config_attribute_type/integer_examples" 18 | 19 | ::RSpec.shared_examples "Kitchen::Terraform::ConfigAttribute::Parallelism" do 20 | include_context( 21 | "Kitchen::Terraform::ConfigAttributeType::Integer", 22 | attribute: :parallelism, 23 | default_value: 10, 24 | ) 25 | end 26 | -------------------------------------------------------------------------------- /spec/support/kitchen/terraform/config_attribute/plugin_directory_examples.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "support/kitchen/terraform/config_attribute_contract/optional_string_examples" 18 | 19 | ::RSpec.shared_examples "Kitchen::Terraform::ConfigAttribute::PluginDirectory" do 20 | it_behaves_like "Kitchen::Terraform::ConfigAttributeContract::OptionalString", attribute: :plugin_directory, default_value: nil 21 | end 22 | -------------------------------------------------------------------------------- /spec/support/kitchen/terraform/config_attribute/root_module_directory_examples.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "support/kitchen/terraform/config_attribute_contract/string_examples" 18 | 19 | ::RSpec.shared_examples "Kitchen::Terraform::ConfigAttribute::RootModuleDirectory" do 20 | it_behaves_like "Kitchen::Terraform::ConfigAttributeContract::String", attribute: :root_module_directory, default_value: "." 21 | end 22 | -------------------------------------------------------------------------------- /spec/support/kitchen/terraform/config_attribute/variable_files_examples.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "support/kitchen/terraform/config_attribute_contract/array_of_strings_examples" 18 | 19 | ::RSpec.shared_examples "Kitchen::Terraform::ConfigAttribute::VariableFiles" do 20 | it_behaves_like "Kitchen::Terraform::ConfigAttributeContract::ArrayOfStrings", attribute: :variable_files, default_value: [] 21 | end 22 | -------------------------------------------------------------------------------- /spec/support/kitchen/terraform/config_attribute/variables_examples.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "support/kitchen/terraform/config_attribute_type/hash_of_symbols_and_strings_examples" 18 | 19 | ::RSpec.shared_examples "Kitchen::Terraform::ConfigAttribute::Variables" do 20 | include_context( 21 | "Kitchen::Terraform::ConfigAttributeType::HashOfSymbolsAndStrings", 22 | attribute: :variables, 23 | ) 24 | end 25 | -------------------------------------------------------------------------------- /spec/support/kitchen/terraform/config_attribute/verify_version_examples.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "support/kitchen/terraform/config_attribute_contract/boolean_examples" 18 | 19 | ::RSpec.shared_examples "Kitchen::Terraform::ConfigAttribute::VerifyVersion" do 20 | it_behaves_like "Kitchen::Terraform::ConfigAttributeContract::Boolean", attribute: :verify_version 21 | end 22 | -------------------------------------------------------------------------------- /spec/support/kitchen/terraform/configurable_examples.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | require "kitchen" 18 | require "kitchen/driver/terraform" 19 | 20 | ::RSpec.shared_examples "Kitchen::Terraform::Configurable" do 21 | describe "@api_version" do 22 | specify "should equal 2" do 23 | expect(described_class.instance_variable_get(:@api_version)).to eq 2 24 | end 25 | end 26 | 27 | describe "@plugin_version" do 28 | it "equals the gem version" do 29 | expect(described_class.instance_variable_get(:@plugin_version)).to eq "7.0.2" 30 | end 31 | end 32 | 33 | describe "#expand_paths!" do 34 | context "when #validate_config! has not been called" do 35 | specify "should call #validate_config!" do 36 | is_expected.to receive :validate_config! 37 | end 38 | end 39 | 40 | context "when #validate_config! has been called" do 41 | before do 42 | subject.instance_variable_set :@validate_config_called, true 43 | end 44 | 45 | specify "should not call #validate_config!" do 46 | is_expected.not_to receive :validate_config! 47 | end 48 | end 49 | 50 | after do 51 | subject.send :expand_paths! 52 | end 53 | end 54 | end 55 | -------------------------------------------------------------------------------- /test/integration/attributes/Attribute File.yml: -------------------------------------------------------------------------------- 1 | --- 2 | first_output: From Attributes File 3 | undefined_output: From Attributes File 4 | -------------------------------------------------------------------------------- /test/integration/attributes/inspec.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: attributes 3 | attributes: 4 | - name: input_passthrough 5 | type: string 6 | required: true 7 | - name: output_first_output 8 | type: string 9 | required: true 10 | - name: output_second_output 11 | type: string 12 | required: true 13 | - name: output_third_output 14 | type: string 15 | required: true 16 | - name: first_output 17 | type: string 18 | - name: second_output 19 | type: string 20 | required: true 21 | - name: third_output 22 | type: string 23 | required: true 24 | - name: undefined_output 25 | type: string 26 | required: true 27 | -------------------------------------------------------------------------------- /test/integration/backend-ssh/behaviour/controls/command.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | control "command" do 18 | describe command "echo hello" do 19 | its "stdout" do 20 | should eq "hello\n" 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /test/integration/backend-ssh/behaviour/inspec.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: behaviour 3 | -------------------------------------------------------------------------------- /test/integration/backend-ssh/state/controls/operating_system.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | control "operating_system" do 18 | describe "the operating system" do 19 | subject do 20 | os 21 | end 22 | 23 | its("family") { should eq "debian" } 24 | its("release") { should eq "18.04" } 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /test/integration/backend-ssh/state/inspec.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: state 3 | -------------------------------------------------------------------------------- /test/integration/plug-ins/controls/static_file.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | control "static_file" do 18 | describe "static_file.txt" do 19 | subject do 20 | file(::File.join(attribute("output_root_module_directory"), "static_file.txt")) 21 | end 22 | 23 | its("content") { should eq "abc" } 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /test/integration/plug-ins/inspec.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: plugins 3 | attributes: 4 | - name: output_root_module_directory 5 | type: string 6 | required: true 7 | -------------------------------------------------------------------------------- /test/integration/variables/controls/variable_files.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | control "variable_files" do 18 | describe "variable_file.txt" do 19 | subject do 20 | file(::File.join(attribute("output_root_module_directory"), "variable_file.txt")) 21 | end 22 | 23 | its("content") { should eq "123" } 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /test/integration/variables/controls/variables.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | control "variables" do 18 | describe "string.txt" do 19 | subject do 20 | file(::File.join(attribute("output_root_module_directory"), "string.txt")) 21 | end 22 | 23 | its("content") { should eq "A String" } 24 | end 25 | 26 | describe "map.txt" do 27 | subject do 28 | file(::File.join(attribute("output_root_module_directory"), "map.txt")) 29 | end 30 | 31 | its("content") { should eq "A Value" } 32 | end 33 | 34 | describe "list_of_strings.txt" do 35 | subject do 36 | file(::File.join(attribute("output_root_module_directory"), "list_of_strings.txt")) 37 | end 38 | 39 | its("content") { should eq "Element One; Element Two" } 40 | end 41 | 42 | describe "list_of_maps.txt" do 43 | subject do 44 | file(::File.join(attribute("output_root_module_directory"), "list_of_maps.txt")) 45 | end 46 | 47 | its("content") { should eq "A List Of Maps Value" } 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /test/integration/variables/inspec.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: variables 3 | attributes: 4 | - name: output_root_module_directory 5 | type: string 6 | required: true 7 | -------------------------------------------------------------------------------- /test/integration/workspace-one/controls/workspace.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | control "workspace" do 18 | describe "attribute(\"input_workspace\")" do 19 | subject do 20 | attribute("input_workspace") 21 | end 22 | 23 | it { should eq "one" } 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /test/integration/workspace-one/inspec.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: workspace one 3 | attributes: 4 | - name: input_workspace 5 | type: string 6 | required: true 7 | -------------------------------------------------------------------------------- /test/integration/workspace-two/controls/workspace.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Copyright 2016-2021 Copado NCS LLC 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | control "workspace" do 18 | describe "attribute(\"input_workspace\")" do 19 | subject do 20 | attribute("input_workspace") 21 | end 22 | 23 | it { should eq "two" } 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /test/integration/workspace-two/inspec.yml: -------------------------------------------------------------------------------- 1 | --- 2 | name: workspace two 3 | attributes: 4 | - name: input_workspace 5 | type: string 6 | required: true 7 | -------------------------------------------------------------------------------- /test/terraform/PlugIns/main.tf: -------------------------------------------------------------------------------- 1 | # Copyright 2016-2021 Copado NCS LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | resource "local_file" "static_file" { 16 | content = "abc" 17 | filename = "${path.module}/static_file.txt" 18 | } 19 | -------------------------------------------------------------------------------- /test/terraform/PlugIns/outputs.tf: -------------------------------------------------------------------------------- 1 | # Copyright 2016-2021 Copado NCS LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | output "root_module_directory" { 16 | description = "The pathname of the root module directory." 17 | value = abspath(path.module) 18 | } 19 | -------------------------------------------------------------------------------- /test/terraform/PlugIns/terragrunt.hcl: -------------------------------------------------------------------------------- 1 | # Copyright 2016-2021 Copado NCS LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /test/terraform/PlugIns/versions.tf: -------------------------------------------------------------------------------- 1 | # Copyright 2016-2021 Copado NCS LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | terraform { 16 | required_version = ">= 0.13.0, < 2.0.0" 17 | 18 | required_providers { 19 | local = { 20 | source = "hashicorp/local" 21 | version = "~> 1.4" 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /test/terraform/attributes/outputs.tf: -------------------------------------------------------------------------------- 1 | # Copyright 2016-2021 Copado NCS LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | output "first_output" { 16 | value = "First Output" 17 | } 18 | 19 | output "second_output" { 20 | value = "Second Output" 21 | sensitive = true 22 | } 23 | 24 | output "third_output" { 25 | value = "Third Output" 26 | } 27 | -------------------------------------------------------------------------------- /test/terraform/attributes/terragrunt.hcl: -------------------------------------------------------------------------------- 1 | # Copyright 2016-2021 Copado NCS LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /test/terraform/attributes/variables.tf: -------------------------------------------------------------------------------- 1 | # Copyright 2016-2021 Copado NCS LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | variable "passthrough" { 16 | description = "A value to use as an Inspec profile attribute." 17 | type = string 18 | } 19 | -------------------------------------------------------------------------------- /test/terraform/attributes/versions.tf: -------------------------------------------------------------------------------- 1 | # Copyright 2016-2021 Copado NCS LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | terraform { 16 | required_version = ">= 0.13.0, < 2.0.0" 17 | } 18 | -------------------------------------------------------------------------------- /test/terraform/backend-ssh/id_ed25519: -------------------------------------------------------------------------------- 1 | -----BEGIN OPENSSH PRIVATE KEY----- 2 | b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW 3 | QyNTUxOQAAACBMijE47qPJakldxfp5PkGBAFY/++53HrLveZ8mSOca3AAAAJiT8lqyk/Ja 4 | sgAAAAtzc2gtZWQyNTUxOQAAACBMijE47qPJakldxfp5PkGBAFY/++53HrLveZ8mSOca3A 5 | AAAEDKLzS5+Lc1Q4oVzj9nQVdOPbz8iP37xtUen0bOTAUtwEyKMTjuo8lqSV3F+nk+QYEA 6 | Vj/77ncesu95nyZI5xrcAAAAEWtpdGNoZW4tdGVycmFmb3JtAQIDBA== 7 | -----END OPENSSH PRIVATE KEY----- 8 | -------------------------------------------------------------------------------- /test/terraform/backend-ssh/id_ed25519.pub: -------------------------------------------------------------------------------- 1 | ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEyKMTjuo8lqSV3F+nk+QYEAVj/77ncesu95nyZI5xrc kitchen-terraform 2 | -------------------------------------------------------------------------------- /test/terraform/backend-ssh/outputs.tf: -------------------------------------------------------------------------------- 1 | # Copyright 2016-2021 Copado NCS LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | output "bastion_host" { 16 | description = "The bastion host through which connections must be made." 17 | value = "localhost" 18 | } 19 | 20 | output "hosts" { 21 | description = "The hosts to test" 22 | value = ["localhost"] 23 | } 24 | -------------------------------------------------------------------------------- /test/terraform/backend-ssh/versions.tf: -------------------------------------------------------------------------------- 1 | # Copyright 2016-2021 Copado NCS LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | terraform { 16 | required_version = ">= 0.13.0, < 2.0.0" 17 | 18 | required_providers { 19 | docker = { 20 | source = "kreuzwerker/docker" 21 | version = "~> 2.13" 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /test/terraform/variables/main.tf: -------------------------------------------------------------------------------- 1 | # Copyright 2016-2021 Copado NCS LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | resource "local_file" "string" { 16 | content = var.string 17 | filename = "${path.module}/string.txt" 18 | } 19 | 20 | resource "local_file" "map" { 21 | content = var.map["key"] 22 | filename = "${path.module}/map.txt" 23 | } 24 | 25 | resource "local_file" "list_of_strings" { 26 | content = join("; ", var.list_of_strings) 27 | filename = "${path.module}/list_of_strings.txt" 28 | } 29 | 30 | resource "local_file" "list_of_maps" { 31 | content = lookup(var.list_of_maps[0], "key") 32 | filename = "${path.module}/list_of_maps.txt" 33 | } 34 | 35 | resource "local_file" "variable_file" { 36 | content = var.local_file_content_from_variable_file 37 | filename = "${path.module}/variable_file.txt" 38 | } 39 | -------------------------------------------------------------------------------- /test/terraform/variables/outputs.tf: -------------------------------------------------------------------------------- 1 | # Copyright 2016-2021 Copado NCS LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | 16 | output "root_module_directory" { 17 | description = "The pathname of the root module directory." 18 | value = abspath(path.module) 19 | } 20 | -------------------------------------------------------------------------------- /test/terraform/variables/terragrunt.hcl: -------------------------------------------------------------------------------- 1 | # Copyright 2016-2021 Copado NCS LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /test/terraform/variables/variable_files/Variable File.tfvars: -------------------------------------------------------------------------------- 1 | local_file_content_from_variable_file = "123" 2 | -------------------------------------------------------------------------------- /test/terraform/variables/variables.tf: -------------------------------------------------------------------------------- 1 | # Copyright 2016-2021 Copado NCS LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | variable "string" { 16 | type = string 17 | } 18 | 19 | variable "map" { 20 | type = map(any) 21 | } 22 | 23 | variable "list_of_strings" { 24 | type = list(any) 25 | } 26 | 27 | variable "list_of_maps" { 28 | type = list(any) 29 | } 30 | 31 | variable "local_file_content_from_variable_file" { 32 | type = string 33 | } 34 | -------------------------------------------------------------------------------- /test/terraform/variables/versions.tf: -------------------------------------------------------------------------------- 1 | # Copyright 2016-2021 Copado NCS LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | terraform { 16 | required_version = ">= 0.13.0, < 2.0.0" 17 | 18 | required_providers { 19 | local = { 20 | source = "hashicorp/local" 21 | version = "~> 1.4" 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /test/terraform/workspace/terragrunt.hcl: -------------------------------------------------------------------------------- 1 | # Copyright 2016-2021 Copado NCS LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /test/terraform/workspace/variables.tf: -------------------------------------------------------------------------------- 1 | # Copyright 2016-2021 Copado NCS LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | variable "workspace" { 16 | description = "The name of the workspace." 17 | } 18 | -------------------------------------------------------------------------------- /test/terraform/workspace/versions.tf: -------------------------------------------------------------------------------- 1 | # Copyright 2016-2021 Copado NCS LLC 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | terraform { 16 | required_version = ">= 0.13.0, < 2.0.0" 17 | } 18 | --------------------------------------------------------------------------------