diff --git a/Makefile b/Makefile index 5072d87..3cdc17d 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,7 @@ requirements: bin/terraform ## Install required software test: requirements ## Execute all tests @echo "Temp directory: $(TEMPDIR)" + @cp tests/provider.tf temp_provider.tf @bin/terraform init > /dev/null 2>&1 @for i in `find . -name terraform.\*.tfvars.example`; do \ bin/terraform plan -var-file $$i 1> $(TEMPDIR)/$$i.output && \ diff --git a/README.md b/README.md index 0af12f6..4e47325 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,6 @@ This module has been tested with Terraform version 0.11.8 module "vpc" { source = "git::ssh://git@github.com/reactiveops/terraform-vpc.git?ref=2.0.2" - aws_access_key = "${var.aws_access_key}" - aws_secret_key = "${var.aws_secret_key}" aws_region = "${var.aws_region}" az_count = "${var.az_count}" @@ -31,8 +29,6 @@ module "vpc" { * Create the required variables either in `main.tf` or a separate `variables.tf` file: ``` -variable "aws_access_key" {} -variable "aws_secret_key" {} variable "aws_region" {} variable "aws_azs" {} @@ -155,12 +151,7 @@ This repo contains a few `.tfvars.example` files in the root illustrating differ ### Setup -Running `make test` requires an actual AWS account for plan generation. The AWS account used requires read-only access to VPC/EC2 resources. No changes are applied. Credentials can be set via environment variables. - -``` -export TF_VAR_aws_access_key=XXXXXXXXXXXXXXXXX -export TF_VAR_aws_secret_key=XXXXXXXXXXXXXXXXXXXXXXXXXXXX -``` +Running `make test` requires an actual AWS account for plan generation. The AWS account used requires read-only access to VPC/EC2 resources. No changes are applied. Credentials should be inferred from your awscli config, usually found in `~/.aws/config`. ### Executing tests diff --git a/aws-vpc.tf b/aws-vpc.tf deleted file mode 100644 index ad9426d..0000000 --- a/aws-vpc.tf +++ /dev/null @@ -1,19 +0,0 @@ -#Copyright 2017 Reactive Ops Inc. -# -#Licensed under the Apache License, Version 2.0 (the “License”); -#you may not use this file except in compliance with the License. -#You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -#Unless required by applicable law or agreed to in writing, software -#distributed under the License is distributed on an “AS IS” BASIS, -#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -#See the License for the specific language governing permissions and -#limitations under the License. - -provider "aws" { - access_key = "${var.aws_access_key}" - secret_key = "${var.aws_secret_key}" - region = "${var.aws_region}" -} diff --git a/tests/provider.tf b/tests/provider.tf new file mode 100644 index 0000000..6cdfee7 --- /dev/null +++ b/tests/provider.tf @@ -0,0 +1,8 @@ +variable "aws_access_key" {} +variable "aws_secret_key" {} + +provider "aws" { + access_key = "${var.aws_access_key}" + secret_key = "${var.aws_secret_key}" + region = "${var.aws_region}" +} diff --git a/variables.tf b/variables.tf index 8ecaa50..1045db8 100644 --- a/variables.tf +++ b/variables.tf @@ -12,8 +12,6 @@ #See the License for the specific language governing permissions and #limitations under the License. -variable "aws_access_key" {} -variable "aws_secret_key" {} variable "aws_region" {} variable "aws_vpc_name" {