Repository: chanzuckerberg/fogg
Pull request #395 (2020-01-16 19:32:37)

[feature] pin more provider versions
This pins the versions the [random](https://www.terraform.io/docs/providers/random/index.html), [template](https://www.terraform.io/docs/providers/template/index.html) and [archive](https://www.terraform.io/docs/providers/archive/index.html) providers.

These providers are often used and have a low release velocity, so for now we will hard-code them into fogg. If and when they are releasing new versions we can update the hard-coded configurations for allow the versions to be configurable via fogg.yml.

### Test Plan
* unit tests

### References
* https://www.terraform.io/docs/providers/random/index.html
* https://www.terraform.io/docs/providers/template/index.html
* https://www.terraform.io/docs/providers/archive/index.html

codecov[bot]: # [Codecov](https://codecov.io/gh/chanzuckerberg/fogg/pull/395?src=pr&el=h1) Report
> Merging [#395](https://codecov.io/gh/chanzuckerberg/fogg/pull/395?src=pr&el=desc) into [master](https://codecov.io/gh/chanzuckerberg/fogg/commit/51ed65d5e81e0344a42be6820b0530f126ce6473?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `n/a`.

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

```diff
@@           Coverage Diff           @@
##           master     #395   +/-   ##
=======================================
  Coverage   79.04%   79.04%           
=======================================
  Files          25       25           
  Lines        2009     2009           
=======================================
  Hits         1588     1588           
  Misses        278      278           
  Partials      143      143
```



------

[Continue to review full report at Codecov](https://codecov.io/gh/chanzuckerberg/fogg/pull/395?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/395?src=pr&el=footer). Last update [51ed65d...184c0d4](https://codecov.io/gh/chanzuckerberg/fogg/pull/395?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).


Patch:
diff --git a/templates/account/fogg.tf.tmpl b/templates/account/fogg.tf.tmpl
index 48f6b652..e258bfd7 100644
--- a/templates/account/fogg.tf.tmpl
+++ b/templates/account/fogg.tf.tmpl
@@ -126,3 +126,15 @@ data "terraform_remote_state" "{{ $accountName }}" {
 }
 {{ end }}
 {{ end }}
+
+provider random {
+  version = "~> 2.2"
+}
+
+provider template {
+  version = "~> 2.1"
+}
+
+provider archive {
+  version = "~> 1.3"
+}
diff --git a/templates/component/terraform/fogg.tf.tmpl b/templates/component/terraform/fogg.tf.tmpl
index 43e08969..dfec5cef 100644
--- a/templates/component/terraform/fogg.tf.tmpl
+++ b/templates/component/terraform/fogg.tf.tmpl
@@ -169,3 +169,15 @@ variable "aws_accounts" {
   {{ end }}
   }
 }
+
+provider random {
+  version = "~> 2.2"
+}
+
+provider template {
+  version = "~> 2.1"
+}
+
+provider archive {
+  version = "~> 1.3"
+}
diff --git a/templates/global/fogg.tf.tmpl b/templates/global/fogg.tf.tmpl
index 8aaf0088..c48507a0 100644
--- a/templates/global/fogg.tf.tmpl
+++ b/templates/global/fogg.tf.tmpl
@@ -128,3 +128,15 @@ data "terraform_remote_state" "{{ $component }}" {
   }
 }
 {{ end }}
+
+provider random {
+  version = "~> 2.2"
+}
+
+provider template {
+  version = "~> 2.1"
+}
+
+provider archive {
+  version = "~> 1.3"
+}


Test patch:
diff --git a/testdata/bless_provider/terraform/accounts/foo/fogg.tf b/testdata/bless_provider/terraform/accounts/foo/fogg.tf
index e60ce1cc..edf12c0c 100644
--- a/testdata/bless_provider/terraform/accounts/foo/fogg.tf
+++ b/testdata/bless_provider/terraform/accounts/foo/fogg.tf
@@ -92,3 +92,15 @@ data "terraform_remote_state" "global" {
 
 
 
+
+provider random {
+  version = "~> 2.2"
+}
+
+provider template {
+  version = "~> 2.1"
+}
+
+provider archive {
+  version = "~> 1.3"
+}
diff --git a/testdata/bless_provider/terraform/envs/bar/bam/fogg.tf b/testdata/bless_provider/terraform/envs/bar/bam/fogg.tf
index bda65908..60912eea 100644
--- a/testdata/bless_provider/terraform/envs/bar/bam/fogg.tf
+++ b/testdata/bless_provider/terraform/envs/bar/bam/fogg.tf
@@ -131,3 +131,15 @@ variable "aws_accounts" {
 
   }
 }
+
+provider random {
+  version = "~> 2.2"
+}
+
+provider template {
+  version = "~> 2.1"
+}
+
+provider archive {
+  version = "~> 1.3"
+}
diff --git a/testdata/bless_provider/terraform/global/fogg.tf b/testdata/bless_provider/terraform/global/fogg.tf
index 0e43c560..873be5c1 100644
--- a/testdata/bless_provider/terraform/global/fogg.tf
+++ b/testdata/bless_provider/terraform/global/fogg.tf
@@ -93,3 +93,15 @@ variable "tags" {
 
 
 
+
+provider random {
+  version = "~> 2.2"
+}
+
+provider template {
+  version = "~> 2.1"
+}
+
+provider archive {
+  version = "~> 1.3"
+}
diff --git a/testdata/github_provider/terraform/accounts/foo/fogg.tf b/testdata/github_provider/terraform/accounts/foo/fogg.tf
index 283fa569..5ca238c1 100644
--- a/testdata/github_provider/terraform/accounts/foo/fogg.tf
+++ b/testdata/github_provider/terraform/accounts/foo/fogg.tf
@@ -76,3 +76,15 @@ data "terraform_remote_state" "global" {
 
 
 
+
+provider random {
+  version = "~> 2.2"
+}
+
+provider template {
+  version = "~> 2.1"
+}
+
+provider archive {
+  version = "~> 1.3"
+}
diff --git a/testdata/github_provider/terraform/envs/bar/bam/fogg.tf b/testdata/github_provider/terraform/envs/bar/bam/fogg.tf
index f16c2639..4d1e5d5d 100644
--- a/testdata/github_provider/terraform/envs/bar/bam/fogg.tf
+++ b/testdata/github_provider/terraform/envs/bar/bam/fogg.tf
@@ -115,3 +115,15 @@ variable "aws_accounts" {
 
   }
 }
+
+provider random {
+  version = "~> 2.2"
+}
+
+provider template {
+  version = "~> 2.1"
+}
+
+provider archive {
+  version = "~> 1.3"
+}
diff --git a/testdata/github_provider/terraform/global/fogg.tf b/testdata/github_provider/terraform/global/fogg.tf
index 76765df2..0c2fdf0e 100644
--- a/testdata/github_provider/terraform/global/fogg.tf
+++ b/testdata/github_provider/terraform/global/fogg.tf
@@ -77,3 +77,15 @@ variable "tags" {
 
 
 
+
+provider random {
+  version = "~> 2.2"
+}
+
+provider template {
+  version = "~> 2.1"
+}
+
+provider archive {
+  version = "~> 1.3"
+}
diff --git a/testdata/okta_provider/terraform/accounts/foo/fogg.tf b/testdata/okta_provider/terraform/accounts/foo/fogg.tf
index 792f9366..a0676080 100644
--- a/testdata/okta_provider/terraform/accounts/foo/fogg.tf
+++ b/testdata/okta_provider/terraform/accounts/foo/fogg.tf
@@ -76,3 +76,15 @@ data "terraform_remote_state" "global" {
 
 
 
+
+provider random {
+  version = "~> 2.2"
+}
+
+provider template {
+  version = "~> 2.1"
+}
+
+provider archive {
+  version = "~> 1.3"
+}
diff --git a/testdata/okta_provider/terraform/envs/bar/bam/fogg.tf b/testdata/okta_provider/terraform/envs/bar/bam/fogg.tf
index 680fc50a..0a4d48a4 100644
--- a/testdata/okta_provider/terraform/envs/bar/bam/fogg.tf
+++ b/testdata/okta_provider/terraform/envs/bar/bam/fogg.tf
@@ -115,3 +115,15 @@ variable "aws_accounts" {
 
   }
 }
+
+provider random {
+  version = "~> 2.2"
+}
+
+provider template {
+  version = "~> 2.1"
+}
+
+provider archive {
+  version = "~> 1.3"
+}
diff --git a/testdata/okta_provider/terraform/global/fogg.tf b/testdata/okta_provider/terraform/global/fogg.tf
index c907b469..790f81ae 100644
--- a/testdata/okta_provider/terraform/global/fogg.tf
+++ b/testdata/okta_provider/terraform/global/fogg.tf
@@ -77,3 +77,15 @@ variable "tags" {
 
 
 
+
+provider random {
+  version = "~> 2.2"
+}
+
+provider template {
+  version = "~> 2.1"
+}
+
+provider archive {
+  version = "~> 1.3"
+}
diff --git a/testdata/snowflake_provider/terraform/accounts/foo/fogg.tf b/testdata/snowflake_provider/terraform/accounts/foo/fogg.tf
index c15cabf3..4f0a599c 100644
--- a/testdata/snowflake_provider/terraform/accounts/foo/fogg.tf
+++ b/testdata/snowflake_provider/terraform/accounts/foo/fogg.tf
@@ -77,3 +77,15 @@ data "terraform_remote_state" "global" {
 
 
 
+
+provider random {
+  version = "~> 2.2"
+}
+
+provider template {
+  version = "~> 2.1"
+}
+
+provider archive {
+  version = "~> 1.3"
+}
diff --git a/testdata/snowflake_provider/terraform/envs/bar/bam/fogg.tf b/testdata/snowflake_provider/terraform/envs/bar/bam/fogg.tf
index bec6eeb5..ba00916f 100644
--- a/testdata/snowflake_provider/terraform/envs/bar/bam/fogg.tf
+++ b/testdata/snowflake_provider/terraform/envs/bar/bam/fogg.tf
@@ -116,3 +116,15 @@ variable "aws_accounts" {
 
   }
 }
+
+provider random {
+  version = "~> 2.2"
+}
+
+provider template {
+  version = "~> 2.1"
+}
+
+provider archive {
+  version = "~> 1.3"
+}
diff --git a/testdata/snowflake_provider/terraform/global/fogg.tf b/testdata/snowflake_provider/terraform/global/fogg.tf
index a73a8d92..b6a68548 100644
--- a/testdata/snowflake_provider/terraform/global/fogg.tf
+++ b/testdata/snowflake_provider/terraform/global/fogg.tf
@@ -78,3 +78,15 @@ variable "tags" {
 
 
 
+
+provider random {
+  version = "~> 2.2"
+}
+
+provider template {
+  version = "~> 2.1"
+}
+
+provider archive {
+  version = "~> 1.3"
+}
diff --git a/testdata/v1_full/terraform/accounts/bar/fogg.tf b/testdata/v1_full/terraform/accounts/bar/fogg.tf
index 61d4e773..dea69626 100644
--- a/testdata/v1_full/terraform/accounts/bar/fogg.tf
+++ b/testdata/v1_full/terraform/accounts/bar/fogg.tf
@@ -121,3 +121,15 @@ data "terraform_remote_state" "foo" {
 }
 
 
+
+provider random {
+  version = "~> 2.2"
+}
+
+provider template {
+  version = "~> 2.1"
+}
+
+provider archive {
+  version = "~> 1.3"
+}
diff --git a/testdata/v1_full/terraform/accounts/foo/fogg.tf b/testdata/v1_full/terraform/accounts/foo/fogg.tf
index 7cc30ebd..ef94ca2e 100644
--- a/testdata/v1_full/terraform/accounts/foo/fogg.tf
+++ b/testdata/v1_full/terraform/accounts/foo/fogg.tf
@@ -121,3 +121,15 @@ data "terraform_remote_state" "bar" {
 
 
 
+
+provider random {
+  version = "~> 2.2"
+}
+
+provider template {
+  version = "~> 2.1"
+}
+
+provider archive {
+  version = "~> 1.3"
+}
diff --git a/testdata/v1_full/terraform/envs/stage/cloud-env/fogg.tf b/testdata/v1_full/terraform/envs/stage/cloud-env/fogg.tf
index 0f4961f7..4b50b3d6 100644
--- a/testdata/v1_full/terraform/envs/stage/cloud-env/fogg.tf
+++ b/testdata/v1_full/terraform/envs/stage/cloud-env/fogg.tf
@@ -171,3 +171,15 @@ variable "aws_accounts" {
 
   }
 }
+
+provider random {
+  version = "~> 2.2"
+}
+
+provider template {
+  version = "~> 2.1"
+}
+
+provider archive {
+  version = "~> 1.3"
+}
diff --git a/testdata/v1_full/terraform/envs/stage/helm/fogg.tf b/testdata/v1_full/terraform/envs/stage/helm/fogg.tf
index b9ebaa62..2a259ba9 100644
--- a/testdata/v1_full/terraform/envs/stage/helm/fogg.tf
+++ b/testdata/v1_full/terraform/envs/stage/helm/fogg.tf
@@ -171,3 +171,15 @@ variable "aws_accounts" {
 
   }
 }
+
+provider random {
+  version = "~> 2.2"
+}
+
+provider template {
+  version = "~> 2.1"
+}
+
+provider archive {
+  version = "~> 1.3"
+}
diff --git a/testdata/v1_full/terraform/global/fogg.tf b/testdata/v1_full/terraform/global/fogg.tf
index 21ef8f26..ea3148d0 100644
--- a/testdata/v1_full/terraform/global/fogg.tf
+++ b/testdata/v1_full/terraform/global/fogg.tf
@@ -102,3 +102,15 @@ variable "foo" {
 
 
 
+
+provider random {
+  version = "~> 2.2"
+}
+
+provider template {
+  version = "~> 2.1"
+}
+
+provider archive {
+  version = "~> 1.3"
+}
diff --git a/testdata/v2_full/terraform/accounts/bar/fogg.tf b/testdata/v2_full/terraform/accounts/bar/fogg.tf
index 3f2dca6f..b8f910e9 100644
--- a/testdata/v2_full/terraform/accounts/bar/fogg.tf
+++ b/testdata/v2_full/terraform/accounts/bar/fogg.tf
@@ -113,3 +113,15 @@ data "terraform_remote_state" "foo" {
 }
 
 
+
+provider random {
+  version = "~> 2.2"
+}
+
+provider template {
+  version = "~> 2.1"
+}
+
+provider archive {
+  version = "~> 1.3"
+}
diff --git a/testdata/v2_full/terraform/accounts/foo/fogg.tf b/testdata/v2_full/terraform/accounts/foo/fogg.tf
index 1b4963e2..0225a45a 100644
--- a/testdata/v2_full/terraform/accounts/foo/fogg.tf
+++ b/testdata/v2_full/terraform/accounts/foo/fogg.tf
@@ -113,3 +113,15 @@ data "terraform_remote_state" "bar" {
 
 
 
+
+provider random {
+  version = "~> 2.2"
+}
+
+provider template {
+  version = "~> 2.1"
+}
+
+provider archive {
+  version = "~> 1.3"
+}
diff --git a/testdata/v2_full/terraform/envs/staging/comp1/fogg.tf b/testdata/v2_full/terraform/envs/staging/comp1/fogg.tf
index 0f7be97b..ad7e2ed4 100644
--- a/testdata/v2_full/terraform/envs/staging/comp1/fogg.tf
+++ b/testdata/v2_full/terraform/envs/staging/comp1/fogg.tf
@@ -175,3 +175,15 @@ variable "aws_accounts" {
 
   }
 }
+
+provider random {
+  version = "~> 2.2"
+}
+
+provider template {
+  version = "~> 2.1"
+}
+
+provider archive {
+  version = "~> 1.3"
+}
diff --git a/testdata/v2_full/terraform/envs/staging/comp2/fogg.tf b/testdata/v2_full/terraform/envs/staging/comp2/fogg.tf
index b4359678..bdd5f044 100644
--- a/testdata/v2_full/terraform/envs/staging/comp2/fogg.tf
+++ b/testdata/v2_full/terraform/envs/staging/comp2/fogg.tf
@@ -175,3 +175,15 @@ variable "aws_accounts" {
 
   }
 }
+
+provider random {
+  version = "~> 2.2"
+}
+
+provider template {
+  version = "~> 2.1"
+}
+
+provider archive {
+  version = "~> 1.3"
+}
diff --git a/testdata/v2_full/terraform/envs/staging/vpc/fogg.tf b/testdata/v2_full/terraform/envs/staging/vpc/fogg.tf
index 7fe4997e..30d8d31b 100644
--- a/testdata/v2_full/terraform/envs/staging/vpc/fogg.tf
+++ b/testdata/v2_full/terraform/envs/staging/vpc/fogg.tf
@@ -175,3 +175,15 @@ variable "aws_accounts" {
 
   }
 }
+
+provider random {
+  version = "~> 2.2"
+}
+
+provider template {
+  version = "~> 2.1"
+}
+
+provider archive {
+  version = "~> 1.3"
+}
diff --git a/testdata/v2_full/terraform/global/fogg.tf b/testdata/v2_full/terraform/global/fogg.tf
index b5b4a203..2813cabf 100644
--- a/testdata/v2_full/terraform/global/fogg.tf
+++ b/testdata/v2_full/terraform/global/fogg.tf
@@ -94,3 +94,15 @@ variable "foo" {
 
 
 
+
+provider random {
+  version = "~> 2.2"
+}
+
+provider template {
+  version = "~> 2.1"
+}
+
+provider archive {
+  version = "~> 1.3"
+}
diff --git a/testdata/v2_minimal_valid/terraform/global/fogg.tf b/testdata/v2_minimal_valid/terraform/global/fogg.tf
index 00f631e7..1fbccd1c 100644
--- a/testdata/v2_minimal_valid/terraform/global/fogg.tf
+++ b/testdata/v2_minimal_valid/terraform/global/fogg.tf
@@ -68,3 +68,15 @@ variable "tags" {
 
 
 
+
+provider random {
+  version = "~> 2.2"
+}
+
+provider template {
+  version = "~> 2.1"
+}
+
+provider archive {
+  version = "~> 1.3"
+}
diff --git a/testdata/v2_no_aws_provider/terraform/accounts/bar/fogg.tf b/testdata/v2_no_aws_provider/terraform/accounts/bar/fogg.tf
index 12dae157..c70b643d 100644
--- a/testdata/v2_no_aws_provider/terraform/accounts/bar/fogg.tf
+++ b/testdata/v2_no_aws_provider/terraform/accounts/bar/fogg.tf
@@ -88,3 +88,15 @@ data "terraform_remote_state" "foo" {
 }
 
 
+
+provider random {
+  version = "~> 2.2"
+}
+
+provider template {
+  version = "~> 2.1"
+}
+
+provider archive {
+  version = "~> 1.3"
+}
diff --git a/testdata/v2_no_aws_provider/terraform/accounts/foo/fogg.tf b/testdata/v2_no_aws_provider/terraform/accounts/foo/fogg.tf
index 9aeb3d99..e45267d6 100644
--- a/testdata/v2_no_aws_provider/terraform/accounts/foo/fogg.tf
+++ b/testdata/v2_no_aws_provider/terraform/accounts/foo/fogg.tf
@@ -88,3 +88,15 @@ data "terraform_remote_state" "bar" {
 
 
 
+
+provider random {
+  version = "~> 2.2"
+}
+
+provider template {
+  version = "~> 2.1"
+}
+
+provider archive {
+  version = "~> 1.3"
+}
diff --git a/testdata/v2_no_aws_provider/terraform/envs/staging/comp1/fogg.tf b/testdata/v2_no_aws_provider/terraform/envs/staging/comp1/fogg.tf
index b2329971..8fce6e78 100644
--- a/testdata/v2_no_aws_provider/terraform/envs/staging/comp1/fogg.tf
+++ b/testdata/v2_no_aws_provider/terraform/envs/staging/comp1/fogg.tf
@@ -149,3 +149,15 @@ variable "aws_accounts" {
 
   }
 }
+
+provider random {
+  version = "~> 2.2"
+}
+
+provider template {
+  version = "~> 2.1"
+}
+
+provider archive {
+  version = "~> 1.3"
+}
diff --git a/testdata/v2_no_aws_provider/terraform/envs/staging/comp2/fogg.tf b/testdata/v2_no_aws_provider/terraform/envs/staging/comp2/fogg.tf
index 97eba670..db252d69 100644
--- a/testdata/v2_no_aws_provider/terraform/envs/staging/comp2/fogg.tf
+++ b/testdata/v2_no_aws_provider/terraform/envs/staging/comp2/fogg.tf
@@ -149,3 +149,15 @@ variable "aws_accounts" {
 
   }
 }
+
+provider random {
+  version = "~> 2.2"
+}
+
+provider template {
+  version = "~> 2.1"
+}
+
+provider archive {
+  version = "~> 1.3"
+}
diff --git a/testdata/v2_no_aws_provider/terraform/envs/staging/vpc/fogg.tf b/testdata/v2_no_aws_provider/terraform/envs/staging/vpc/fogg.tf
index 00dacf65..8a91660d 100644
--- a/testdata/v2_no_aws_provider/terraform/envs/staging/vpc/fogg.tf
+++ b/testdata/v2_no_aws_provider/terraform/envs/staging/vpc/fogg.tf
@@ -149,3 +149,15 @@ variable "aws_accounts" {
 
   }
 }
+
+provider random {
+  version = "~> 2.2"
+}
+
+provider template {
+  version = "~> 2.1"
+}
+
+provider archive {
+  version = "~> 1.3"
+}
diff --git a/testdata/v2_no_aws_provider/terraform/global/fogg.tf b/testdata/v2_no_aws_provider/terraform/global/fogg.tf
index 4f04bdb7..9ae0729e 100644
--- a/testdata/v2_no_aws_provider/terraform/global/fogg.tf
+++ b/testdata/v2_no_aws_provider/terraform/global/fogg.tf
@@ -73,3 +73,15 @@ variable "foo" {
 
 
 
+
+provider random {
+  version = "~> 2.2"
+}
+
+provider template {
+  version = "~> 2.1"
+}
+
+provider archive {
+  version = "~> 1.3"
+}