Infrastructure as code

코드형 인프라

Declare desired infrastructure in files, review the plan, and apply the difference.

···
html
<div class="stage" data-phase="0"><div class="title">DESIRED STATE → PLAN → ACTUAL</div><div class="row graph"><div class="panel mono">config<br>api: 2<br><span class="cache">cache: 1</span></div><div class="panel plan">+ cache</div><div class="panel nodes">API API<br><span class="cache">CACHE</span></div></div><div class="sub">review plan before apply</div></div>
css
.stage{width:min(94vw,760px);height:min(88vh,330px);padding:clamp(9px,2.6vmin,20px);border:1px solid var(--line);border-radius:14px;background:var(--surface);font:600 clamp(12px,2.5vmin,16px)/1.3 "Pretendard Variable",Pretendard,-apple-system,BlinkMacSystemFont,"Apple SD Gothic Neo",sans-serif;display:flex;flex-direction:column;gap:clamp(6px,1.7vmin,12px);overflow:hidden;position:relative}.stage *{min-width:0}.stage .title{color:var(--accent);font-weight:800}.stage .sub{color:var(--muted)}.stage .row{display:flex;align-items:center;gap:clamp(5px,1.6vmin,12px)}.stage .panel{border:1px solid var(--line);border-radius:8px;background:var(--bg);padding:clamp(6px,1.6vmin,12px)}.stage .mono{font-family:ui-monospace,SFMono-Regular,monospace;font-size:clamp(12px,2.5vmin,15px)}.stage .grow{flex:1}.stage .on{color:var(--accent)}.graph{flex:1;justify-content:space-between}.graph .panel{flex:1;text-align:center}.cache{color:var(--accent)}.graph .cache,.graph .plan{opacity:.65;transition:opacity .35s,transform .35s}.stage[data-phase="1"] .graph .cache:first-child,.stage[data-phase="1"] .graph .plan,.stage[data-phase="2"] .graph .cache,.stage[data-phase="2"] .graph .plan{opacity:1}.stage[data-phase="2"] .nodes .cache{display:inline-block;transform:scale(1.1)}
js
const stage=document.querySelector('.stage');let phase=0;function advance(){phase=(phase+1)%3;stage.dataset.phase=String(phase)}const timer=setInterval(advance,1200);stage.addEventListener('pointerdown',()=>{clearInterval(timer);advance()})

Infrastructure as code describes servers and networks in versioned declarations. A tool compares current and desired state to plan creates, updates, and deletes.

The demo adds a cache node to a declaration, then shows the planned difference and resulting graph. Review the plan before applying because an unintended delete can affect live resources.

When to use

Use it to reproduce environments and review infrastructure changes as code.

Open as page ↗