Skip to content

Commit

Permalink
Update 2024-02-23-Pulumi-end-to-end-on-Azure.md
Browse files Browse the repository at this point in the history
  • Loading branch information
kristinevog authored Feb 23, 2024
1 parent a7ef9bd commit 8910b96
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions _posts/2024-02-23-Pulumi-end-to-end-on-Azure.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ Terraform will perform the following actions:
<span class="hljs-section">aws_s3_bucket_ownership_controls.terraform-bucket: Creation complete after 1s [id=env0-terraform-example]</span>
<span class="hljs-section">aws_s3_bucket_acl.terraform-bucket: Creating...</span>
<span class="hljs-section">aws_s3_bucket_acl.terraform-bucket: Creation complete after 0s [id=env0-terraform-example,private]</span>
</code></pre></div><h4><strong>Cleanup with Terraform</strong></h4><p>To go ahead and clean up, run terraform destroy<strong>.</strong></p><h2><strong>Pulumi AWS S3 Bucket Example</strong></h2><p>Since you can use different programming languages with Pulumi, I'm most comfortable with Python, so we'll go with that.</p><p>To get started with Pulumi, I can use the command <span class="code">pulumi new</span>. Here's what happens when you run <span class="code">pulumi new</span>:</p><ol role="list"><li><strong>Template Selection</strong>: Pulumi will first ask you to pick a template – AWS Python stack, an Azure TypeScript stack, or one of a number of others. You can even use your own custom template if you have one. For this tutorial, I’m using AWS Python.</li><li><strong>Project Metadata</strong>: You'll be prompted to fill in some metadata for your new project, like the project name, stack name, and sometimes config values that the template requires. This sets up the<strong> pulumi.yaml</strong> and <strong>pulumi.[stack-name].yaml</strong> files.</li><li><strong>File Generation</strong>: Pulumi will generate a set of files based on the template you chose. These usually include a <strong>pulumi.yaml</strong> file for the project metadata and source files in the language of your choice (e.g., <span class="code">__main__.py</span> for Python and for our example).</li><li><strong>Install Dependencies</strong>: If the template has any dependencies (like AWS SDK for a Python AWS template), Pulumi will install them for you.</li><li><strong>Ready to Go</strong>: After all this, you'll have a new Pulumi project directory all set up and ready for you to start coding your infrastructure.</li></ol><p>I can then cd into our project directory and run <span class="code">pulumi up</span> to deploy our new stack, but first, I have to edit the generated <strong>code in __main__.py </strong>to tailor it to our specific needs.</p><p>I've taken a few screenshots of this process below.</p><figure class="w-richtext-figure-type-image w-richtext-align-fullwidth" style="max-width:896pxpx"><div><img alt="Selecting our aws-python template" src="https://assets-global.website-files.com/63eb9bf7fa9e2724829607c1/652ea9f3ab2db3a44b64af2c_4F9C6URRQQl9UgwEzUHnLvBK-UIdMRDtF0hW2ejhqoZKxZXoRh_AMKskN-l62aBYF8wGc1skdu2bVKYsnI3l5yD_CvFlqoCN6KiwsSMUnYM3kAgGVVqUrQySj5ODfuya9FKAnptJ6ZtnT_husW-aadM.png"></div></figure><figure class="w-richtext-figure-type-image w-richtext-align-fullwidth" style="max-width:896pxpx"><div><img alt="Answering a few prompts and installing dependencies" src="https://assets-global.website-files.com/63eb9bf7fa9e2724829607c1/652ea9f4878288ffe95f0d01_iqR3RENqEgSVpnb89lpO6_cHwen9qtASUTJvCkecr79ymcyqGvTt_v9t3D2cRzFzVU_j0PAu2WR2gDKij7KKHW_nKvJhVSaEcNBBwbOHqnDTKJiY6lcml-ZTyiTBqz3y8rWx3QJ2Vli5Y0IjlEhPBZw.png"></div></figure><figure class="w-richtext-figure-type-image w-richtext-align-fullwidth" style="max-width:719pxpx"><div><img alt="Our project is ready" src="https://assets-global.website-files.com/63eb9bf7fa9e2724829607c1/652ea9f3e582c8ebe1230a8a_t3pS193RlEVY22ul9MxziKwenSvN0uDr-xA0MJE16mFVf5Agcmr0iFmhJ0UxQsxTRkKzCoUJwqwfkyei3hOkdYLrHxfGrK6_XXXjh3hZR-2LbTOoBG0BJcsSxPHjqQa1UyGXockc2hsr4RbGWD7AqEw.png"></div></figure><h4><strong>Pulumi Files</strong></h4><p>These are the files that were created in the previous process.</p><p><strong>pulumi.s3-pulumi-test.yaml</strong></p><div class="w-embed"><pre><code class="code-block hljs language-yaml"><span class="hljs-attr">config:</span>
</code></pre></div><h4><strong>Cleanup with Terraform</strong></h4><p>To go ahead and clean up, run terraform destroy<strong>.</strong></p><h2><strong>Pulumi AWS S3 Bucket Example</strong></h2><p>Since you can use different programming languages with Pulumi, I'm most comfortable with Python, so we'll go with that.</p><p>To get started with Pulumi, I can use the command <span class="code">pulumi new</span>. Here's what happens when you run <span class="code">pulumi new</span>:</p><ol role="list"><li><strong>Template Selection</strong>: Pulumi will first ask you to pick a template – AWS Python stack, an Azure TypeScript stack, or one of a number of others. You can even use your own custom template if you have one. For this tutorial, I’m using AWS Python.</li><li><strong>Project Metadata</strong>: You'll be prompted to fill in some metadata for your new project, like the project name, stack name, and sometimes config values that the template requires. This sets up the<strong> pulumi.yaml</strong> and <strong>pulumi.[stack-name].yaml</strong> files.</li><li><strong>File Generation</strong>: Pulumi will generate a set of files based on the template you chose. These usually include a <strong>pulumi.yaml</strong> file for the project metadata and source files in the language of your choice (e.g., <span class="code">__main__.py</span> for Python and for our example).</li><li><strong>Install Dependencies</strong>: If the template has any dependencies (like AWS SDK for a Python AWS template), Pulumi will install them for you.</li><li><strong>Ready to Go</strong>: After all this, you'll have a new Pulumi project directory all set up and ready for you to start coding your infrastructure.</li></ol><p>I can then cd into our project directory and run <span class="code">pulumi up</span> to deploy our new stack, but first, I have to edit the generated <strong>code in __main__.py </strong>to tailor it to our specific needs.</p><p>I've taken a few screenshots of this process below.</p><figure class="w-richtext-figure-type-image" style="max-width:896pxpx"><div><img alt="Selecting our aws-python template" src="https://assets-global.website-files.com/63eb9bf7fa9e2724829607c1/652ea9f3ab2db3a44b64af2c_4F9C6URRQQl9UgwEzUHnLvBK-UIdMRDtF0hW2ejhqoZKxZXoRh_AMKskN-l62aBYF8wGc1skdu2bVKYsnI3l5yD_CvFlqoCN6KiwsSMUnYM3kAgGVVqUrQySj5ODfuya9FKAnptJ6ZtnT_husW-aadM.png"></div></figure><figure class="w-richtext-figure-type-image" style="max-width:896pxpx"><div><img alt="Answering a few prompts and installing dependencies" src="https://assets-global.website-files.com/63eb9bf7fa9e2724829607c1/652ea9f4878288ffe95f0d01_iqR3RENqEgSVpnb89lpO6_cHwen9qtASUTJvCkecr79ymcyqGvTt_v9t3D2cRzFzVU_j0PAu2WR2gDKij7KKHW_nKvJhVSaEcNBBwbOHqnDTKJiY6lcml-ZTyiTBqz3y8rWx3QJ2Vli5Y0IjlEhPBZw.png"></div></figure><figure class="w-richtext-figure-type-image" style="max-width:719pxpx"><div><img alt="Our project is ready" src="https://assets-global.website-files.com/63eb9bf7fa9e2724829607c1/652ea9f3e582c8ebe1230a8a_t3pS193RlEVY22ul9MxziKwenSvN0uDr-xA0MJE16mFVf5Agcmr0iFmhJ0UxQsxTRkKzCoUJwqwfkyei3hOkdYLrHxfGrK6_XXXjh3hZR-2LbTOoBG0BJcsSxPHjqQa1UyGXockc2hsr4RbGWD7AqEw.png"></div></figure><h4><strong>Pulumi Files</strong></h4><p>These are the files that were created in the previous process.</p><p><strong>pulumi.s3-pulumi-test.yaml</strong></p><div class="w-embed"><pre><code class="code-block hljs language-yaml"><span class="hljs-attr">config:</span>
<span class="hljs-attr">aws:region:</span> <span class="hljs-string">us-east-1</span>
</code></pre></div><p><strong>pulumi.yaml</strong></p><div class="w-embed"><pre><code class="code-block hljs language-yaml"><span class="hljs-attr">name:</span> <span class="hljs-string">PulumiTest</span>
<span class="hljs-attr">runtime:</span>
Expand Down Expand Up @@ -290,4 +290,4 @@ Outputs:
Resources:
+ <span class="hljs-number">3</span> created

