Skip to content

Instantly share code, notes, and snippets.

@tcnksm
Created November 7, 2019 10:57
Show Gist options
  • Save tcnksm/7b430f7955beac1ebb5b4d2fb26b40f7 to your computer and use it in GitHub Desktop.
Save tcnksm/7b430f7955beac1ebb5b4d2fb26b40f7 to your computer and use it in GitHub Desktop.
Terraform at Mercari

Terraform at Mercari

2019-11-07

State of Terraform usage

All microservices-related tf codes are in one single repository

Scale

  • 30,000+ commits
  • 3800+ tf files (150,000 LoC)
  • 350+ contributors
  • 400+ states

Custom modules

  • microservices-starter-kit
  • vault
  • memorystore

Directory structure

.
├── script
├── terraform
│   ├── microservices
│   │   ├── <Service ID>
│   │   │   ├── development
│   │   │   └── production

│   ├── microservices-platform
│   │   ├── <Service ID>
│   │   │   ├── development
│   │   │   └── production

State management

Each directory has its own state. No state sharing. Each services are strictly isolated.

Release management

Github flow (plan on PR, apply when merge into master)

Automation

Delegation

MTC2018 - Microservices Platform at Mercari

  • Developers write the terraform codes by themself
  • Developers uses bootstrap codes to setup new project
    • It asks required information like service name or corporation (Mercari vs. Merpay)
    • It generates direcotry and update CODEOWNER
  • Developers need to review terraform codes by themselves (CODEOWNER)
  • Developers can ask review to platform team by Github label (support wanted)

Conclusion

We want to move to Kubernetes reconcile way from terraform state management (See Config Connector)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment