What you will learn in this TP
- Describe a resource in HCL
- Apply with plan then apply
- Detect drift
Terraform + LocalStack #
What you will learn in this section
- Describe a resource in HCL
- Apply with plan then apply
- Detect drift
Context. Infrastructure created by hand cannot be reproduced or audited. Infrastructure as Code describes resources in versioned files: you practise it with Terraform and see what configuration drift is.
Prerequisites: Previous lab (LocalStack), Terraform installed · Estimated time: 40 min
A versioned bucket described in HCL.1. Configure the provider
Why? The provider tells Terraform which API to target; pointing it at LocalStack, the same code would work on real AWS by removing the overrides.
Point the AWS provider to LocalStack.2. Describe the resource
Why? Describing versioning and tags in code guarantees they are identical everywhere and auditable in Git.
Create a bucket with versioning and anenv=labtag.3. Plan and apply
Why? plan shows what will change before doing it: it is the safeguard that prevents accidental destruction.
Run the full cycle and inspect the state.4. Drift and destruction
Why? Changing by hand then re-running plan makes drift clear: real state diverges from code, and Terraform offers to fix it.
Change the resource by hand, detect the drift, then destroy the infrastructure.
Difficulty level : ●●○○○ (2/5)
My progress
Sign in to track your progress and take notes. Sign in
Recommended Articles
Bonnes pratiques Cloud : sécurité, résilience, coûts et exploitation
Bonnes pratiques du Cloud Computing : piliers d'une architecture bien conçue, IAM et moindre priv...
Les modèles de déploiement Cloud : public, privé, hybride, communautaire et multi-cloud
Comprendre les modèles de déploiement du Cloud Computing selon le NIST : cloud public, privé, com...
License consumption types
Understand the evolution of billing in Dynatrace: the difference between the old licensing model ...
Grafana Alloy: The importance of Self-Monitoring
Discover why and how to configure Grafana Alloy so that it monitors itself, collecting its own lo...
Grafana Alloy: Understanding and exploiting the User Interface (UI)
Discover how to enable, secure, and use Grafana Alloy's built-in web interface to visualize your ...
Grafana Alloy: Introduction and Architecture
Discover the fundamental concepts of Grafana Alloy, the transition from the static Agent to Alloy...
Grafana Alloy: Syntax and Configuration (Alloy Language: River)
As part of a Grafana training or observability training, master the declarative syntax of Grafana...
Grafana Alloy: Metrics Collection (Prometheus & Ecosystem)
Learn how to configure Grafana Alloy to collect, transform, and forward metrics using the Prometh...
Grafana Alloy: Log Management with Loki
Discover how to configure Grafana Alloy to read log files, journald, or network streams, process ...