Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Terraforming

 Terraforming

My team heavily uses both Serverless and Terraform to build infrastructure, but as the number of projects we managed grew, it got harder to know how components were glued in different projects.
So we decided to try different ways to structure our projects in order
to :
– make better use terraform modules
– run terraform in a more secure manner
– share serverless components in a reliable way
– abstract complex infrastructure gluing
– faster project bootstrap times

David Przybilla

March 21, 2018
Tweet

More Decks by David Przybilla

Other Decks in Programming

Transcript

  1. many api gateways many lambdas many iam roles.. many everything..

    even they are not exactly related to each other
  2. database_synchornizer: main.tf vars.tf output.tf lambda.tf iam.tf … module api: main.tf

    vars.tf output.tf …. apigateways … ecs-cluster: main.tf vars.tf output.tf ….
  3. so we made our own GitHub repo only for modules,

    similar to: we realise we could share modules
  4. bootstrapping should: take little effort be fast be easy for

    a new team member complexity should be hidden
  5. module “terraform_pipeline" { source = “git::git@:…//terraform_pipeline?ref=vx.y” notifications_channel = “slack channel”

    terraform_role_arn = “some::arn::role” env = "stg" name = “my_project" } importing this module
  6. module “terraform_pipeline" { source = “git::git@:…//terraform_pipeline?ref=vx.y” notifications_channel = “slack-channel” terraform_role_arn

    = “some::arn::role” env = "stg" name = “my_project" } no need to remember this role anymore! importing this module
  7. importer does not need to worry about : how to

    send notifications to slack .. details are hidden for importer ..
  8. .. details are hidden for importer .. importer does not

    need to worry about : how to run terraform how to send notifications to slack
  9. .. details are hidden for importer .. importer does not

    need to worry about : how to run terraform module knows that (inside) how to send notifications to slack
  10. .. details are hidden for importer .. importer does not

    need to worry about : how to run terraform module knows that (inside) how to send notifications to slack a new team member can import it quickly
  11. my_new_project/ tf
 /modules /stg .tfversion /prd .tfversion terraform ci module

    : 1. downloads terraform version specified in .tfversion 2. knows how to run a terraform binary 3. knows how to get git credentials to fetch to our private modules 4. knows how to send notifications to slack
  12. my_new_project/ tf
 /modules /stg .tfversion /prd .tfversion want to run

    terraform for stg? go to stg folder want to run terraform for prd? go to prd folder
  13. reduced the complexity of bootstrapping a project means a faster

    team also I am less scared to run terraform
  14. reduced the complexity of bootstrapping a project means a faster

    team also I am less scared to run terraform all projects use the same pipeline
  15. serverless serverless “applications” > serverless install --url <service-github-url> > sls

    deploy code + glue + infrastructure i.e: serverless service to get a slack bot via FaaS
  16. how are you structuring your terraform projects ? how are

    you running terraform? my team is using terraform + github.com/serverless/serverless
  17. how are you structuring your terraform projects ? how are

    you running terraform? my team is using terraform + github.com/serverless/serverless feel free to talk to me! I would like to learn more