{"id":1191,"date":"2026-07-20T11:27:53","date_gmt":"2026-07-20T04:27:53","guid":{"rendered":"https:\/\/thoaicoder.com\/?p=1191"},"modified":"2026-11-17T13:15:14","modified_gmt":"2026-11-17T06:15:14","slug":"automating-multi-tenant-aws-infrastructure-with-terraform","status":"publish","type":"post","link":"https:\/\/thoaicoder.com\/index.php\/2026\/07\/20\/automating-multi-tenant-aws-infrastructure-with-terraform\/","title":{"rendered":"Automating Multi-Tenant AWS Infrastructure with Terraform"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><em>Tenants as Data: lessons from running two Toyota markets on one stack<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Every multi-tenant platform eventually asks how to add a new customer without copy-pasting half the infrastructure. This post shows how a telematics integration service handles it with Terraform. Adding a market is a small code change, not a new project.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The problem<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The service connects our platform to Toyota&#8217;s telematics service providers (TSPs). It serves two markets, each of which we treat as a <strong>tenant<\/strong>, called a <em>channel<\/em> in the code:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>tmca<\/code> for Australia<\/li>\n\n\n\n<li><code>tnz<\/code> for New Zealand<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Each tenant needs its own API path (<code>\/tmca\/...<\/code>, <code>\/tnz\/...<\/code>), its own routing rules, its own DNS names and API key, and tenant-specific behaviour in the application. We also needed <strong>demo tenants<\/strong> (<code>tmcademo<\/code>, <code>tnzdemo<\/code>) that behave like the real ones but talk to a mock TSP instead of Toyota.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Three ways to model tenants<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>Model<\/th><th>Isolation<\/th><th>Cost<\/th><th>Consistency<\/th><th>Ops effort<\/th><\/tr><\/thead><tbody><tr><td>Stack per tenant (copy of the code)<\/td><td>High<\/td><td>High<\/td><td>Drifts over time<\/td><td>High<\/td><\/tr><tr><td>Workspace\/state per tenant<\/td><td>High<\/td><td>High<\/td><td>Good<\/td><td>Medium<\/td><\/tr><tr><td><strong>Shared stack, tenants via <code>for_each<\/code><\/strong><\/td><td>Low<\/td><td>Low<\/td><td>Excellent<\/td><td>Low<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The two markets have near-identical behaviour, traffic is modest, and the product team wanted new markets quickly. We chose the shared stack. The trade-offs are covered later.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Pattern 1: tenants are a list, everything else is derived<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The whole tenant model starts with one local value:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>locals {\n  # Real Toyota TSP\n  channels_integrated = [\"tmca\", \"tnz\"]\n\n  # Mock TSP, for demos and testing\n  channels_mocked = [\"tmcademo\", \"tnzdemo\"]\n\n  channels_served = concat(local.channels_integrated, local.channels_mocked)\n\n  primary_channel        = local.channels_integrated[0]\n  primary_mocked_channel = local.channels_mocked[0]\n  has_mocked_channels    = length(local.channels_mocked) &gt; 0\n\n  channel_routing_priorities = {\n    \"tmca\"     = 15\n    \"tnz\"      = 20\n    \"tmcademo\" = 65\n    \"tnzdemo\"  = 70\n  }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Service names, DNS records, API Gateway resources and discovery entries are all computed from these lists. Nothing else in the codebase hard-codes the tenant names.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Pattern 2: one primary, lightweight aliases for the rest<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Running a full ECS service, load balancer and gateway per tenant would defeat the point. Instead, the <strong>primary tenant owns the heavy resources<\/strong>, and every other tenant gets only a thin alias that points at it.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>locals {\n  ambassador_service_names = { for chan in local.channels_integrated : chan =&gt; \"${chan}-ambassador\" }\n}\n\n# Real service, created once, for the primary tenant\nresource \"aws_service_discovery_service\" \"ambassador_service\" {\n  name = local.ambassador_service_names[local.primary_channel]\n  # ...\n}\n\n# Alias per additional tenant, as a CNAME to the primary\nresource \"aws_service_discovery_service\" \"ambassador_service_alt\" {\n  for_each = { for k, v in local.ambassador_service_names : k =&gt; v if k != local.primary_channel }\n  name     = each.value\n\n  dns_config {\n    namespace_id = local.service_registry_id\n    dns_records {\n      ttl  = 2\n      type = \"CNAME\"\n    }\n    routing_policy = \"WEIGHTED\"\n  }\n}\n\nresource \"aws_route53_record\" \"ambassador_reference_record_alt\" {\n  for_each = { for k, v in local.ambassador_service_names : k =&gt; v if k != local.primary_channel }\n  name     = \"${each.key}.ambassador.\"\n  type     = \"CNAME\"\n  zone_id  = data.aws_route53_zone.private_hosted_zone_ambassador.id\n  ttl      = \"600\"\n  records  = [\"${local.ambassador_service_name_primary}.service.\"]\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The <code>if k != local.primary_channel<\/code> filter in the <code>for_each<\/code> expression is the idiom doing the work. Internally, <code>tnz-ambassador<\/code> resolves to <code>tmca-ambassador<\/code>, so there is one set of containers and as many names as tenants.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Pattern 3: a per-tenant API surface<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">All tenants share one REST API in API Gateway, and each gets its own path. First we build a map from each tenant to the stack that serves it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>locals {\n  channel_interfaces_integrated = { for chan in local.channels_integrated : chan =&gt; local.primary_channel }\n  channel_interfaces_mocked     = { for chan in local.channels_mocked     : chan =&gt; local.primary_mocked_channel }\n  channel_interfaces            = merge(local.channel_interfaces_integrated, local.channel_interfaces_mocked)\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Every API resource then iterates over it:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>resource \"aws_api_gateway_resource\" \"adapter_interface_channel_root\" {\n  for_each    = local.channel_interfaces\n  rest_api_id = data.aws_api_gateway_rest_api.tsp_integration.id\n  parent_id   = data.aws_api_gateway_rest_api.tsp_integration.root_resource_id\n  path_part   = lower(each.key)      # \/tmca, \/tnz, \/tmcademo, \/tnzdemo\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The same <code>for_each<\/code> creates the <code>\/services\/{proxy+}<\/code> and vehicle endpoints, their methods and integrations, and a request validator per tenant.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Pattern 4: stage variables pick the backend<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Each tenant gets its own API Gateway deployment through a reusable module. The interesting part is how a tenant chooses between the real and the mocked backend:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>module \"adapter_api_deployment\" {\n  for_each = local.channel_interfaces\n  source   = \"git@github.com:&lt;org&gt;\/&lt;tsp-services-repo&gt;.git\/\/component-infra\/modules\/tsp-adapter-stage?ref=main\"\n\n  channel = each.key\n\n  stage_variables = {\n    \"adapter_vpc_link_id\"    = contains(local.channels_mocked, each.key) ? aws_api_gateway_vpc_link.adapter_mocked[0].id    : aws_api_gateway_vpc_link.adapter.id\n    \"ambassador_vpc_link_id\" = contains(local.channels_mocked, each.key) ? aws_api_gateway_vpc_link.ambassador_mocked[0].id : aws_api_gateway_vpc_link.ambassador.id\n    \"mock_vpc_link_id\"       = contains(local.channels_mocked, each.key) ? aws_api_gateway_vpc_link.mock_demo[0].id         : aws_api_gateway_vpc_link.mock.id\n  }\n\n  routing_rule_priority = local.channel_routing_priorities[each.key]\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The API definitions are identical for every tenant. A VPC link stage variable decides whether a request goes to the real network load balancer or the mocked one. That is how <code>\/tnzdemo<\/code> and <code>\/tnz<\/code> can share an API model but never share a backend.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Pattern 5: mock tenants as first-class citizens<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Demo tenants are a normal part of the stack. The mocked adapter is configured differently from the real one:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>adapter_mocked_env_vars = concat([\n  { name = \"TSP_VEHICLES_HOST\", value = \"http:\/\/${local.mock_demo_service_name_primary}.service:8080\" },\n  # Demo traffic must not trigger real failure alerts\n  { name = \"FAILURE_TOPIC\", value = \"\" },\n  # No real credentials needed\n  { name = \"tsp.apikey\", value = \"mock\" },\n  { name = \"SHOULD_SEND_MOCK_DATA\", value = \"true\" },\n  # Tenant-to-country mapping\n  { name = \"vehicle.channel.countries.AU\", value = upper(local.channels_mocked[0]) },\n  { name = \"vehicle.channel.countries.NZ\", value = upper(local.channels_mocked[1]) },\n  { name = \"TSP_CACHE_TABLE_NAME\", value = aws_dynamodb_table.tsp_data_dynamodb_table_mocked.name },\n], ...)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The mocked stack gets:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>its own DynamoDB cache table, so test data can never pollute production data<\/li>\n\n\n\n<li>stubbed credentials, so no real secrets are exposed to demo traffic<\/li>\n\n\n\n<li>no failure-topic publishing, so demo traffic doesn&#8217;t page anyone<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The mocked resources are also optional. Each is wrapped in <code>for_each = local.has_mocked_channels ? {...} : {}<\/code>, so an environment with no mocked channels creates none of them.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Tenants vs environments: two different axes<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">It is easy to blur these, so we keep them separate:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Environments<\/strong> (dev, test, prod) are separated by <strong>AWS account<\/strong>. Terragrunt reads one config file per account.<\/li>\n\n\n\n<li><strong>Tenants<\/strong> (<code>tmca<\/code>, <code>tnz<\/code>) are separated <strong>inside<\/strong> a stack with <code>for_each<\/code>.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Each environment therefore runs the same code and creates the same tenants. A single <code>terraform apply<\/code> updates every tenant in that account.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Pitfalls and lessons learned<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>1. No compute isolation.<\/strong> Tenants share ECS tasks and load balancers. A bad deploy or a noisy neighbour affects both markets. This is acceptable for two similar markets and wouldn&#8217;t be for tenants with different SLAs or compliance needs.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>2. The primary is positional.<\/strong> <code>primary_channel = channels_integrated[0]<\/code> means reordering the list changes which tenant owns the real resources, which causes recreation. An explicit <code>primary_channel<\/code> variable would be safer.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>3. Index-based assumptions don&#8217;t scale.<\/strong> Mapping <code>AU<\/code> to <code>channels[0]<\/code> and <code>NZ<\/code> to <code>channels[1]<\/code> works for two tenants. A third market would need code changes, not just a list entry.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>4. <code>for_each<\/code> keys are identities.<\/strong> Terraform tracks resources by key, so renaming a tenant is a destroy and create, or a <code>terraform state mv<\/code>. Choose tenant keys carefully and treat them as permanent.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>5. Parallel lists drift.<\/strong> Tenant names, priorities and country codes live in separate structures. It is easy to update one and forget another.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>6. Redeployments need a nudge.<\/strong> API Gateway deployments don&#8217;t redeploy automatically when methods change. We pass a <code>redeployment_change_hash<\/code> built from the file contents and the key integration IDs, which forces a new deployment when they change.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What I&#8217;d do next<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The biggest improvement is to replace the parallel lists with <strong>one object per tenant<\/strong>. This is my proposed design, not what the repo does today:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>variable \"tenants\" {\n  type = map(object({\n    country  = string\n    priority = number\n    mocked   = bool\n  }))\n  default = {\n    tmca     = { country = \"AU\", priority = 15, mocked = false }\n    tnz      = { country = \"NZ\", priority = 20, mocked = false }\n    tmcademo = { country = \"AU\", priority = 65, mocked = true }\n    tnzdemo  = { country = \"NZ\", priority = 70, mocked = true }\n  }\n}<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">That removes the index lookups and the drift between lists. Adding a market becomes a single, self-describing entry, and you can derive <code>integrated<\/code>, <code>mocked<\/code> and <code>primary<\/code> from it with simple <code>for<\/code> expressions. Beyond that:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>extract the tenant-specific resources into a module<\/li>\n\n\n\n<li>run <code>terraform plan<\/code> per environment in CI, with policy checks such as Checkov<\/li>\n\n\n\n<li>define an exit criterion for graduating a tenant to its own isolated stack, for example a stricter SLA, a different data residency rule or sustained heavy traffic<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Takeaways<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Model tenants as data<\/strong>, and derive every name, route and record from it.<\/li>\n\n\n\n<li><strong>Share the expensive parts, alias the cheap ones.<\/strong> A primary tenant owns the compute, and the others own names and routes.<\/li>\n\n\n\n<li><strong>Use stage variables or similar indirection<\/strong> so one API definition can serve real and mock backends.<\/li>\n\n\n\n<li><strong>Treat mock tenants as real citizens<\/strong> with isolated data, stubbed secrets and no alerting.<\/li>\n\n\n\n<li><strong>Keep environments and tenants on separate axes.<\/strong><\/li>\n\n\n\n<li><strong>Know where shared tenancy stops working<\/strong>, and write down when you would split.<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Multi-tenancy in Terraform doesn&#8217;t need a framework. A map, <code>for_each<\/code> and a few conditional expressions go a long way, as long as you are honest about the isolation you&#8217;re giving up.<\/p>\n\n","protected":false},"excerpt":{"rendered":"<p>Tenants as Data: lessons from running two Toyota markets on one stack Every multi-tenant platform [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1192,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[59],"tags":[],"class_list":["post-1191","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cloud-computing"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v19.14 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Automating Multi-Tenant AWS Infrastructure with Terraform - I \u2764 Code<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/thoaicoder.com\/index.php\/2026\/07\/20\/automating-multi-tenant-aws-infrastructure-with-terraform\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Automating Multi-Tenant AWS Infrastructure with Terraform - I \u2764 Code\" \/>\n<meta property=\"og:description\" content=\"Tenants as Data: lessons from running two Toyota markets on one stack Every multi-tenant platform [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/thoaicoder.com\/index.php\/2026\/07\/20\/automating-multi-tenant-aws-infrastructure-with-terraform\/\" \/>\n<meta property=\"og:site_name\" content=\"I \u2764 Code\" \/>\n<meta property=\"article:published_time\" content=\"2026-07-20T04:27:53+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-11-17T06:15:14+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/thoaicoder.com\/wp-content\/uploads\/2026\/07\/Featured-Multi-Tenant-HPCAI-cluster_.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"920\" \/>\n\t<meta property=\"og:image:height\" content=\"500\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Thoai\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Thoai\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/thoaicoder.com\/index.php\/2026\/07\/20\/automating-multi-tenant-aws-infrastructure-with-terraform\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/thoaicoder.com\/index.php\/2026\/07\/20\/automating-multi-tenant-aws-infrastructure-with-terraform\/\"},\"author\":{\"name\":\"Thoai\",\"@id\":\"https:\/\/thoaicoder.com\/#\/schema\/person\/a3304c209434f63c501b05622d7d2720\"},\"headline\":\"Automating Multi-Tenant AWS Infrastructure with Terraform\",\"datePublished\":\"2026-07-20T04:27:53+00:00\",\"dateModified\":\"2026-11-17T06:15:14+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/thoaicoder.com\/index.php\/2026\/07\/20\/automating-multi-tenant-aws-infrastructure-with-terraform\/\"},\"wordCount\":988,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/thoaicoder.com\/#\/schema\/person\/a3304c209434f63c501b05622d7d2720\"},\"articleSection\":[\"Cloud computing\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/thoaicoder.com\/index.php\/2026\/07\/20\/automating-multi-tenant-aws-infrastructure-with-terraform\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/thoaicoder.com\/index.php\/2026\/07\/20\/automating-multi-tenant-aws-infrastructure-with-terraform\/\",\"url\":\"https:\/\/thoaicoder.com\/index.php\/2026\/07\/20\/automating-multi-tenant-aws-infrastructure-with-terraform\/\",\"name\":\"Automating Multi-Tenant AWS Infrastructure with Terraform - I \u2764 Code\",\"isPartOf\":{\"@id\":\"https:\/\/thoaicoder.com\/#website\"},\"datePublished\":\"2026-07-20T04:27:53+00:00\",\"dateModified\":\"2026-11-17T06:15:14+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/thoaicoder.com\/index.php\/2026\/07\/20\/automating-multi-tenant-aws-infrastructure-with-terraform\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/thoaicoder.com\/index.php\/2026\/07\/20\/automating-multi-tenant-aws-infrastructure-with-terraform\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/thoaicoder.com\/index.php\/2026\/07\/20\/automating-multi-tenant-aws-infrastructure-with-terraform\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/thoaicoder.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Automating Multi-Tenant AWS Infrastructure with Terraform\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/thoaicoder.com\/#website\",\"url\":\"https:\/\/thoaicoder.com\/\",\"name\":\"I \u2764 Code\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/thoaicoder.com\/#\/schema\/person\/a3304c209434f63c501b05622d7d2720\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/thoaicoder.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/thoaicoder.com\/#\/schema\/person\/a3304c209434f63c501b05622d7d2720\",\"name\":\"Thoai\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/thoaicoder.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/thoaicoder.com\/wp-content\/uploads\/2023\/03\/photo_2023-01-05_22-53-32.jpg\",\"contentUrl\":\"https:\/\/thoaicoder.com\/wp-content\/uploads\/2023\/03\/photo_2023-01-05_22-53-32.jpg\",\"width\":640,\"height\":640,\"caption\":\"Thoai\"},\"logo\":{\"@id\":\"https:\/\/thoaicoder.com\/#\/schema\/person\/image\/\"},\"sameAs\":[\"https:\/\/thoaicoder.com\",\"https:\/\/www.linkedin.com\/in\/huu-thoai-nguyen\/\"],\"url\":\"https:\/\/thoaicoder.com\/index.php\/author\/admin_cvyxq4b8\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Automating Multi-Tenant AWS Infrastructure with Terraform - I \u2764 Code","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/thoaicoder.com\/index.php\/2026\/07\/20\/automating-multi-tenant-aws-infrastructure-with-terraform\/","og_locale":"en_US","og_type":"article","og_title":"Automating Multi-Tenant AWS Infrastructure with Terraform - I \u2764 Code","og_description":"Tenants as Data: lessons from running two Toyota markets on one stack Every multi-tenant platform [&hellip;]","og_url":"https:\/\/thoaicoder.com\/index.php\/2026\/07\/20\/automating-multi-tenant-aws-infrastructure-with-terraform\/","og_site_name":"I \u2764 Code","article_published_time":"2026-07-20T04:27:53+00:00","article_modified_time":"2026-11-17T06:15:14+00:00","og_image":[{"width":920,"height":500,"url":"https:\/\/thoaicoder.com\/wp-content\/uploads\/2026\/07\/Featured-Multi-Tenant-HPCAI-cluster_.jpg","type":"image\/jpeg"}],"author":"Thoai","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Thoai","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/thoaicoder.com\/index.php\/2026\/07\/20\/automating-multi-tenant-aws-infrastructure-with-terraform\/#article","isPartOf":{"@id":"https:\/\/thoaicoder.com\/index.php\/2026\/07\/20\/automating-multi-tenant-aws-infrastructure-with-terraform\/"},"author":{"name":"Thoai","@id":"https:\/\/thoaicoder.com\/#\/schema\/person\/a3304c209434f63c501b05622d7d2720"},"headline":"Automating Multi-Tenant AWS Infrastructure with Terraform","datePublished":"2026-07-20T04:27:53+00:00","dateModified":"2026-11-17T06:15:14+00:00","mainEntityOfPage":{"@id":"https:\/\/thoaicoder.com\/index.php\/2026\/07\/20\/automating-multi-tenant-aws-infrastructure-with-terraform\/"},"wordCount":988,"commentCount":0,"publisher":{"@id":"https:\/\/thoaicoder.com\/#\/schema\/person\/a3304c209434f63c501b05622d7d2720"},"articleSection":["Cloud computing"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/thoaicoder.com\/index.php\/2026\/07\/20\/automating-multi-tenant-aws-infrastructure-with-terraform\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/thoaicoder.com\/index.php\/2026\/07\/20\/automating-multi-tenant-aws-infrastructure-with-terraform\/","url":"https:\/\/thoaicoder.com\/index.php\/2026\/07\/20\/automating-multi-tenant-aws-infrastructure-with-terraform\/","name":"Automating Multi-Tenant AWS Infrastructure with Terraform - I \u2764 Code","isPartOf":{"@id":"https:\/\/thoaicoder.com\/#website"},"datePublished":"2026-07-20T04:27:53+00:00","dateModified":"2026-11-17T06:15:14+00:00","breadcrumb":{"@id":"https:\/\/thoaicoder.com\/index.php\/2026\/07\/20\/automating-multi-tenant-aws-infrastructure-with-terraform\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/thoaicoder.com\/index.php\/2026\/07\/20\/automating-multi-tenant-aws-infrastructure-with-terraform\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/thoaicoder.com\/index.php\/2026\/07\/20\/automating-multi-tenant-aws-infrastructure-with-terraform\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/thoaicoder.com\/"},{"@type":"ListItem","position":2,"name":"Automating Multi-Tenant AWS Infrastructure with Terraform"}]},{"@type":"WebSite","@id":"https:\/\/thoaicoder.com\/#website","url":"https:\/\/thoaicoder.com\/","name":"I \u2764 Code","description":"","publisher":{"@id":"https:\/\/thoaicoder.com\/#\/schema\/person\/a3304c209434f63c501b05622d7d2720"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/thoaicoder.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/thoaicoder.com\/#\/schema\/person\/a3304c209434f63c501b05622d7d2720","name":"Thoai","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/thoaicoder.com\/#\/schema\/person\/image\/","url":"https:\/\/thoaicoder.com\/wp-content\/uploads\/2023\/03\/photo_2023-01-05_22-53-32.jpg","contentUrl":"https:\/\/thoaicoder.com\/wp-content\/uploads\/2023\/03\/photo_2023-01-05_22-53-32.jpg","width":640,"height":640,"caption":"Thoai"},"logo":{"@id":"https:\/\/thoaicoder.com\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/thoaicoder.com","https:\/\/www.linkedin.com\/in\/huu-thoai-nguyen\/"],"url":"https:\/\/thoaicoder.com\/index.php\/author\/admin_cvyxq4b8\/"}]}},"_links":{"self":[{"href":"https:\/\/thoaicoder.com\/index.php\/wp-json\/wp\/v2\/posts\/1191","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thoaicoder.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thoaicoder.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thoaicoder.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/thoaicoder.com\/index.php\/wp-json\/wp\/v2\/comments?post=1191"}],"version-history":[{"count":4,"href":"https:\/\/thoaicoder.com\/index.php\/wp-json\/wp\/v2\/posts\/1191\/revisions"}],"predecessor-version":[{"id":1222,"href":"https:\/\/thoaicoder.com\/index.php\/wp-json\/wp\/v2\/posts\/1191\/revisions\/1222"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/thoaicoder.com\/index.php\/wp-json\/wp\/v2\/media\/1192"}],"wp:attachment":[{"href":"https:\/\/thoaicoder.com\/index.php\/wp-json\/wp\/v2\/media?parent=1191"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thoaicoder.com\/index.php\/wp-json\/wp\/v2\/categories?post=1191"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thoaicoder.com\/index.php\/wp-json\/wp\/v2\/tags?post=1191"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}