Repository: chanzuckerberg/fogg
Pull request #477 (2020-05-27 16:47:10)

[fix] set AWS_SDK_LOAD_CONFIG=1
Setting this makes the go sdk behave the way one expects by reading the
aws config.

### Test Plan
* CI

### References
* https://docs.aws.amazon.com/sdk-for-go/api/aws/session/

jgadling: This is a behavior change -- is it likely to cause problems for anyone who was depending on the previous behavior? Do we need to provide a config option to disable this change?
codecov-commenter: # [Codecov](https://codecov.io/gh/chanzuckerberg/fogg/pull/477?src=pr&el=h1) Report
> Merging [#477](https://codecov.io/gh/chanzuckerberg/fogg/pull/477?src=pr&el=desc) into [master](https://codecov.io/gh/chanzuckerberg/fogg/commit/1dea7f680e466c348e92ab542568d94644060e06&el=desc) will **not change** coverage.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/chanzuckerberg/fogg/pull/477/graphs/tree.svg?width=650&height=150&src=pr&token=57DhtZ7g2A)](https://codecov.io/gh/chanzuckerberg/fogg/pull/477?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master     #477   +/-   ##
=======================================
  Coverage   59.36%   59.36%           
=======================================
  Files          19       19           
  Lines        1996     1996           
=======================================
  Hits         1185     1185           
  Misses        653      653           
  Partials      158      158           
```



------

[Continue to review full report at Codecov](https://codecov.io/gh/chanzuckerberg/fogg/pull/477?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/chanzuckerberg/fogg/pull/477?src=pr&el=footer). Last update [1dea7f6...fcae499](https://codecov.io/gh/chanzuckerberg/fogg/pull/477?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

ryanking: > This is a behavior change -- is it likely to cause problems for anyone who was depending on the previous behavior? Do we need to provide a config option to disable this change?

In my experience, no - it seems that everyone who uses the go aws sdk eventually has to set this.

I don't think we need a config option because the `:=` means "set if not set" so to disable you can do `AWS_SDK_LOAD_CONFIG=0 make ..`

Patch:
diff --git a/templates/repo/scripts/common.mk b/templates/repo/scripts/common.mk
index fd2985b6..0a154791 100644
--- a/templates/repo/scripts/common.mk
+++ b/templates/repo/scripts/common.mk
@@ -6,6 +6,7 @@ TF_VARS := $(patsubst %,-e%,$(filter TF_VAR_%,$(.VARIABLES)))
 REPO_ROOT := $(shell git rev-parse --show-toplevel)
 REPO_RELATIVE_PATH := $(shell git rev-parse --show-prefix)
 AUTO_APPROVE := false
+export AWS_SDK_LOAD_CONFIG := 1
 
 TFENV_DIR ?= $(REPO_ROOT)/.fogg/tfenv
 export PATH :=$(TFENV_DIR)/libexec:$(TFENV_DIR)/versions/$(TERRAFORM_VERSION)/:$(REPO_ROOT)/.fogg/bin:$(PATH)


Test patch:
diff --git a/testdata/bless_provider_yaml/scripts/common.mk b/testdata/bless_provider_yaml/scripts/common.mk
index fd2985b6..0a154791 100644
--- a/testdata/bless_provider_yaml/scripts/common.mk
+++ b/testdata/bless_provider_yaml/scripts/common.mk
@@ -6,6 +6,7 @@ TF_VARS := $(patsubst %,-e%,$(filter TF_VAR_%,$(.VARIABLES)))
 REPO_ROOT := $(shell git rev-parse --show-toplevel)
 REPO_RELATIVE_PATH := $(shell git rev-parse --show-prefix)
 AUTO_APPROVE := false
+export AWS_SDK_LOAD_CONFIG := 1
 
 TFENV_DIR ?= $(REPO_ROOT)/.fogg/tfenv
 export PATH :=$(TFENV_DIR)/libexec:$(TFENV_DIR)/versions/$(TERRAFORM_VERSION)/:$(REPO_ROOT)/.fogg/bin:$(PATH)
diff --git a/testdata/circleci/scripts/common.mk b/testdata/circleci/scripts/common.mk
index fd2985b6..0a154791 100644
--- a/testdata/circleci/scripts/common.mk
+++ b/testdata/circleci/scripts/common.mk
@@ -6,6 +6,7 @@ TF_VARS := $(patsubst %,-e%,$(filter TF_VAR_%,$(.VARIABLES)))
 REPO_ROOT := $(shell git rev-parse --show-toplevel)
 REPO_RELATIVE_PATH := $(shell git rev-parse --show-prefix)
 AUTO_APPROVE := false
+export AWS_SDK_LOAD_CONFIG := 1
 
 TFENV_DIR ?= $(REPO_ROOT)/.fogg/tfenv
 export PATH :=$(TFENV_DIR)/libexec:$(TFENV_DIR)/versions/$(TERRAFORM_VERSION)/:$(REPO_ROOT)/.fogg/bin:$(PATH)
diff --git a/testdata/github_actions/scripts/common.mk b/testdata/github_actions/scripts/common.mk
index fd2985b6..0a154791 100644
--- a/testdata/github_actions/scripts/common.mk
+++ b/testdata/github_actions/scripts/common.mk
@@ -6,6 +6,7 @@ TF_VARS := $(patsubst %,-e%,$(filter TF_VAR_%,$(.VARIABLES)))
 REPO_ROOT := $(shell git rev-parse --show-toplevel)
 REPO_RELATIVE_PATH := $(shell git rev-parse --show-prefix)
 AUTO_APPROVE := false
+export AWS_SDK_LOAD_CONFIG := 1
 
 TFENV_DIR ?= $(REPO_ROOT)/.fogg/tfenv
 export PATH :=$(TFENV_DIR)/libexec:$(TFENV_DIR)/versions/$(TERRAFORM_VERSION)/:$(REPO_ROOT)/.fogg/bin:$(PATH)
diff --git a/testdata/github_provider_yaml/scripts/common.mk b/testdata/github_provider_yaml/scripts/common.mk
index fd2985b6..0a154791 100644
--- a/testdata/github_provider_yaml/scripts/common.mk
+++ b/testdata/github_provider_yaml/scripts/common.mk
@@ -6,6 +6,7 @@ TF_VARS := $(patsubst %,-e%,$(filter TF_VAR_%,$(.VARIABLES)))
 REPO_ROOT := $(shell git rev-parse --show-toplevel)
 REPO_RELATIVE_PATH := $(shell git rev-parse --show-prefix)
 AUTO_APPROVE := false
+export AWS_SDK_LOAD_CONFIG := 1
 
 TFENV_DIR ?= $(REPO_ROOT)/.fogg/tfenv
 export PATH :=$(TFENV_DIR)/libexec:$(TFENV_DIR)/versions/$(TERRAFORM_VERSION)/:$(REPO_ROOT)/.fogg/bin:$(PATH)
diff --git a/testdata/okta_provider_yaml/scripts/common.mk b/testdata/okta_provider_yaml/scripts/common.mk
index fd2985b6..0a154791 100644
--- a/testdata/okta_provider_yaml/scripts/common.mk
+++ b/testdata/okta_provider_yaml/scripts/common.mk
@@ -6,6 +6,7 @@ TF_VARS := $(patsubst %,-e%,$(filter TF_VAR_%,$(.VARIABLES)))
 REPO_ROOT := $(shell git rev-parse --show-toplevel)
 REPO_RELATIVE_PATH := $(shell git rev-parse --show-prefix)
 AUTO_APPROVE := false
+export AWS_SDK_LOAD_CONFIG := 1
 
 TFENV_DIR ?= $(REPO_ROOT)/.fogg/tfenv
 export PATH :=$(TFENV_DIR)/libexec:$(TFENV_DIR)/versions/$(TERRAFORM_VERSION)/:$(REPO_ROOT)/.fogg/bin:$(PATH)
diff --git a/testdata/snowflake_provider_yaml/scripts/common.mk b/testdata/snowflake_provider_yaml/scripts/common.mk
index fd2985b6..0a154791 100644
--- a/testdata/snowflake_provider_yaml/scripts/common.mk
+++ b/testdata/snowflake_provider_yaml/scripts/common.mk
@@ -6,6 +6,7 @@ TF_VARS := $(patsubst %,-e%,$(filter TF_VAR_%,$(.VARIABLES)))
 REPO_ROOT := $(shell git rev-parse --show-toplevel)
 REPO_RELATIVE_PATH := $(shell git rev-parse --show-prefix)
 AUTO_APPROVE := false
+export AWS_SDK_LOAD_CONFIG := 1
 
 TFENV_DIR ?= $(REPO_ROOT)/.fogg/tfenv
 export PATH :=$(TFENV_DIR)/libexec:$(TFENV_DIR)/versions/$(TERRAFORM_VERSION)/:$(REPO_ROOT)/.fogg/bin:$(PATH)
diff --git a/testdata/tfe_provider_yaml/scripts/common.mk b/testdata/tfe_provider_yaml/scripts/common.mk
index fd2985b6..0a154791 100644
--- a/testdata/tfe_provider_yaml/scripts/common.mk
+++ b/testdata/tfe_provider_yaml/scripts/common.mk
@@ -6,6 +6,7 @@ TF_VARS := $(patsubst %,-e%,$(filter TF_VAR_%,$(.VARIABLES)))
 REPO_ROOT := $(shell git rev-parse --show-toplevel)
 REPO_RELATIVE_PATH := $(shell git rev-parse --show-prefix)
 AUTO_APPROVE := false
+export AWS_SDK_LOAD_CONFIG := 1
 
 TFENV_DIR ?= $(REPO_ROOT)/.fogg/tfenv
 export PATH :=$(TFENV_DIR)/libexec:$(TFENV_DIR)/versions/$(TERRAFORM_VERSION)/:$(REPO_ROOT)/.fogg/bin:$(PATH)
diff --git a/testdata/v2_full_yaml/scripts/common.mk b/testdata/v2_full_yaml/scripts/common.mk
index fd2985b6..0a154791 100644
--- a/testdata/v2_full_yaml/scripts/common.mk
+++ b/testdata/v2_full_yaml/scripts/common.mk
@@ -6,6 +6,7 @@ TF_VARS := $(patsubst %,-e%,$(filter TF_VAR_%,$(.VARIABLES)))
 REPO_ROOT := $(shell git rev-parse --show-toplevel)
 REPO_RELATIVE_PATH := $(shell git rev-parse --show-prefix)
 AUTO_APPROVE := false
+export AWS_SDK_LOAD_CONFIG := 1
 
 TFENV_DIR ?= $(REPO_ROOT)/.fogg/tfenv
 export PATH :=$(TFENV_DIR)/libexec:$(TFENV_DIR)/versions/$(TERRAFORM_VERSION)/:$(REPO_ROOT)/.fogg/bin:$(PATH)
diff --git a/testdata/v2_minimal_valid_yaml/scripts/common.mk b/testdata/v2_minimal_valid_yaml/scripts/common.mk
index fd2985b6..0a154791 100644
--- a/testdata/v2_minimal_valid_yaml/scripts/common.mk
+++ b/testdata/v2_minimal_valid_yaml/scripts/common.mk
@@ -6,6 +6,7 @@ TF_VARS := $(patsubst %,-e%,$(filter TF_VAR_%,$(.VARIABLES)))
 REPO_ROOT := $(shell git rev-parse --show-toplevel)
 REPO_RELATIVE_PATH := $(shell git rev-parse --show-prefix)
 AUTO_APPROVE := false
+export AWS_SDK_LOAD_CONFIG := 1
 
 TFENV_DIR ?= $(REPO_ROOT)/.fogg/tfenv
 export PATH :=$(TFENV_DIR)/libexec:$(TFENV_DIR)/versions/$(TERRAFORM_VERSION)/:$(REPO_ROOT)/.fogg/bin:$(PATH)
diff --git a/testdata/v2_no_aws_provider_yaml/scripts/common.mk b/testdata/v2_no_aws_provider_yaml/scripts/common.mk
index fd2985b6..0a154791 100644
--- a/testdata/v2_no_aws_provider_yaml/scripts/common.mk
+++ b/testdata/v2_no_aws_provider_yaml/scripts/common.mk
@@ -6,6 +6,7 @@ TF_VARS := $(patsubst %,-e%,$(filter TF_VAR_%,$(.VARIABLES)))
 REPO_ROOT := $(shell git rev-parse --show-toplevel)
 REPO_RELATIVE_PATH := $(shell git rev-parse --show-prefix)
 AUTO_APPROVE := false
+export AWS_SDK_LOAD_CONFIG := 1
 
 TFENV_DIR ?= $(REPO_ROOT)/.fogg/tfenv
 export PATH :=$(TFENV_DIR)/libexec:$(TFENV_DIR)/versions/$(TERRAFORM_VERSION)/:$(REPO_ROOT)/.fogg/bin:$(PATH)