Is there a way to break down terraform(or atlantis) output to different sections?

403 Views Asked by At

My team use terraform and atlantis to manage the infrastructure. We have created a repo that contains all projects' infra.

When starting a new microservice, we usually do it in this way.

  1. Draft the infra in terraform git repo.

    The infra contains:

    Backend

    • RDS
    • Memcached
    • Redis
    • EC2

    Frontend

    • S3 bucket to host the static website.
    • CloudFront
  2. Then, create a pull request in github and let Atlantis run atlantis apply.

  3. Then, Atlantis displays the output in the PR.

  4. Then, I copy different parts of terraform output to the backend team and frontend team.

enter image description here

Question

Does terraform output support category or section?

Or, is there an easier way to manipulate the output of atlantis and send different sections to different teams?

1

There are 1 best solutions below

0
On

Perhaps add an output map per team?

output "frontend" {
  value = {
    API_HOST   = ""
    AWS_BUCKET = ""
    AWS_REGION = ""
  }
}

output "backend" {
  value = {
    BACKEND_HOST = ""
    # ...
  }
}