Creating resources in multiple AWS accounts using Terraform

<p>As a beginner when I was creating my first terraform code, I created an EC2 instance with a role attached that had the necessary IAM privileges. This kind of made it easy for me to not expose any keys or go into too many configurations when setting up the provider.</p> <pre> terraform { required_providers { aws = { source = &quot;hashicorp/aws&quot; version = &quot;~&gt; 5.0&quot; } } } # Configure the AWS Provider provider &quot;aws&quot; { region = &quot;us-east-1&quot; }</pre> <p>Now it worked all well and good (OK after a lot of debugging ) in the required account, but life can&rsquo;t be that easy now, can it?</p> <p>I soon got the task of expanding and parameterizing my code to scripts to deploy resources in multiple accounts. Now this may come as a no-brainer to expert cloud and terraform engineers but it was a bit out of the box for me at that time.</p> <p>As any developer, I went to Google and Stack Overflow for help and either I didn&rsquo;t phrase my problem correctly or there wasn&rsquo;t anyone with a similar issue out there, and I did not find a good solution with an explanation for it. Writing this article for future junior Terraform developers if they ever come across a similar problem.</p> <p><a href="https://medium.com/@syedahmedismail98/creating-resources-in-multiple-aws-accounts-using-terraform-cd1868758aab"><strong>Visit Now</strong></a></p>
Tags: Multiple AWS