Repository: chanzuckerberg/fogg
Pull request #487 (2020-06-19 07:19:48)

Add standard tags to accounts components
### Summary
Adds tags variable to accounts components, with standard names for project, env (hardcoded to "accounts") and service (matches the account name). Makes it simpler for adding tags to components such as IAM users that are created in an account component.

### Test Plan
Golden files updated.

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

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

```diff
@@           Coverage Diff           @@
##           master     #487   +/-   ##
=======================================
  Coverage   59.27%   59.27%           
=======================================
  Files          19       19           
  Lines        1994     1994           
=======================================
  Hits         1182     1182           
  Misses        654      654           
  Partials      158      158           
```



------

[Continue to review full report at Codecov](https://codecov.io/gh/chanzuckerberg/fogg/pull/487?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/487?src=pr&el=footer). Last update [ee19ffe...8d81242](https://codecov.io/gh/chanzuckerberg/fogg/pull/487?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 fd03032b..23d10727 100644
--- a/templates/account/fogg.tf.tmpl
+++ b/templates/account/fogg.tf.tmpl
@@ -72,6 +72,17 @@ variable account {
     default = "{{ .AccountName }}"
 }
 
+variable tags {
+  type =  map(string)
+  default = {
+    project   = "{{ .Project }}"
+    env       = "accounts"
+    service   = "{{ .AccountName }}"
+    owner     = "{{ .Owner }}"
+    managedBy = "terraform"
+  }
+}
+
 # map of aws_accounts
 variable aws_accounts {
   type =  map


Test patch:
diff --git a/testdata/bless_provider_yaml/terraform/accounts/foo/fogg.tf b/testdata/bless_provider_yaml/terraform/accounts/foo/fogg.tf
index 8b45cf6b..4e442e34 100644
--- a/testdata/bless_provider_yaml/terraform/accounts/foo/fogg.tf
+++ b/testdata/bless_provider_yaml/terraform/accounts/foo/fogg.tf
@@ -44,6 +44,16 @@ variable account {
   type    = string
   default = "foo"
 }
+variable tags {
+  type = map(string)
+  default = {
+    project   = "foofoo"
+    env       = "accounts"
+    service   = "foo"
+    owner     = "foo@example.com"
+    managedBy = "terraform"
+  }
+}
 # map of aws_accounts
 variable aws_accounts {
   type = map
diff --git a/testdata/github_provider_yaml/terraform/accounts/foo/fogg.tf b/testdata/github_provider_yaml/terraform/accounts/foo/fogg.tf
index e023f7a3..d0cf5e7e 100644
--- a/testdata/github_provider_yaml/terraform/accounts/foo/fogg.tf
+++ b/testdata/github_provider_yaml/terraform/accounts/foo/fogg.tf
@@ -31,6 +31,16 @@ variable account {
   type    = string
   default = "foo"
 }
+variable tags {
+  type = map(string)
+  default = {
+    project   = "foo"
+    env       = "accounts"
+    service   = "foo"
+    owner     = "foo@example.com"
+    managedBy = "terraform"
+  }
+}
 # map of aws_accounts
 variable aws_accounts {
   type = map
diff --git a/testdata/okta_provider_yaml/terraform/accounts/foo/fogg.tf b/testdata/okta_provider_yaml/terraform/accounts/foo/fogg.tf
index 2f2a731d..87c06d78 100644
--- a/testdata/okta_provider_yaml/terraform/accounts/foo/fogg.tf
+++ b/testdata/okta_provider_yaml/terraform/accounts/foo/fogg.tf
@@ -33,6 +33,16 @@ variable account {
   type    = string
   default = "foo"
 }
+variable tags {
+  type = map(string)
+  default = {
+    project   = "foofoo"
+    env       = "accounts"
+    service   = "foo"
+    owner     = "foo@example.com"
+    managedBy = "terraform"
+  }
+}
 # map of aws_accounts
 variable aws_accounts {
   type = map
diff --git a/testdata/snowflake_provider_yaml/terraform/accounts/foo/fogg.tf b/testdata/snowflake_provider_yaml/terraform/accounts/foo/fogg.tf
index d723371a..18f66790 100644
--- a/testdata/snowflake_provider_yaml/terraform/accounts/foo/fogg.tf
+++ b/testdata/snowflake_provider_yaml/terraform/accounts/foo/fogg.tf
@@ -32,6 +32,16 @@ variable account {
   type    = string
   default = "foo"
 }
+variable tags {
+  type = map(string)
+  default = {
+    project   = "foo"
+    env       = "accounts"
+    service   = "foo"
+    owner     = "foo@example.com"
+    managedBy = "terraform"
+  }
+}
 # map of aws_accounts
 variable aws_accounts {
   type = map
diff --git a/testdata/tfe_provider_yaml/terraform/accounts/foo/fogg.tf b/testdata/tfe_provider_yaml/terraform/accounts/foo/fogg.tf
index a5b6ba3a..bcc749c7 100644
--- a/testdata/tfe_provider_yaml/terraform/accounts/foo/fogg.tf
+++ b/testdata/tfe_provider_yaml/terraform/accounts/foo/fogg.tf
@@ -30,6 +30,16 @@ variable account {
   type    = string
   default = "foo"
 }
+variable tags {
+  type = map(string)
+  default = {
+    project   = "foo"
+    env       = "accounts"
+    service   = "foo"
+    owner     = "foo@example.com"
+    managedBy = "terraform"
+  }
+}
 # map of aws_accounts
 variable aws_accounts {
   type = map
diff --git a/testdata/v2_full_yaml/terraform/accounts/bar/fogg.tf b/testdata/v2_full_yaml/terraform/accounts/bar/fogg.tf
index 90147248..4ff27015 100644
--- a/testdata/v2_full_yaml/terraform/accounts/bar/fogg.tf
+++ b/testdata/v2_full_yaml/terraform/accounts/bar/fogg.tf
@@ -72,6 +72,16 @@ variable account {
   type    = string
   default = "bar"
 }
+variable tags {
+  type = map(string)
+  default = {
+    project   = "proj"
+    env       = "accounts"
+    service   = "bar"
+    owner     = "foo@example.com"
+    managedBy = "terraform"
+  }
+}
 # map of aws_accounts
 variable aws_accounts {
   type = map
diff --git a/testdata/v2_full_yaml/terraform/accounts/foo/fogg.tf b/testdata/v2_full_yaml/terraform/accounts/foo/fogg.tf
index 347b9d2d..372acda9 100644
--- a/testdata/v2_full_yaml/terraform/accounts/foo/fogg.tf
+++ b/testdata/v2_full_yaml/terraform/accounts/foo/fogg.tf
@@ -44,6 +44,16 @@ variable account {
   type    = string
   default = "foo"
 }
+variable tags {
+  type = map(string)
+  default = {
+    project   = "proj"
+    env       = "accounts"
+    service   = "foo"
+    owner     = "foo@example.com"
+    managedBy = "terraform"
+  }
+}
 # map of aws_accounts
 variable aws_accounts {
   type = map