Skip to content

Instantly share code, notes, and snippets.

@ctrombley
Created February 26, 2024 23:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ctrombley/bfac1ebe1cf45e0ba8a5f98d1b7b4fd6 to your computer and use it in GitHub Desktop.
Save ctrombley/bfac1ebe1cf45e0ba8a5f98d1b7b4fd6 to your computer and use it in GitHub Desktop.
Provision a large TFE org with Terraform
terraform {
cloud {
organization = "<YOUR_ORG>"
hostname = "<YOUR_HOST>"
workspaces {
tags = ["big-org-config"]
}
}
}
locals {
project_count = 100
workspaces_per_project = 100
}
provider "tfe" {
hostname = "<YOUR_HOST>"
token = "<YOUR_TOKEN>"
}
resource "tfe_project" "big-org-proj" {
count = local.project_count
organization = "big-org"
name = "proj-${count.index}"
}
resource "tfe_workspace" "big-org-ws" {
count = local.project_count * local.workspaces_per_project
organization = "big-org"
project_id = tfe_project.big-org-proj[floor(count.index / local.workspaces_per_project)].id
name = "ws-${count.index}"
tag_names = ["big-org"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment