<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Shell on Puppeteers Oy</title>
		<link>https://www.puppeteers.net/tags/shell/</link>
		<description>Recent content in Shell on Puppeteers Oy</description>
		<generator>Hugo</generator>
		<language>en-US</language>
		
		
		
		
			<lastBuildDate>Fri, 18 Feb 2022 00:00:00 +0000</lastBuildDate>
		
			<atom:link href="https://www.puppeteers.net/tags/shell/index.xml" rel="self" type="application/rss+xml" />
			<item>
				<title>Terraform remote-exec: wait until a webpage is reachable</title>
				<link>https://www.puppeteers.net/blog/terraform-remote-exec-wait-until-a-webpage-is-reachable/</link>
				<pubDate>Fri, 18 Feb 2022 00:00:00 +0000</pubDate>
				<guid>https://www.puppeteers.net/blog/terraform-remote-exec-wait-until-a-webpage-is-reachable/</guid>
				<description>&lt;p&gt;Terraform&amp;rsquo;s remote-exec provisioner fails immediately if any command in a script exists with a non-zero exit code. This makes building polling loops a bit more involved than it normally is. So, here is an example loop that checks if a URL can be reached:&lt;/p&gt;&#xA;&lt;div class=&#34;code-block&#34;&gt;&#xA;    &lt;button class=&#34;code-copy&#34; type=&#34;button&#34; hidden aria-label=&#34;Copy code to clipboard&#34;&gt;&#xA;      &lt;span class=&#34;code-copy-label&#34; aria-hidden=&#34;true&#34;&gt;Copy&lt;/span&gt;&#xA;    &lt;/button&gt;&#xA;    &lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;while true; do&#xA;    curl -k https://puppet:8140/puppet-ca/v1 &amp;amp;&amp;amp; break || sleep 3&#xA;done&lt;/code&gt;&lt;/pre&gt;&#xA;  &lt;/div&gt;&lt;p&gt;When the URL is unreachable, the &amp;ldquo;||&amp;rdquo; will ensure that &amp;ldquo;sleep&amp;rdquo; gets run, which returns 0. If the URL is reachable, curl itself will return 0 and &amp;ldquo;&amp;amp;&amp;amp;&amp;rdquo; ensures that we break out of the loop.&lt;/p&gt;</description>
			</item>
	</channel>
</rss>
