drone build Sun Sep 20 15:08:31 PDT 2026

This commit is contained in:
2026-09-20 22:08:31 +00:00
parent 1d51eaebec
commit 207d8c1cd5
731 changed files with 8308 additions and 5281 deletions
+180 -27
View File
@@ -40,7 +40,80 @@
<style>.post-metadata {
<style>#toc {
float: right;
margin: 1rem 0 1.5rem 1.5rem;
width: min(calc(100% - 1.5rem), 23rem);
/* 23rem is the width of the words 'table of contents' in my header font */
/* yes, it's a bit hacky */
}
@media (max-width: 850px) {
#toc {
float: unset;
margin-top: 2rem;
margin-left: .5rem;
width: calc(100% - .5rem);
}
}
#toc details {
border: thick solid var(--color-pink);
border-radius: 1rem;
margin-top: 1rem;
}
#toc summary {
position: relative;
top: -1.5rem;
left: -.75rem;
width: fit-content;
background: var(--color-bg);
border-radius: .5rem;
}
#toc summary:focus-visible {
outline: .15rem solid var(--color-teal);
}
#toc summary::marker {
font-size: 2.35rem;
}
#toc h2 {
margin-top: 0;
display: inline;
line-height: normal;
}
#toc nav {
position: relative;
top: -1.25rem;
}
#toc li {
margin-block: .45rem 0;
}
@media (max-width: 650px) {
#toc nav > ol {
margin-left: .5rem;
}
}
/* basically we want to style this `ol` as a `ul` */
#toc ol > li {
list-style: disc;
}
#toc ol > li > ol > li {
list-style: circle;
}
#toc ol > li > ol > li > ol > li {
list-style: square;
}
.post-metadata {
display: flex;
flex-flow: row wrap;
justify-content: space-between;
@@ -438,6 +511,8 @@ body:has(dialog[open]) {
color-scheme: light dark;
--font-family: 'Atkinson Hyperlegible Next', sans-serif;
/* if you change the header font, go to post-toc.css and fuck about with the width
of the table of contents */
--font-family-headers: 'Peritel', 'Atkinson Hyperlegible Next', sans-serif;
--font-family-code: 'Atkinson Hyperlegible Mono', monospace;
@@ -496,7 +571,6 @@ body:has(dialog[open]) {
}
/* Base */
* {
box-sizing: border-box;
margin: 0;
@@ -1814,7 +1888,7 @@ switch (currentThemeValue) {
<heading-anchors content="<i class='fa-solid fa-anchor'></i>">
<article data-pagefind-body="">
<h1 id="azure-locations-and-file-crawling">azure locations and file crawling</h1>
<h1>azure locations and file crawling</h1>
<div class="post-metadata">
<p>
@@ -1848,7 +1922,85 @@ switch (currentThemeValue) {
<img class="hero" src="/img/azure-locations.jpg" alt="A Linux terminal. There is a fun rainbow flag in ascii art at the top, and then the user has called a command asking Azure for a list of locations applicable to a specific resource type. The output is lengthy." loading="lazy" decoding="async" width="1000" height="827">
<h2 id="context">context</h2>
<aside id="toc">
<details>
<summary><h2>table of contents</h2></summary>
<nav class="toc">
<ol>
<li><a href="#context">context</a>
<ol>
<li><a href="#bicep">bicep</a>
<ol>
<li><a href="#nesting">nesting</a>
</li>
</ol>
</li>
</ol>
</li>
<li><a href="#finding-all-resources">finding all resources</a>
<ol>
<li><a href="#grep">grep</a>
</li>
<li><a href="#cut">cut</a>
</li>
<li><a href="#mapfile">mapfile</a>
</li>
<li><a href="#dirname-(%26-more)">dirname (& more)</a>
</li>
<li><a href="#the-get_resources-function">the get_resources function</a>
</li>
</ol>
</li>
<li><a href="#finding-locations">finding locations</a>
<ol>
<li><a href="#sort">sort</a>
</li>
<li><a href="#az">az</a>
</li>
<li><a href="#cut-(again)">cut (again)</a>
</li>
<li><a href="#comm">comm</a>
</li>
<li><a href="#catching-errors">catching errors</a>
</li>
<li><a href="#tee">tee</a>
</li>
<li><a href="#the-location-code">the location code</a>
</li>
</ol>
</li>
<li><a href="#summary">summary</a>
</li>
</ol>
</nav>
</details>
</aside>
<h2 id="context">context</h2>
<p>Azure is Microsoft's cloud offering. Each possible resource that can be deployed in Azure has a location it's deployed in, such as &quot;East US&quot; or &quot;Italy.&quot; While some resources can be deployed in all locations, other resources have location constraints.</p>
<p>It's common, when deploying, to have a whole ecosystem of resources that will work together. However, this introduces a problem: which locations work for all resources in a deployment?</p>
<p>Let's dig in. (Want just the outcome? Check the <a href="#summary">summary</a>.)</p>
@@ -1923,7 +2075,7 @@ switch (currentThemeValue) {
<span class="token operator">|</span> <span class="token function">cut</span> <span class="token parameter variable">-d</span> <span class="token string">"@"</span> <span class="token parameter variable">-f</span> <span class="token number">1</span> -<span class="token punctuation">)</span>
<span class="token builtin class-name">mapfile</span> <span class="token parameter variable">-t</span> modules <span class="token operator">&lt;</span> <span class="token operator">&lt;</span><span class="token punctuation">(</span><span class="token function">grep</span> <span class="token parameter variable">-E</span> <span class="token string">"^module "</span> <span class="token string">"<span class="token variable">$file</span>"</span> <span class="token punctuation">\</span>
<span class="token operator">|</span> <span class="token function">cut</span> <span class="token parameter variable">-d</span> <span class="token string">"'"</span> <span class="token parameter variable">-f</span> <span class="token number">2</span> -<span class="token punctuation">)</span></code></pre>
<h3 id="dirname-and-more"><code>dirname</code> (&amp; more)</h3>
<h3 id="dirname-(%26-more)"><code>dirname</code> (&amp; more)</h3>
<p>We can't just stop there. We need to search each module in turn. Using <code>dirname</code>, we can get the directory of the file we're searching, then append the relative module path.</p>
<pre class="language-sh"><code class="language-sh"><span class="token function-name function">get_resources</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
<span class="token comment"># ... grep, cut, etc ...</span>
@@ -1938,7 +2090,7 @@ switch (currentThemeValue) {
<p>A lot just happened there besides <code>dirname</code>. <code>{modules[@]}</code> is all the array elements (as opposed to just <code>$modules</code>, which evaluates to the first element). <code>${#modules[@]}</code>, on the other hand - note the pound sign - is the number of elements in the array.</p>
<p>Additionally, <code>mapfile</code> usually writes from index 0 onwards. But with the <code>-O</code> argument, we can specify an <strong>origin</strong>. By setting the starting point to the length of the array, we append to the array rather than writing over existing data.</p>
<p>Finally, we got some recursion going! <code>get_resources</code> calls <code>get_resources</code> for every module found.</p>
<h3 id="the-get-resources-function">the <code>get_resources</code> function</h3>
<h3 id="the-get_resources-function">the <code>get_resources</code> function</h3>
<p>So far, our code looks like this:</p>
<pre class="language-sh"><code class="language-sh"><span class="token function-name function">get_resources</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
<span class="token builtin class-name">mapfile</span> <span class="token parameter variable">-t</span> resources <span class="token operator">&lt;</span> <span class="token operator">&lt;</span><span class="token punctuation">(</span><span class="token function">grep</span> <span class="token parameter variable">-E</span> <span class="token string">"^resource "</span> <span class="token string">"<span class="token variable">$file</span>"</span> <span class="token punctuation">\</span>
@@ -1973,7 +2125,7 @@ switch (currentThemeValue) {
<span class="token parameter variable">--query</span> <span class="token string">"resourceTypes[?resourceType=='<span class="token variable">$resourceType</span>'].locations | [0]"</span> <span class="token punctuation">\</span>
<span class="token parameter variable">--out</span> tsv<span class="token punctuation">)</span></code></pre>
<p><code>--out tsv</code> means we will get a list with no decoration whatsoever - it's vital for programmatic handling of <code>az</code> command output.</p>
<h3 id="cut-again"><code>cut</code> (again)</h3>
<h3 id="cut-(again)"><code>cut</code> (again)</h3>
<p>We'll need to get those <code>$namespace</code> and <code>$resourceType</code> variables. <code>cut</code> comes back in handy:</p>
<pre class="language-sh"><code class="language-sh"><span class="token comment"># remember, $resource is something like Microsoft.Resources/resourceGroups</span>
@@ -2076,6 +2228,7 @@ switch (currentThemeValue) {
<span class="token keyword">for</span> <span class="token for-or-select variable">location</span> <span class="token keyword">in</span> <span class="token string">"<span class="token variable">${locations<span class="token punctuation">[</span>@<span class="token punctuation">]</span>}</span>"</span><span class="token punctuation">;</span> <span class="token keyword">do</span> <span class="token builtin class-name">echo</span> <span class="token string">"<span class="token variable">$location</span>"</span><span class="token punctuation">;</span> <span class="token keyword">done</span> <span class="token operator">|</span> <span class="token function">tee</span> locations.txt</code></pre>
</article>
@@ -2113,12 +2266,12 @@ switch (currentThemeValue) {
<section class="related-posts">
<h2 data-ha-exclude="" id="related-posts">related posts</h2>
<h2 data-ha-exclude="">related posts</h2>
<ol id="postlist">
<li class="post">
<a class="postlink" href="/framer-accessibility/">
<h2 data-ha-exclude="" id="framer-accessibility">framer accessibility </h2>
<h2 data-ha-exclude="">framer accessibility </h2>
<ul class="postlist-tags">
@@ -2131,29 +2284,29 @@ switch (currentThemeValue) {
</li>
<li class="post">
<a class="postlink" href="/happy-solstice-2025/">
<h2 data-ha-exclude="" id="happy-solstice-2025">happy solstice 2025 </h2>
<ul class="postlist-tags">
<li>highlight</li>
</ul>
<img src="/img/solstice-2025.jpg" alt="front and back of our solstice card from this year, designed in postcard format. long alt incoming... front - 4 picture collage. 1 - i&#39;m standing in the woods, looking to one side, wearing an elaborate knit scarf. 2 - silhouetted thistle-like flowers in front of a pink-purple sky. 3 - my wife brooke crouches down to draw a heart in charcoal on a beach log, with &#39;L + B&#39; written inside. 4 - brooke stands on a driftwood-covered beach looking hella cool in mirrored shades. our dog kes stands in front of her and looks off to one side eagerly. overlaid is the words &#39;happy solstice&#39; in cursive. back - split down the center like the back of a postcard. on the left side, a 5 picture collage. 1 - i stand on a rock at the edge of a calm alpine lake. overlaid is the words &#39;lee, brooke, kestrel, &amp; the flock&#39; in print lettering. 2 - an early spring fern curl. 3 - our six ducks, all facing to the left, not in a row but still very organized. 4 - brooke grins at the camera while hugging kestrel&#39;s head. kestrel looks maybe a bit distraught. 5 - silhouette of a heron in flight across an early morning blue sky. on the address side, i&#39;ve added a dahlia to represent the stamp, and written &#39;you!&#39; in the field that would normally hold the mailing address." loading="lazy" decoding="async" width="1000" height="1346">
</a>
</li>
<li class="post">
<a class="postlink" href="/eleventy-lessons/">
<h2 data-ha-exclude="" id="eleventy-lessons">eleventy lessons </h2>
<a class="postlink" href="/comparing-text-editors/">
<h2 data-ha-exclude="">comparing text editors </h2>
<ul class="postlist-tags">
<li>software</li>
</ul>
<img src="/img/hellebore.jpg" alt="Image unrelated to post. Close up on a pale green hellebore flower." loading="lazy" decoding="async" width="1000" height="666">
<img src="/img/horsetail.jpg" alt="Image unrelated to post. Close up on a horsetail plant&#39;s stem, with many small needle-like leaves emerging from all sides of the circular stem at each segmented joint." loading="lazy" decoding="async" width="1000" height="666">
</a>
</li>
<li class="post">
<a class="postlink" href="/an-intro-to-git/">
<h2 data-ha-exclude="">an intro to git </h2>
<ul class="postlist-tags">
<li>software</li>
</ul>
<img src="/img/goldeneye-tail.jpg" alt="Image unrelated to post. The tail of a diving duck pokes out from the water with a small splash." loading="lazy" decoding="async" width="1000" height="666">
</a>
</li>
@@ -2210,6 +2363,6 @@ switch (currentThemeValue) {
</footer>
<!-- This page `/azure-locations-and-file-crawling/` was built on 2026-09-20T00:40:39.760Z -->
<!-- This page `/azure-locations-and-file-crawling/` was built on 2026-09-20T22:08:14.586Z -->
</body>
</html>