<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Marco Urrea on Medium]]></title>
        <description><![CDATA[Stories by Marco Urrea on Medium]]></description>
        <link>https://medium.com/@marco-urrea?source=rss-95a2f8629e76------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*rLgoo16BHfT8WXguyQWvsw.jpeg</url>
            <title>Stories by Marco Urrea on Medium</title>
            <link>https://medium.com/@marco-urrea?source=rss-95a2f8629e76------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 22:52:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@marco-urrea/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Moving out of Canad a— Moving money out of Canada]]></title>
            <link>https://marco-urrea.medium.com/moving-out-of-canad-a-moving-money-out-of-canada-a7675fb71a4f?source=rss-95a2f8629e76------2</link>
            <guid isPermaLink="false">https://medium.com/p/a7675fb71a4f</guid>
            <category><![CDATA[finance]]></category>
            <category><![CDATA[moving-abroad]]></category>
            <category><![CDATA[canada]]></category>
            <category><![CDATA[money]]></category>
            <dc:creator><![CDATA[Marco Urrea]]></dc:creator>
            <pubDate>Fri, 28 Feb 2025 07:21:35 GMT</pubDate>
            <atom:updated>2025-02-28T07:21:35.879Z</atom:updated>
            <content:encoded><![CDATA[<h2>Moving out of Canad — Moving money out of Canada</h2><p>I’m writing this out of frustration with the Canadian banking system, where you lack control over your own money due to their unreasonable transfer and spending limits. For the purpose of this story, we’ll focus on transfer limits.</p><p>As a newcomer to Canada, one of my initial challenges was purchasing significant items and settling my first month’s rent. Why? You might be wondering.</p><p>For instance, with RBC, there is a transaction limit of $1000, and a daily limit of $2000. Additionally, it is important to note that the daily transaction cutoff is at 6 pm, not 12 am.</p><p>So, about rent, you can only transfer $1000 per day. That means you’ll need to go to the bank and adjust the limit. And let’s be honest, we all know you can’t pay rent in Toronto with just $1000 per month for a one-bedroom apartment.</p><p>Now back to the subject matter, when moving out of Canada you may wonder how to move out your savings.</p><p>This is what I’ve learned:</p><ul><li>Norbert’s Gambit: strategy involves a small fee (less than$30 dollars) for purchasing and selling ETFs in USD.</li><li>Wise: wire transfers are cheaper with regular through your bank. Although there are some challenges. Some Canadian banks don’t have access to all its features like scotia bank, while you can add the account you cannot make direct payments and you end up doing a wire transfer anyway. There are also other banks like Neo financial that can’t even interact with wise.</li></ul><p>I’ll keep updating this post as I make progress with my journey.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a7675fb71a4f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Transfer Covid Passport to Toronto ,Canada]]></title>
            <link>https://marco-urrea.medium.com/transfer-covid-passport-to-toronto-canada-3d0850ecada?source=rss-95a2f8629e76------2</link>
            <guid isPermaLink="false">https://medium.com/p/3d0850ecada</guid>
            <dc:creator><![CDATA[Marco Urrea]]></dc:creator>
            <pubDate>Tue, 26 Oct 2021 20:59:21 GMT</pubDate>
            <atom:updated>2021-10-26T20:59:21.278Z</atom:updated>
            <content:encoded><![CDATA[<h3>Transfer Covid Passport to Toronto,Canada</h3><p>Go go to this link</p><p><a href="https://www.toronto.ca/home/covid-19/covid-19-vaccines/covid-19-proof-of-vaccination/">COVID-19: Proof of Vaccination</a></p><p>Click the blue button and upload your proof of registration</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9vsx25M3x1dYs1GLr78g4w.png" /></figure><p>This is what the form looks like</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xa4Rpl7BWTptpxe8lOirXg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3d0850ecada" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[UANL WES revalidación de estudios para migración a Canada]]></title>
            <link>https://marco-urrea.medium.com/uanl-wes-revalidaci%C3%B3n-de-estudios-para-migraci%C3%B3n-a-canada-4e2a8ee1a631?source=rss-95a2f8629e76------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e2a8ee1a631</guid>
            <category><![CDATA[we]]></category>
            <category><![CDATA[canada]]></category>
            <category><![CDATA[immigration]]></category>
            <category><![CDATA[uanl]]></category>
            <dc:creator><![CDATA[Marco Urrea]]></dc:creator>
            <pubDate>Tue, 26 Oct 2021 16:57:33 GMT</pubDate>
            <atom:updated>2021-10-26T17:00:13.822Z</atom:updated>
            <content:encoded><![CDATA[<p>Esto es para cualquiera que quiera revalidar sus estudios para aplicar a migración Canada; en este caso aplicado a la UANL que esta en Nuevo Leon.</p><h3>Requisitos</h3><ul><li>Licenciatura, Maestria o doctorado terminados.</li><li>Titulo</li><li>Certificado de estudios</li><li>Traducciones</li><li>Realizar pago de <a href="https://www.wes.org/">WES</a></li></ul><h3>Contenido del paquete que se le enviara a WES</h3><ul><li>Certificado de estudios original del grado obtenido más alto</li><li>Respectiva traducción (Facultad de filosofía y letras)</li><li>Copia de Titulo ( yo mande copia certificada una vez que la legalizacion estaba lista; en teoria no es necesaria la legalización ni copia certificada pero no quise arriesgarme)</li><li>Respectiva traducción (Facultad de filosofía y letras)- titulo y legalización</li><li>Forma de WES — una hoja que tienes que llenar con tus datos *</li></ul><pre><strong>Nota sobre la forma de WES: Solo la llene yo; la universidad se negó  a llenarla y no se tuvo problema; deje la parte de ellos en blanco.</strong></pre><h3>Paquete que se enviara a WES</h3><p>Tiene que ir en un sobre de la UANL, una vez el sobre cerrado, sobre la solapa la persona de dirección de la UANL lo va a sellar multiples veces y firmar sobre los sellos; le pondrá cinta encima y listo.</p><h3>Envio del paquete a WES</h3><p>Yo utilice DHL por que fue lo mas economico. Sobre el sobre de la UANL pegue la dirección de WES y mi numero de referencia y ellos protegieron el sobre con otra envoltura.</p><h3>Certificado de estudios (Lo Mas importante y lento)</h3><ul><li>Tramitar Certificado completo en el SIASE</li></ul><p>SIASE &gt; DEYA &gt; Certificado completo Costo menor a 1200</p><ul><li>Simultáneamente ponerse en contacto con rectoríanen direccion y mencionar que quieren hacer el proceso de WES para revalidacion de estudios a Canada. (ellos estan familiarizados con ese proceso en general a mi en lo personal me falto comunicacion con ellos)</li></ul><h3>Pasos simultáneos</h3><h3>Título— Parte 1</h3><p>Llevar titulo a <a href="https://atencionciudadana.nl.gob.mx/ac_nl/titulos_profesionales_e6792b2d-0cdc-4bc6-9647-3db8a669fbee">Pabellón Ciudadano</a> (sugiero ir acompañando para no batallar con el estacionamiento)</p><ul><li>Pedir la legalización del titulo para Canada; Costo menor a 1400</li></ul><ol><li>Ir al modulo de legalizaciones, mencionar que es para Canada y obtener recibo</li><li>Ir a pagar en caja (aceptan tarjeta de credito y efectivo)</li><li>Volver al modulo con el pago y dejar titulo</li><li>Esperar una semana o el tiempo indicado y recogerlo</li></ol><h3>Título — Parte 2</h3><p>Una vez legalizado el título, escanear los documentos y subirlos a wes y pedir las traducciones en la facultad de filosofía y letras.</p><p>Mi proceso duro 23 días; entregue el 27 de Septiembre de 2021 y tardo en llegar el paquete.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e2a8ee1a631" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Install Jenkins on Windows 10]]></title>
            <link>https://marco-urrea.medium.com/how-to-install-jenkins-on-windows-10-778717e7a320?source=rss-95a2f8629e76------2</link>
            <guid isPermaLink="false">https://medium.com/p/778717e7a320</guid>
            <category><![CDATA[installation]]></category>
            <category><![CDATA[guides-and-tutorials]]></category>
            <category><![CDATA[windows-10]]></category>
            <category><![CDATA[jenkins]]></category>
            <dc:creator><![CDATA[Marco Urrea]]></dc:creator>
            <pubDate>Fri, 12 Feb 2021 04:09:59 GMT</pubDate>
            <atom:updated>2021-02-12T04:09:59.995Z</atom:updated>
            <content:encoded><![CDATA[<p>I am currently trying to learn Jenkins, I’m currently using Windows 10 home. The installation process didn’t go as smooth as with ubuntu; so I decided to write this blog post to help others.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/0*pns3tVPVNPiKfSLX.jpg" /></figure><p>Requirements:</p><ul><li>Windows 10</li><li>JRE</li></ul><h3>Windows Setup</h3><p>When attempting to install windows, it will complain about your user account even if your password is correct.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/611/0*JqyCLy8Gs81Vtsd7.png" /></figure><p>To fix this, you will need to access “Local Security Policy”, but surprise! Its nowhere to be found.</p><p>To address that, download the package from the link below, unzip it and run it as admin.</p><p><a href="https://www.majorgeeks.com/files/details/add_gpedit_msc_with_powershell.html">Add Group Policy Editor to Windows 10 Home</a></p><p>This will install what we need.</p><p>Done that, restart and follow the steps below (Thanks stack overflow!)</p><ol><li>Logon to the computer with administrative privileges.</li><li>Open the ‘Administrative Tools’ and open the ‘Local Security Policy’</li><li>Expand ‘Local Policy’ and click on ‘User Rights Assignment’</li><li>In the right pane, right-click ‘Log on as a service’ and select properties.</li><li>Click on the ‘Add User or Group…’ button to add the new user.</li><li>In the ‘Select Users or Groups’ dialogue, find the user you wish to enter and click ‘OK’</li><li>Click ‘OK’ in the ‘Log on as a service Properties’ to save changes.</li></ol><h3>Installing JRE</h3><p><a href="https://www.oracle.com/java/technologies/javase-jre8-downloads.html">Java SE Runtime Environment 8 - Downloads</a></p><p>You need an oracle account, if you previously had one from certifications, try first logging into certviews, then come back here. (I hard a hard time logging in).</p><p><a href="https://www.oracle.com/java/technologies/javase-jre8-downloads.html">Java SE Runtime Environment 8 - Downloads</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VUghhEX0FJ0hONXe.jpg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/621/1*qLIEYSK_4ikfEf9Cs-CWgw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/1*0yAQ-SnwniLBkMoygFkAXg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*dXokZSNeKqFW_NkA0A7GmA.png" /></figure><p>Go to localhost:8080</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_SkdA1JeqvT2586aqVrBaQ.png" /></figure><p>Since I’m new to Jenkins, I chose the first option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q84HIYP-cuZ9We4kccy9DQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OghB8fRX6QBRXax1EFWCJw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7XScWgRXCL3WM4kChwwYDw.png" /></figure><p>And that’s all folks!</p><p>References:</p><p><a href="https://stackoverflow.com/questions/63410442/jenkins-installation-windows-10-service-logon-credentials">jenkins installation windows 10 &quot;Service Logon Credentials&quot;</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=778717e7a320" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Terraform Enterprise Console Settings: Hints and Tricks for Useful Features]]></title>
            <link>https://marco-urrea.medium.com/terraform-enterprise-console-settings-hints-and-tricks-for-useful-features-4c827a6a1cf8?source=rss-95a2f8629e76------2</link>
            <guid isPermaLink="false">https://medium.com/p/4c827a6a1cf8</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[actis]]></category>
            <category><![CDATA[terraform-enterprise]]></category>
            <category><![CDATA[postman]]></category>
            <category><![CDATA[aws-s3]]></category>
            <dc:creator><![CDATA[Marco Urrea]]></dc:creator>
            <pubDate>Fri, 04 Dec 2020 05:35:13 GMT</pubDate>
            <atom:updated>2021-07-05T18:21:39.282Z</atom:updated>
            <content:encoded><![CDATA[<p>In this post, we will discuss Terraform Enterprise (TFE) installation Settings on AWS using <em>external services</em> focusing on the <em>S3 bucket</em> when using <strong><em>profiling</em></strong> and the <strong><em>advanced configuration</em></strong> features targeting <strong>Initial Admin Creation Token </strong>and how to use it to create the <strong><em>admin user</em></strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4GUxjec_vWuWJL1q.png" /></figure><p>To find these sections, you need to open your TFE console on a web browser and go to the <em>Settings</em> tab. Remember, you must have the console password to access the replicated <em>Console</em>.</p><p>To access the replicated Console, you need to point to port 8800 of your TFE instance as in the example below.</p><p>tfe<strong><em>.&lt;domain&gt;</em></strong><em>.com:</em><strong><em>8800</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/1*0tCIouYLVcPEg01alJIBaQ.png" /><figcaption>Replicated Console</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*djXQXkPckikyGRVNmA6fdw.png" /><figcaption>TFE Settings Tab</figcaption></figure><h3>Object Storage — S3</h3><p>The S3 bucket is where Terraform will hold application data which is stored securely and away from the Terraform Enterprise application server. In addition, the data stored within the S3 bucket is encrypted by Vault.</p><p>When using the AWS S3 bucket, there are two different options to set it up within our Terraform Enterprise application:</p><ul><li>Using Access id and Secret access key</li><li>Using Instance Profile for Access</li></ul><h4>Case Scenarios</h4><p><strong>The advantage of Access ID + Secret Access key</strong> is that it is easy to set up as it only requires Access ID and Secret key.</p><p><strong>The advantage of Instance Profile for Access is that it is</strong> easy in that you just need to select the check box</p><h4>Security considerations</h4><p>With the first approach, you only need to provide a working Access ID and Secret Access key that have the appropriate rights to read and write to S3 buckets. That sounds fine but the problem with using this approach is — the fact that for some unknown situation your systems can become compromised when someone breaks into your configuration or for some reason gets access to this data.</p><p>There is a chance they can retrieve those two items and then you’re in trouble because that unwanted individual will have access at least to your S3 buckets and can perform unwanted actions and other sorts of damage by destroying resources, stealing information, or generating unexpected costs by spinning up unwanted resources.</p><p>For the reasons stated above, it is better to take precautions and follow the Instance Profile Access approach because it leaves less information exposed while granting the same functionality.</p><p>Below are some examples using the profile and the data that it requires.</p><p>I would like to clarify that the two following scenarios depend on your organization’s configuration.</p><ol><li>Where you need to set up the Endpoint URL which specifies the region of the S3 bucket.</li></ol><p>Example:</p><pre>https://<strong><em>&lt;s3-bucket-name&gt;</em></strong><em>.</em><strong><em>&lt;s3-bucket-region&gt;</em></strong>.amazonaws.com</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/995/1*vXKknq36ohkOfdT9jg7ufw.png" /><figcaption>S3 Configuration Endpoint URL with Region</figcaption></figure><p>2. Where you need to set up the Endpoint URL without specifying the region of the S3 bucket.</p><p>Example:</p><pre><a href="https://s3-bucket-name.s3-bucket-region.amazonaws.com/">https://<strong><em>&lt;s3-bucket-name&gt;</em></strong>.amazonaws.com</a></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/992/1*8B34OpKK2Gf9adTQKQkbbg.png" /><figcaption>S3 Configuration Endpoint URL without Region</figcaption></figure><p>You might be wondering what happens when you do not provide the Endpoint URL for the S3 when using the instance profile option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/990/1*WaPSohgQ8d1gFB3VAV52Jw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*6A1qHNJY7Fc2vbRCyPfFUA.png" /><figcaption>Error when the Endpoint URL is left empty</figcaption></figure><p>As you can see, it throws an authentication error which can be easily solved by following one of the scenarios above.</p><p>The rest of the settings are self-explanatory (Bucket, and Region).</p><p>The Server-side encryption of S3 objects and the KMS key are highly recommended since it protects data in case it falls into the wrong hands.</p><h3>Advanced Configuration</h3><p>In this section, we will explain the purpose of the <strong>Initial Admin Creation Token Subnets</strong> and the <strong>Initial Admin Creation Token Time Limit.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OXZgI1MvRZjdMzAd_9kDFA.png" /></figure><h4>Initial Admin Creation Token Subnets</h4><p>This field is used when you want specific subnets or IP addresses reach the TFE API through a REST call.</p><p>Follow the format below with no spaces only commas.</p><pre>X.X.X.X/Y,X.X.X.X/Y</pre><p>If you wish to use replicated, leave this field empty and use the replicated command within the TFE server instance to retrieve the Initial Admin Creation Token (IACT) instead.</p><h4>Initial Admin Creation Token Time Limit</h4><p>This field expects a timespan in <strong><em>minutes</em></strong> or the word <strong><em>unlimited </em></strong>(will be explained later) to allow the user to retrieve the<em> </em><strong><em>Initial Admin Creation </em>Token</strong>. This can be<strong> </strong>performed with a GET REST call to the TFE API (this can be done with <a href="https://www.postman.com/downloads/">postman</a> or cURL using the terminal). The keyword <strong><em>unlimited</em></strong> allows the token to be retrieved anytime within one of the specified subnets.</p><h3>Retrieving the IACT</h3><p>In this section, we will show the two ways to retrieve the IACT, which are through replicated or a REST call to TFE API.</p><h4>Replicated</h4><p>Log into the TFE server and run the following command.</p><pre>replicated admin retrieve-iact</pre><p>This command will return the token which is later used with the API to generate the initial user.</p><h3>TFE API</h3><p>When TFE is already started, to retrieve the IACT perform a Get REST call (with postman or curl) to your TFE instance endpoint:</p><pre>https://tfe.<strong><em>&lt;domain&gt;</em></strong>.com<strong>/admin/retrieve-iact</strong></pre><p>Where this section of the URL, <strong>/admin/retrieve-iact , </strong>is what will let you retrieve the token.</p><h3>IACT Token and its Usage</h3><p>The IACT Token is a single-use token that allows, the user or automation, to create the initial user (admin) of TFE.</p><p>This is done by performing a POST REST call like in the following URL:</p><pre>https://tfe.<strong>&lt;domain&gt;</strong>.com/admin/initial-admin-user?token<strong>=&lt;IACT&gt;</strong></pre><ul><li>Content-type:</li></ul><pre>application/json</pre><ul><li>Provide a body:</li></ul><pre>{<br>  <strong>&quot;username&quot;</strong>: &quot;admin&quot;,<br>  <strong>&quot;email&quot;</strong>: &quot;name@domain.com&quot;,<br>  <strong>&quot;password&quot;</strong>: &quot;notagoodpassword&quot;<br>}</pre><ul><li>Response (200):</li></ul><pre>{<br>  <strong>&quot;status&quot;</strong>: &quot;created&quot;,<br>  <strong>&quot;token&quot;</strong>: &quot;aabbccdd.v1.atlas.someverylongadmintoken&quot;<br>}</pre><h4>cURL</h4><pre>curl --request POST \<br>  -k \<br>  --url &#39;<a href="https://marco.douterraform.com/admin/initial-admin-user?token=oy6jp2gMyalXQ8GB0f0nprGQcEPmS0Qd&#39;">https://tfe.<strong><em>&lt;domain&gt;</em></strong>.com/admin/initial-admin-user?token=<strong><em>&lt;IACT&gt;</em></strong>&#39;</a> \<br>  --header &#39;Content-Type: application/json&#39; \<br>  --data @payload.json</pre><p>Where payload is a file with the body of the request.</p><h4><strong>Hint</strong></h4><p>Use Postman’s <strong><em>import</em></strong> feature to transform the curl into a Postman API call.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/412/1*Br3oYiZ7wDB_uYGl2B5HiA.png" /></figure><p>Using the Paste Raw Text option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*Iol7Zi50_2YFVGpkVuRMfw.png" /></figure><h3>References</h3><p><a href="https://www.terraform.io/docs/enterprise/install/automating-initial-user.html">Automating Initial User - Install and Config - Terraform Enterprise - Terraform by HashiCorp</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4c827a6a1cf8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Consuming HashiCorp Vault API With .NET Core HTTP Client]]></title>
            <link>https://marco-urrea.medium.com/consuming-hashicorp-vault-api-with-net-core-http-client-94b7c652772a?source=rss-95a2f8629e76------2</link>
            <guid isPermaLink="false">https://medium.com/p/94b7c652772a</guid>
            <category><![CDATA[http-request]]></category>
            <category><![CDATA[hashicorp-vault]]></category>
            <category><![CDATA[secrets]]></category>
            <category><![CDATA[http-client]]></category>
            <category><![CDATA[dotnet-core]]></category>
            <dc:creator><![CDATA[Marco Urrea]]></dc:creator>
            <pubDate>Thu, 03 Dec 2020 23:43:26 GMT</pubDate>
            <atom:updated>2020-12-03T23:43:26.073Z</atom:updated>
            <content:encoded><![CDATA[<h3>Consuming HashiCorp Vault API With .NET Core HTTP Client</h3><p>Its been a while since the last time I did some code in .NET, so to keep the habit, today I bring a tutorial on how to consume HashiCorp Vault with Microsoft .NET Core.</p><p>As most of us know HashiCorp Vault is API-driven, which means it can be consumed virtually from anywhere; so I wanted to test it out with .NET Core.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/899/1*2IgKk80AwTucv3SDTqDxGg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/240/1*ds4gcyv6PmaEhzEtrpi84g.png" /></figure><p>Requirements:</p><ul><li>Visual Studio 2019 or Visual Studio Code.</li><li><a href="https://dotnet.microsoft.com/download/dotnet-core">.NET Core library</a></li><li><a href="https://www.vaultproject.io/">HashiCorp Vault</a></li><li>Terminal</li></ul><h3>HashiCorp Vault Setup</h3><ol><li>Open a terminal and initialize your Vault Server and export its Vault Address. For this example, I’m going to start my server in <em>DEV Mode.(See Shortcut below)</em></li></ol><pre>vault server -dev</pre><p>Output:</p><pre>==&gt; Vault server configuration:</pre><pre>Api Address: <a href="http://127.0.0.1:8200/">http://127.0.0.1:8200</a><br>                     Cgo: disabled<br>         Cluster Address: <a href="https://127.0.0.1:8201/">https://127.0.0.1:8201</a><br>              Listener 1: tcp (addr: &quot;127.0.0.1:8200&quot;, cluster address: &quot;127.0.0.1:8201&quot;, max_request_duration: &quot;1m30s&quot;, max_request_size: &quot;33554432&quot;, tls: &quot;disabled&quot;)<br>               Log Level: info<br>                   Mlock: supported: true, enabled: false<br>           Recovery Mode: false<br>                 Storage: inmem<br>                 Version: Vault v1.3.3+prem</pre><pre>WARNING! dev mode is enabled! In this mode, Vault runs entirely in-memory<br>and starts unsealed with a single unseal key. The root token is already<br>authenticated to the CLI, so you can immediately begin using Vault.</pre><pre>You may need to set the following environment variable:</pre><pre>$ export <strong>VAULT_ADDR=&#39;</strong><a href="http://127.0.0.1:8200&#39;"><strong>http://127.0.0.1:8200&#39;</strong></a></pre><pre>The unseal key and root token are displayed below in case you want to<br>seal/unseal the Vault or re-authenticate.</pre><pre>Unseal Key: 4vV9GsIiZ2G2c0UqEAYtUM625xa29JcteXQvOk/sfx4=<br><strong>Root Token: s.JCrC5sK61rixB92SHXAqvKS0</strong></pre><p>2. Set up the <strong>VAULT_ADDR</strong>:</p><ul><li>PowerShell:</li></ul><pre>$env:VAULT_ADDR=&#39;<a href="http://127.0.0.1:8200&#39;">http://127.0.0.1:8200&#39;</a></pre><ul><li>Elsewhere (Unix-based):</li></ul><pre>export <strong>VAULT_ADDR=&#39;</strong><a href="http://127.0.0.1:8200&#39;"><strong>http://127.0.0.1:8200&#39;</strong></a></pre><p><em>Shortcut!</em></p><pre>vault server -dev -dev-root-token-id=&lt;SomePassword&gt; -dev-listen-address=&quot;127.0.0.1:8200&quot;</pre><p><strong>Secret Creation</strong></p><p>For this, we need to open a second Terminal beside the one running HashiCorp Vault.</p><ol><li>We are going to create a secret named <strong><em>person </em></strong>using the secrets engine <em>version 2 </em>and we are going to set two <em>key-value pairs</em> in our secret, in this case, <em>name=marco</em> and <em>lastname=urrea</em>.</li></ol><pre>vault kv put secret/person name=marco lastName=urrea</pre><p>Output:</p><pre>Key              Value<br>---              -----<br>created_time     2020-03-08T09:49:44.8794859Z<br>deletion_time    n/a<br>destroyed        false<br>version          1</pre><p>As seen on the output, this is the first version of our secret. Now Its time to retrieve it.</p><p><strong>Consulting a secret</strong></p><p>To retrieve our secret, let’s use the following command.</p><pre>vault kv get secret/person</pre><p>Output:</p><pre>====== Metadata ======<br>Key              Value<br>---              -----<br>created_time     2020-03-08T09:49:44.8794859Z<br>deletion_time    n/a<br>destroyed        false<br>version          1</pre><pre>====== Data ======<br>Key         Value<br>---         -----<br>lastName    urrea<br>name        marco</pre><p>Notice in the output that HashiCorp Vault sorts in alphabetical order the contents of our secret by key.</p><h3>.NET Core HTTP Client</h3><p>For this example, I used Visual Studio 2019.</p><ol><li>Open Visual Studio 2019, on the right, click <strong>Create a new project</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*baazC-zWYYlRDGutuk9ubw.png" /></figure><p>2. Select <strong>Console app (.Net Core) </strong>and click <strong>Next</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DYfhy1og2T0kCWwoU6D9hQ.png" /></figure><p>3. Give your project a nice name and click <strong>Create.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P93-VFTLnMcGq94yDHNp_A.png" /></figure><p>We need to install two packages.</p><p>4. Go to <strong>Tools </strong>&gt; <strong>NuGet Package Manager</strong> &gt; <strong>Manage Nuget Packages for Solution…</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/921/1*OS7Ul-V2OOsfkkySgjHuIA.png" /></figure><p>5. In the browse tab, search and install <strong>Microsoft.AspNet.WebApi.Client</strong> and <strong>Newtonsoft.Json</strong>. The first library is used to make the <em>HTTP call</em> and the second one to manipulate the <em>JSON </em>data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N1C2hM5CVElhOK8uk1cUuQ.png" /></figure><p>6. Explained code below, notice how the URL changes compared to the command line, from <strong>secret/person</strong> to <strong>secret/data/person</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8d658de7aac1c7e3e9fae213672b5fbe/href">https://medium.com/media/8d658de7aac1c7e3e9fae213672b5fbe/href</a></iframe><p>Output:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e9980af40a5826d8490a6060188550af/href">https://medium.com/media/e9980af40a5826d8490a6060188550af/href</a></iframe><p>Going back to the explanation, within the JSON we have two “data” structures nested. We took care of that on line 29 of the code to access our secrets, and then we transform that into a dictionary for further manipulation in case it is required.</p><h3>Conclusion</h3><p>HashiCorp Vault API is very easy to use and it can be consumed quite easily through an HTTP call using .Net. the only difference when using the command line is having to add <strong>/data/ </strong>between secret and the secret name.</p><p>Finally, If you liked the article, please hit the follow button and leave lots of claps!</p><p><strong>References</strong></p><ul><li><a href="https://www.vaultproject.io/api-docs/secret/kv/kv-v2/">KV - Secrets Engines - HTTP API | Vault by HashiCorp</a></li><li><a href="https://learn.hashicorp.com/vault/getting-started/first-secret">Your First Secret</a></li><li><a href="https://www.tachytelic.net/2019/03/powershell-environment-variables/">Use PowerShell to Set Environment Variables</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=94b7c652772a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tips and tricks I wish I knew when I started developing HashiCorp Sentinel policies for Terraform]]></title>
            <link>https://marco-urrea.medium.com/tips-and-tricks-i-wish-i-knew-when-i-started-developing-hashicorp-sentinel-policies-for-terraform-f9b502bab331?source=rss-95a2f8629e76------2</link>
            <guid isPermaLink="false">https://medium.com/p/f9b502bab331</guid>
            <category><![CDATA[sentinel]]></category>
            <category><![CDATA[hashicorp]]></category>
            <category><![CDATA[governance]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[cloud]]></category>
            <dc:creator><![CDATA[Marco Urrea]]></dc:creator>
            <pubDate>Mon, 21 Sep 2020 17:45:47 GMT</pubDate>
            <atom:updated>2024-03-23T03:33:49.759Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello readers, this is the guide I wish existed when I started writing Sentinel policies for Terraform; I hope it saves you some time.</p><p>&lt;Document is outdated as per 2022&gt;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/493/0*l3a7BhWJudx3ZT15.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/364/0*j7Op1wmj0c-mhnNv.png" /></figure><h3>Overview</h3><p>In this article I will explain how to work with Sentinel, starting with basics and then I will provide tips on do’s and don’ts.</p><p>For starters, the purpose of Sentinel is writing policies as code which prevents the user from creating things that aren’t meant to be according to your work organization.</p><p>I must clarify that this article is based on my current understanding and personal experience with Sentinel V2 and V3, I still need to dive deeper into the Sentinel V3 framework as I still need to improve my understanding of it.</p><p><strong><em>Note: For placeholders, I usually use the diamond notation &lt;template&gt; which means you have to replace that whole string.</em></strong></p><h3>Assumptions</h3><p>It is assumed you already read the basic documentation for Sentinel found <a href="https://docs.hashicorp.com/sentinel/language/">here</a> and you don’t know what to do with it.</p><h3>Computer Setup</h3><p>Step 1: Download <a href="https://docs.hashicorp.com/sentinel/downloads/">HashiCorp Sentinel binary</a> in your computer and make an <strong>environmental variable</strong> on Windows or put it under <strong>/usr/local/bin</strong> on linux.</p><p><strong><em>Note: I suggest using Linux since its easier to navigate with the command line.</em></strong></p><p><em>I also suggest to download </em><a href="https://code.visualstudio.com/download"><em>Visual Studio Code</em></a><em> or use any other IDE.</em></p><p>The following capture is an example of workspace structure I created for my development, follow the steps below, and come back to this capture for any clarifications:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/629/1*rijRO7AX78L3yFcINaq_HA.png" /><figcaption>Development Structure</figcaption></figure><p>Step 2: Create a folder to store your Sentinel policies.</p><p>Step 3: Create a folder per policy for development purposes.</p><p>Step 4: In your <em>policy specific folder </em>from step 3 create a file named <strong><em>&lt;policy_name&gt;.sentinel</em></strong></p><p>Step 5: Create the following path that will serve your <em>specific policy</em>.</p><p>Your folder structure should look like this:</p><p><strong><em>/POLICIES_FOLDER/policy_specific_folder/test/&lt;policy_name_folder&gt;</em></strong></p><p>Step 6: Within the <strong><em>&lt;policy_name_folder&gt;</em></strong> create two files: <strong><em>pass.json</em></strong> and <strong><em>fail.json</em></strong></p><p>These files should look similar to this.</p><p><strong>pass.json:</strong></p><pre>{<br>  &quot;modules&quot;: {<br>    &quot;tfplan-functions&quot;: {<br>      &quot;path&quot;: &quot;../../../tfplan-functions.sentinel&quot;<br>    }<br>  },<br>  &quot;mock&quot;: {<br>    &quot;tfplan/v2&quot;: &quot;../../mock-tfplan-pass-v2.sentinel&quot;<br>  },<br>  &quot;test&quot;: {<br>    &quot;main&quot;: true<br>  }<br>}</pre><p><strong>fail.json</strong>:</p><pre>{<br>  &quot;modules&quot;: {<br>    &quot;tfplan-functions&quot;: {<br>      &quot;path&quot;: &quot;../../../tfplan-functions.sentinel&quot;<br>    }<br>  },<br>  &quot;mock&quot;: {<br>    &quot;tfplan/v2&quot;: &quot;../../mock-tfplan-fail-v2.sentinel&quot;<br>  },<br>   &quot;test&quot;: {<br>    &quot;main&quot;: false<br>  }<br>}</pre><p>The explanation for the content of these files is the following. It consists of three parts:</p><ul><li><strong>modules:</strong> (available since <a href="https://discuss.hashicorp.com/t/sentinel-v0-15-0-introducing-modules/6579">Sentinel v0.15.0</a>) libraries can be imported and they are required for testing when using the third generation of Sentinel policies. ( I will come back to this later)</li><li><strong>mock:</strong> which contain a test scenario (pass/fail) which Sentinel will use to test against.</li><li><strong>test:</strong> the expected result of the main rule from your Sentinel rule which can be true or false whether its a pass/fail scenario.</li></ul><h3>Creating Mocks</h3><p>Step 1: Create an account at <a href="https://app.terraform.io/"><strong>app.terraform.io</strong></a>, an organization, and a workspace.</p><p>Step 2: Back in your computer, create a file named <strong><em>backend.tf </em></strong>in the <strong><em>/POLICIES_FOLDER </em></strong>from the previous section.</p><p>Its content should look like this:</p><pre>terraform {<br>  backend &quot;remote&quot; {</pre><pre><strong>    hostname = &quot;app.terraform.io&quot;</strong><br>    organization = &quot;<strong><em>&lt;some-organization-name&gt;</em></strong>&quot;</pre><pre>workspaces {<br>      name = &quot;<strong><em>&lt;some-workspace&gt;</em></strong>&quot;<br>    }<br>  }<br>}</pre><p>Replace the placeholders for organization and name with your appropriate values. Replace hostname if you’re using PTFE. The <em>hostname</em> line can be removed if using app.terraform.io</p><p>Step 3: Assuming you’re using the Terraform website, use the following command to associate your Terraform organization and workspace with your local environment:</p><pre>terraform login</pre><p>For PTFE use the following command, but verify the hostname in back-end configuration file:</p><pre>terraform login <strong><em>&lt;hostname&gt;</em></strong></pre><p>Step 4 and tip: Develop the Terraform code under <strong><em>/POLICIES_FOLDER/policy_specific_folder</em></strong> and after you are done copy the file (let&#39;s assume its named <strong><em>main.tf</em></strong>) to your <strong><em>/POLICIES_FOLDER.</em></strong><em>(Repeat this process when developing other policies.)</em></p><p><strong><em>Note: The Terraform code doesn’t have to be perfect, it can contain dummy values as place holders, just make sure to use the appropriate values for the items or sections you want to validate. Another tip, copy HashiCorp examples from the registry, notice some examples may have errors, but the CLI should help you identify. S3 bucket example from AWS </em></strong><a href="https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket"><strong><em>here</em></strong></a><strong><em>.</em></strong></p><p>Step 4: In the <strong>Variables</strong> tab of your workspace at <a href="https://app.terraform.io/"><strong>app.terraform.io</strong></a><strong>, </strong>fill out the Terraform Variables. Here is my example for aws.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O-aPCp7iaXIsJefqaBkWDw.png" /></figure><p><strong><em>Note: AWS_SESSION_ TOKEN is not always needed, depends on your AWS organization settings.</em></strong></p><p>Step 5: Now that you have some Terraform code written, its time to plan or <em>(pretend to) </em>apply it.</p><pre>terraform apply</pre><p>Wait until the CLI requests validation and answer with anything different than <strong>yes </strong>assuming you’re using dummy values.</p><p>Then mocks should be available for download like in the image below by hitting the <strong>Download Sentinel mocks</strong> button</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*f2NuUW_xDEardA8ei3eCbA.png" /></figure><p>Place the extracted files from the downloaded zip in the following path:</p><p><strong><em>/POLICIES_FOLDER/policy_specific_folder/</em></strong></p><p>Then create a <strong><em>pass</em></strong> scenario assuming your code is correct as follows:</p><pre>cp mock-tfplan-v2.sentinel mock-tfplan-pass-v2.sentinel</pre><p>Do the same thing for the <strong><em>fail</em></strong> scenario:</p><pre>cp mock-tfplan-v2.sentinel mock-tfplan-fail-v2.sentinel</pre><p>Modify the fail scenario attributes as required to make it trigger an unexpected behavior with your resource, like modifying an attribute with a wrong value or deleting an attribute that you’re expecting.</p><p>The creation of the pass and fail scenarios are based on HashiCorp’s documentation taken from <a href="https://learn.hashicorp.com/tutorials/terraform/sentinel-testing">here</a>.</p><p>You could modify the <strong>acl</strong>, assuming you are expecting “public-read” you could make it fail if you find a value different that is not “<strong><em>public-read</em></strong>”. Below its an excerpt of a mock, that would fail; assuming you’re validating the <strong><em>acl</em></strong> attribute expects “public-read”</p><pre>resource_changes = {<br>    &quot;aws_s3_bucket.demo&quot;: {<br>        &quot;address&quot;:  &quot;aws_s3_bucket.demo&quot;,<br>        &quot;change&quot;: {<br>            &quot;actions&quot;: [<br>                &quot;create&quot;,<br>            ],<br>            &quot;after&quot;: {<br> <strong>              &quot;acl&quot;:  &quot;not-public-read&quot;,</strong></pre><h3>Testing your mocks</h3><p>Position yourself in the following path:</p><p><strong><em>/POLICIES_FOLDER/policy_specific_folder/</em></strong></p><p>There are two ways to test your mocks with the Sentinel CLI; one is with the apply option and the other one is with the test option. I will focus on the test option since with Sentinel V3 it&#39;s easier just to execute that one. To print any warning messages use the option -verbose besides test, which looks like the following example:</p><pre>sentinel test <em>-verbose</em> &lt;policy_name.sentinel&gt;</pre><p>Here is an output example of a policy I did to validate databases with publicly_accessible property were not public:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*KpvMOSdzgZJSMVb9NBuOtQ.png" /></figure><p>Going back to the pass and fail JSON files, in the section for modules you have to import the framework functions (Sentinel V3)from <a href="https://github.com/hashicorp/terraform-guides/tree/master/governance/third-generation/common-functions">here</a>. What I did is that I downloaded the file for <strong>tfplan-functions.sentinel </strong>and I added the reference within the modules section. Same story if I require the other function files like <em>tfconfig-functions</em>, tfrun-functions, or <a href="https://github.com/hashicorp/terraform-guides/tree/master/governance/third-generation/common-functions/tfstate-functions">tfstate-functions</a>. I’d also like to mention there are provider-specific functions like for <a href="https://github.com/hashicorp/terraform-guides/tree/master/governance/third-generation/aws/aws-functions"><strong>aws</strong></a><strong> </strong>(I expect other providers like azure to get functions as well).</p><pre>&quot;modules&quot;: {<br>    &quot;tfplan-functions&quot;: {<br>      &quot;path&quot;: &quot;../../../tfplan-functions.sentinel&quot;<br>    }</pre><h3>Differences between Sentinel V2 and V3</h3><p>I noticed examples for Sentinel V2 found in HashiCorp’s documentation and Katacoda (the latter were retired) are rule-based.</p><blockquote><strong><em>Rules must be avoided at all cost.</em></strong></blockquote><p>The problem with rules is that you cannot store variables and it makes Sentinel difficult to work with as a regular programming language, functions are always preferred because they allow you to do things easier and you can store information in variables for later use.</p><blockquote>Functions are always preferred.</blockquote><p>The advantage of Sentinel V3 is that, since you can import modules (functions), you can speed up development.</p><p>The only rule that has to exist is the main rule.</p><pre># Main rule<br>main = rule {<br>     (message_counter_validator) else false<br>}</pre><h3><strong>Deciding whether a policy passes or fails</strong></h3><p>This should be based on counting the error outputs. What I suggest is creating a list that stores the error messages and at the end of your policy, you count the number of error messages. <strong><em>If the number of error messages is different than zero, the rule should be considered as failed</em></strong>, that way you only prevent the creation of what is not allowed.</p><p>I must clarify that if you’re using the Sentinel V3 common functions, there is a built-in mechanism that simplifies the behavior mentioned above; I don’t completely understand all the functions yet, so I still have to demystify some things.</p><h3>Importing functions from Sentinel V3</h3><pre># Import common-functions/tfplan-functions/tfplan-functions.sentinel<br># with alias &quot;plan&quot;<br>import &quot;tfplan-functions&quot; as plan</pre><h3>Tips and Tricks</h3><h4>Finding resources</h4><p>Import the module tfplan-functions:</p><pre># Import common-functions/tfplan-functions/tfplan-functions.sentinel<br># with alias &quot;plan&quot;<br><strong>import &quot;tfplan-functions&quot; as plan</strong></pre><p>usage:</p><pre>plan.find_resources(resource_name)</pre><p>Assume any line you find below in the examples comes from this loop:</p><pre>for resource_collection as r, rc {<br>// Some code<br>}</pre><h4>Tags</h4><ul><li>Single-word</li></ul><pre>rc.change.after.tags.SingleWord</pre><ul><li>Space-separated words</li></ul><pre>rc.change.after.tags[&quot;Space Separated Word&quot;]</pre><h4>Casting to string</h4><p>You need to import any of the *<strong><em>-functions.sentinel </em></strong>modules.</p><p>For example, <em>tfplan-functions.sentinel</em></p><pre># Import common-functions/tfplan-functions/tfplan-functions.sentinel<br># with alias &quot;plan&quot;<br><strong>import &quot;tfplan-functions&quot; as plan</strong></pre><p>Usage:</p><pre>plan.to_string(item)</pre><h4>Validating and Storing Values gracefully</h4><p>To avoid a runtime error when storing items do the following:</p><ul><li><strong>Collections:</strong> <em>use curly braces</em></li></ul><pre>var_name = plan.find_resources(&quot;aws_some_resource&quot;) else {}</pre><ul><li><strong>Attributes within a resource:</strong> when an attribute like tags doesn’t exist</li></ul><pre>var_name = rc.change.after.tags else &quot;default-error&quot;</pre><p>then use an if clause to validate if tags is different than “default-error”</p><pre>if(var_name != &quot;default-error&quot;){<br>// some code here<br>}</pre><ul><li>Variables: regular variables that hold information. As mentioned before they do <strong>NOT</strong> work in <strong><em>rules</em></strong>; <strong>use</strong> them in <strong><em>functions or elsewhere</em></strong>.</li></ul><pre>function_name = func(resource_collection){<br>// store stuff anywhere in here<br>// consider scopes when thinking of variables.<br> variable_name = definition...</pre><pre>}</pre><pre>variable_name2 = definition...</pre><h4>For loops</h4><p>The<strong> b<em>reak</em></strong> and <strong><em>continue</em></strong> statements do exist in Sentinel.</p><ul><li>Break example:</li></ul><pre>for resource_collection as r, rc {<br>// Some code<br>  if(/*some condition*/){<br>    // some code<br>       break<br>  }<br>}</pre><ul><li>Continue example:</li></ul><pre>for resource_collection as r, rc {<br>// Some code<br>  if(/*some condition*/){<br>    // some code<br>       continue<br>  }<br>}</pre><p><strong>Selecting items within the Terraform structure</strong></p><ul><li>Attributes:</li></ul><p>For example tags:</p><pre>tags <strong><em>=</em></strong> {<br>a = &quot;b&quot;<br>&quot;a b&quot; = &quot;c&quot;<br>}</pre><p>Select them is with dot notation because it has an equals sign (‘=’) before the block:</p><pre>rc.change.after.tags.a</pre><ul><li>Block of code:</li></ul><pre>example1 {<br> example2 {<br>  attribute_name = &quot;attribute_value&quot;<br>          }<br>}</pre><p>Selection when attributes <strong><em>don’t</em></strong> have ‘=’ signs:</p><pre>example1[0].example2[0].attribute_name</pre><h4>Finding Blocks within resources</h4><p>Import the module tfplan-functions:</p><pre># Import common-functions/tfplan-functions/tfplan-functions.sentinel<br># with alias &quot;plan&quot;<br><strong>import &quot;tfplan-functions&quot; as plan</strong></pre><p>For example, when your Terraform code has a resource with a code of block that is repeated multiple times like <strong>ip_set_descriptors </strong>within in <strong>aws_waf_ipset </strong>example<strong> </strong>found <a href="https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/waf_ipset">here</a>.</p><p>You can find the multiple repetitions from <strong>ip_set_descriptors </strong>by using the following line, where the first parameter <strong><em>rc</em></strong> comes from our loop item, and the second one is the repeated code item:</p><pre>plan.find_blocks(rc, &quot;ip_set_descriptors&quot;)</pre><p><strong>Converting a JSON value to an actual JSON Structure</strong></p><p>Let’s use the following example of an S3 bucket policy; as you can see there is a policy attribute that contains a JSON- like structure in a policy.</p><pre>resource &quot;aws_s3_bucket_policy&quot; &quot;b&quot; {<br>  bucket = aws_s3_bucket.b.id<br><br>  <strong>policy</strong> <em>= &lt;&lt;POLICY<br>{<br>  &quot;Version&quot;: &quot;2012-10-17&quot;,<br>  &quot;Id&quot;: &quot;MYBUCKETPOLICY&quot;,<br>  &quot;Statement&quot;: [<br>    {<br>      &quot;Sid&quot;: &quot;IPAllow&quot;,<br>      &quot;Effect&quot;: &quot;Deny&quot;,<br>      &quot;Principal&quot;: &quot;*&quot;,<br>      &quot;Action&quot;: &quot;s3:*&quot;,<br>      &quot;Resource&quot;: &quot;arn:aws:s3:::my_tf_test_bucket/*&quot;,<br>      &quot;Condition&quot;: {<br>         &quot;IpAddress&quot;: {&quot;aws:SourceIp&quot;: &quot;8.8.8.8/32&quot;}<br>      }<br>    }<br>  ]<br>}<br>POLICY</em><br>}</pre><p>To convert the string contained in policy to a JSON structure perform the following:</p><pre>json_holder = json.unmarshal(rc.change.after.policy)</pre><p><strong><em>Note: Don’t forget to import the JSON module/library.</em></strong></p><p>The line above should store the value of the JSON structure from the policy definition.</p><h4>Extracting JSON’s attribute values</h4><p>Notice in the previous example how Statement contains its values within braces, which means we need to call Statement in the way showed below. Notice it uses braces and an index within them.</p><pre>json_holder.Statement[0]</pre><p>Note: if you want to extract only the value of Statement, the braces and the index can be omitted, but later you won’t be able to dig deeper into the item.</p><h4>Digging deeper into the JSON structure</h4><p>To select an item within Statement, do the following:</p><ul><li><strong>For direct attributes, like “<em>Sid”</em>:</strong></li></ul><pre>json_holder.Statement[0].Sid</pre><ul><li><strong>For deeper items like “<em>aws:SourceIP”</em></strong></li></ul><pre>json_holder.Statement[0].Condition.<em>IpAddress</em>[&quot;<em>aws:SourceIp</em>&quot;]</pre><p><strong><em>General Note: Review the first resource from GitHub as it contains the definitions for the function modules.</em></strong></p><p>If you liked my article or you found it useful please remember to leave lots of claps (50 if possible).</p><h3>Resources</h3><ul><li><a href="https://github.com/hashicorp/terraform-guides/tree/fc4f89463bb44b620918850a8d632ba965dc572a/governance/third-generation">hashicorp/terraform-guides</a></li><li><a href="https://docs.hashicorp.com/sentinel/language/">Sentinel Language | Sentinel by HashiCorp</a></li><li><a href="https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket">Terraform Registry</a></li><li><a href="https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_bucket_policy">Terraform Registry</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f9b502bab331" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Handling automated Vault Deployment errors]]></title>
            <link>https://marco-urrea.medium.com/handling-automated-vault-deployment-errors-1ca13ad1505a?source=rss-95a2f8629e76------2</link>
            <guid isPermaLink="false">https://medium.com/p/1ca13ad1505a</guid>
            <category><![CDATA[error-handling]]></category>
            <category><![CDATA[consul]]></category>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[vault]]></category>
            <dc:creator><![CDATA[Marco Urrea]]></dc:creator>
            <pubDate>Wed, 29 Apr 2020 20:36:41 GMT</pubDate>
            <atom:updated>2020-04-29T22:34:57.363Z</atom:updated>
            <content:encoded><![CDATA[<p>I’ve been working a couple of days on learning how to deploy a node of Vault with three Consul node as back-end on AWS.</p><p>I followed all the instructions as directed and when I attempted to test my Vault through the UI I came up with the surprise that the deployment didn’t work.</p><p>So what I did next, is I connected to the VM hosting vault and asked the system for Vault status and this is what I got:</p><pre>system vault status</pre><p>Output:</p><pre>&quot;storage migration check error: error=&quot;Unexpected response code: 500&quot;</pre><p>I performed the deployment once more and attempted received the following error:</p><pre>&quot;storage migration check error: error=&quot;Unexpected response code: 403&quot;</pre><p>With this I learned the error was related to Consul.</p><p>I learned that to review whats going on with a Consul node I can do it with the following commands:</p><pre>consul monitor</pre><p>To learn the status of my consul nodes and its details:</p><pre>consul operator raft list-peers</pre><p>This one will display the current nodes and its status as member or leader.</p><p>I haven’t figured out the source of the issue yet, but I came closer to understand the system’s status.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1ca13ad1505a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Complementary Tutorial: Microsoft IIS Web Manager 2.3.0]]></title>
            <link>https://marco-urrea.medium.com/complementary-tutorial-microsoft-iis-web-manager-2-3-0-ed598669454e?source=rss-95a2f8629e76------2</link>
            <guid isPermaLink="false">https://medium.com/p/ed598669454e</guid>
            <category><![CDATA[web-management]]></category>
            <category><![CDATA[isis]]></category>
            <category><![CDATA[microsoft]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Marco Urrea]]></dc:creator>
            <pubDate>Mon, 16 Mar 2020 18:47:24 GMT</pubDate>
            <atom:updated>2020-04-18T00:36:53.518Z</atom:updated>
            <content:encoded><![CDATA[<p>This is a complementary tutorial to Microsoft IIS Web Manager 2.3.0.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QCWcM1v1BXuQlAFtgohBBQ.png" /></figure><p>For a task, I was required to set up the currently deprecated version of Microsoft IIS Web Manager.</p><p>What I found is the documentation is not very intuitive and it&#39;s missing some details; the one on GitHub its more specific.</p><h3>Requirements:</h3><p>Download and install the .NetCore SDK and the ASP.NET Core Runtime Bundle from <a href="https://dotnet.microsoft.com/download/dotnet-core/2.1">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/521/1*kG3rQ8EvSkP6ZMLxDz3CvQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/532/1*1L3pkKYwnXGkEZ7DhDn2ng.png" /><figcaption>Required packages</figcaption></figure><p><strong>Main Tutorial</strong></p><p>This will save you some time trying to run the IIS Web Manager.</p><p>Go to the <a href="https://manage.iis.net/get">Microsoft IIS Web Manager website</a>, while following this other <a href="https://blogs.iis.net/adminapi/microsoft-iis-administration-api-preview">tutorial</a>.</p><p><strong>FAQ</strong></p><p>If you click on <strong>Get Access Token</strong> it throws you to the following URL, <a href="https://localhost:55539/connect"><em>https://localhost:55539/connect</em></a><em>, </em>and it shows an empty website with a prompt requesting username and password. It means you are missing the .NetCore package and the ASP.NET Core Runtime Bundle</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/449/1*qzIOJehASNKNLeQtT2EwqQ.png" /></figure><p>If you liked the article, please hit the follow button and leave lots of claps!</p><h3>Resources</h3><ul><li><a href="https://manage.iis.net/get">Microsoft IIS Web Manager</a></li><li><a href="https://blogs.iis.net/adminapi/microsoft-iis-administration-api-preview">Microsoft IIS Administration Preview</a></li><li><a href="https://github.com/microsoft/IIS.Administration/releases">microsoft/IIS.Administration</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ed598669454e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[UI-UX Anti-patterns]]></title>
            <link>https://medium.com/usabilitygeek/ui-ux-anti-patterns-c35043c9c96c?source=rss-95a2f8629e76------2</link>
            <guid isPermaLink="false">https://medium.com/p/c35043c9c96c</guid>
            <category><![CDATA[ux-design]]></category>
            <category><![CDATA[ui]]></category>
            <category><![CDATA[usability]]></category>
            <category><![CDATA[antipattern]]></category>
            <category><![CDATA[user-experience]]></category>
            <dc:creator><![CDATA[Marco Urrea]]></dc:creator>
            <pubDate>Fri, 06 Mar 2020 21:21:19 GMT</pubDate>
            <atom:updated>2020-04-20T17:21:21.776Z</atom:updated>
            <content:encoded><![CDATA[<p>While I was doing research on Single Sign-on(SSO) technology providers, I came across an SSO provider that offers an ROI Calculator.</p><p>This calculator only displays two fields and a button. It is quite simple and straight-forward; it asks for the number of employees, number of apps per employee, and a button to Calculate Savings.</p><p>Below is a screenshot of the original web form:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/545/1*-CCTsBBvmo0fLRpSIOnGdg.png" /><figcaption>Innocent basic form with hidden fields.</figcaption></figure><p>After I input some data, the webform morphs into something different, a more complex webform that asks for more details.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*3gXJdwtIql6-a0BaUy_h3g.png" /></figure><p>As a user, I feel somewhat betrayed. The first thing that came to my mind was that I would only need to fill out two different fields when I had to provide more information.</p><p>As a side note, I am aware of the small letters in gray.</p><p><em>The moral of the fable is the following: Be straight and transparent with your users; otherwise, trust gets hurt.</em></p><p>Finally, If you liked the article, please hit the follow button and leave lots of claps!</p><h3>Want to learn more?</h3><p>Are you interested in the intersection between UX and UI Design? The online courses on <a href="https://www.interaction-design.org/courses/ui-design-patterns-for-successful-software?ep=ug0">UI Design Patterns for Succesful Software</a> and <a href="https://www.interaction-design.org/courses/design-thinking-the-beginner-s-guide?ep=ug0">Design Thinking: The Beginner’s Guide</a> can teach you skills you need. If you take a course, you will earn an industry-recognized course certificate to advance your career. On the other hand, if you want to brush up on the basics of UX and Usability, try the <a href="https://www.interaction-design.org/courses/user-experience-the-beginner-s-guide?ep=ug0">online course on User Experience</a> (or another <a href="https://www.interaction-design.org/courses?ep=ug0">design topic</a>). Good luck on your learning journey!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c35043c9c96c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/usabilitygeek/ui-ux-anti-patterns-c35043c9c96c">UI-UX Anti-patterns</a> was originally published in <a href="https://medium.com/usabilitygeek">UsabilityGeek</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>