@gmariano gmariano released this Nov 8, 2018 · 3 commits to master since this release

Assets 2

I did some refactoring on the terraform modules to fix some issues and make some improvements.
Essentially I did 2 things:

1) I changed the way how we use aws providers and how we pass them troughs sub-modules
2) I changed the sub-modules references replacing the github reference with the relative path (Thanks to Fernando for the hint)

Some more details:

1) I started this refactoring to solve the annoying problem provider configuration block is required for all operations when we remove from our projects modules containing sub-modules.
The problem was generated by a wrong usage of providers inside the modules.
I fixed it choosing Passing Providers Explicitly wich is the most powerful option because it offers the possibility to create resources in different regions (using multiple providers) in the same module.
For more info check the documentation: https://www.terraform.io/docs/modules/usage.html#providers-within-modules
One more thing: before to remove a module on old projects, update to the latest version and run the terraform script to apply the provider changes.

2) When we use a module in our project we usually do something like that

  source = "git@github.com:albumprinter/eops_tf_modules.git//apps/sns_topic?ref=v0.14.53"
  app_name    = "CustomerSubscription-SubscriptionEvent"
  providers = {
   aws = "aws"

Apparently terraform downloads the entire project git@github.com:albumprinter/eops_tf_modules.git. That means we are able to reference other modules directly using path reference instead a github ref.
In that way when we reference a specific branch or version, we are sure that all the sub-modules belong to the same version.

Important note: It is possible that some of your project will fail because I changed the module aws_account_core_data used everywhere without version reference. The solution is just update your project using the last version of the modules.