Duration: 5s</code></pre></div><strong>Cleanup with Pulumi</strong></h4><p>Now go ahead and run <span class="code">pulumi destroy</span> to clean up and delete the bucket.</p><h2><strong>Summary</strong></h2><p>In conclusion, both Terraform and Pulumi offer powerful features and benefits for managing and deploying infrastructure. While Terraform’s maturity and extensive community support make it a popular choice, Pulumi’s developer-friendly approach and growing ecosystem position it as an increasingly attractive alternative.&nbsp;</p><p>By considering factors such as language support, state management, community resources, and specific use cases, organizations can make an informed decision between these two powerful IaC tools to best meet their infrastructure management needs. Better yet, use both with env0 since it's a framework-agnostic platform.<br>&zwj;</p>
Duration: 5s</code></pre></div><h4><strong>Cleanup with Pulumi</strong></h4><p>Now go ahead and run <span class="code">pulumi destroy</span> to clean up and delete the bucket.</p><h2><strong>Summary</strong></h2><p>In conclusion, both Terraform and Pulumi offer powerful features and benefits for managing and deploying infrastructure. While Terraform’s maturity and extensive community support make it a popular choice, Pulumi’s developer-friendly approach and growing ecosystem position it as an increasingly attractive alternative.&nbsp;</p><p>By considering factors such as language support, state management, community resources, and specific use cases, organizations can make an informed decision between these two powerful IaC tools to best meet their infrastructure management needs. Better yet, use both with env0 since it's a framework-agnostic platform.<br>&zwj;</p>

0 comments on commit 8910b96

Please sign in to comment.