writing-infrastructure-code

Provision cloud infrastructure using Terraform, Pulumi, and AWS CDK with state management and modules.

1|Updated Feb 24, 2026
One-click install
npx skills add https://github.com/masermediagroup-stack/maser-media --skill writing-infrastructure-code-masermediagroup-stack
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: writing-infrastructure-code
Source: https://github.com/masermediagroup-stack/maser-media/tree/main/.cursor/skills/community/ai-design-components/skills/writing-infrastructure-code
Command: npx skills add https://github.com/masermediagroup-stack/maser-media --skill writing-infrastructure-code-masermediagroup-stack

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? Managing cloud infrastructure manually through consoles leads to inconsistent environments, configuration drift, and no audit trail. This Skill guides you through provisioning infrastructure as code with proper state management, reusable modules, and deployment workflows. ## Core Features & Use Cases - Tool Selection Guidance: Decision frameworks for choosing between Terraform/OpenTofu (multi-cloud, declarative), Pulumi (developer-centric, TypeScript/Python/Go), and AWS CDK (AWS-native constructs). - State Management Patterns: Remote state backends (S3 + DynamoDB, GCS, Azure Blob), locking, encryption, and isolation strategies via directory separation, workspaces, or layered architecture. - Module Design: Composable module structures with input validation, semantic versioning, registries, and Terratest/Pulumi unit testing patterns. - Use Case: A team needs to provision a production VPC with ECS services on AWS. Use this Skill to set up an S3 backend with DynamoDB locking, create a reusable VPC module with public/private subnets across three availability zones, and wire drift detection into CI. ## Quick Start Ask the AI to create a Terraform module for a multi-AZ AWS VPC with remote state configured on S3 with DynamoDB locking.

Frequently Asked Questions about writing-infrastructure-code

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up Terraform remote state with locking?▼

Configure an S3 backend with a DynamoDB table for state locking. Create the bucket with versioning and KMS encryption first, then reference it in a backend.tf block with the bucket, key, region, encrypt, and dynamodb_table parameters.

Terraform vs Pulumi: which IaC tool should I choose?▼

Choose Terraform for multi-cloud deployments with operations-focused teams who prefer declarative HCL and a large provider ecosystem. Choose Pulumi when developers need programming constructs like loops and conditionals in TypeScript, Python, or Go with native unit testing.

How do I detect infrastructure drift in Terraform?▼

Run terraform plan with the -detailed-exitcode flag, which returns exit code 2 when drift is detected. Schedule this check via cron or CI, and remediate by running terraform apply or updating code to match reality with -refresh-only.

Should I use Terraform workspaces or separate directories for environments?▼

Use directory separation for most teams since it provides complete state isolation with no risk of cross-environment operations. Workspaces share one backend and codebase, which risks accidental operations on the wrong environment.

When should I create a Terraform module instead of monolithic code?▼

Create a module when a resource group is reused three or more times, has clear input and output boundaries, and the team can maintain it. Keep code monolithic for one-off infrastructure, rapid prototyping, or tightly coupled resources.

How do I handle secrets in Terraform state files?▼

Mark sensitive outputs with sensitive = true, enable KMS encryption on the state backend, and reference secrets from a secrets manager instead of hardcoding values. Never commit state files to Git since they can contain plaintext sensitive data.