Update Terraform commands for v0.10 (#93)

* Terraform now requires init to fetch providers

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>

* Rename env terraform command to workspace

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>

* Pin Terraform version to reflect CLI updates

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
This commit is contained in:
Clinton Wolfe 2017-10-10 20:21:56 -04:00 committed by Christoph Hartmann
parent 9bbb439467
commit 2f9317265b
2 changed files with 8 additions and 3 deletions

View file

@ -42,7 +42,8 @@ namespace :test do
task :configure_test_environment, :namespace do |t, args|
puts "----> Creating terraform environment"
sh("cd #{integration_dir}/build/ && terraform env new #{args[:namespace]}")
sh("cd #{integration_dir}/build/ && terraform init")
sh("cd #{integration_dir}/build/ && terraform workspace new #{args[:namespace]}")
end
task :setup_integration_tests do
@ -69,8 +70,8 @@ namespace :test do
task :destroy_test_environment, :namespace do |t, args|
puts "----> Destroying terraform environment"
sh("cd #{integration_dir}/build/ && terraform env select default")
sh("cd #{integration_dir}/build && terraform env delete #{args[:namespace]}")
sh("cd #{integration_dir}/build/ && terraform workspace select default")
sh("cd #{integration_dir}/build && terraform workspace delete #{args[:namespace]}")
end
task :integration do

View file

@ -1,3 +1,7 @@
terraform {
required_version = "~> 0.10.0"
}
provider "aws" {}
resource "aws_instance" "example" {