Skip to content
Back to skills

Setting Up Terraform

ASecurity

Set up Terraform infrastructure-as-code for cloud resources, including provider configuration, modules, state management, and CI integration.

  • 4 stars
  • 0 votes
  • 0 copies
  • 4 views
  • Added September 10, 2026
devopsawsgcpazureterraformgitbackend

Security analysis

A100/100

Scanned September 10, 2026

npx -y skills add 0xAidan/polymarket-bot-test --skill setting-up-terraform --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Setting Up Terraform?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Setting Up Terraform
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/0xaidan-setting-up-terraform/badge)](https://www.skillsdirectory.com/skills/0xaidan-setting-up-terraform)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: setting-up-terraform
description: Set up Terraform infrastructure-as-code for cloud resources, including provider configuration, modules, state management, and CI integration.
---

# Setup Terraform

Use this skill when the user asks to set up Terraform, infrastructure as code, cloud provisioning, or IaC.

## Steps

1. **Initialize the project structure**

   ```
   infra/
   ├── main.tf
   ├── variables.tf
   ├── outputs.tf
   ├── terraform.tfvars      # (gitignored)
   ├── providers.tf
   └── modules/
   ```

2. **Configure the provider** — in `providers.tf`:

   ```hcl
   terraform {
     required_version = ">= 1.5"
     required_providers {
       aws = {
         source  = "hashicorp/aws"
         version = "~> 5.0"
       }
     }
     backend "s3" {
       bucket = "my-terraform-state"
       key    = "prod/terraform.tfstate"
       region = "us-east-1"
     }
   }

   provider "aws" {
     region = var.aws_region
   }
   ```

   Adapt the provider for the user's cloud (AWS, GCP, Azure).

3. **Define variables** — in `variables.tf`, define inputs with types, descriptions, and defaults:

   ```hcl
   variable "aws_region" {
     type        = string
     default     = "us-east-1"
     description = "AWS region for resources"
   }

   variable "environment" {
     type        = string
     description = "Deployment environment (dev, staging, prod)"
   }
   ```

4. **Create resources** — in `main.tf`, define the infrastructure the user needs (VPC, RDS, ECS, S3, Lambda, etc.). Extract reusable patterns into modules under `modules/`.

5. **Configure remote state** — use an S3 bucket (AWS), GCS bucket (GCP), or Azure Storage for state. Enable state locking with DynamoDB (AWS).

6. **Add to `.gitignore`**

   ```
   *.tfstate
   *.tfstate.*
   .terraform/
   terraform.tfvars
   *.tfvars
   ```

7. **Add CI pipeline** — create a GitHub Actions workflow that runs `terraform fmt -check`, `terraform validate`, and `terraform plan` on PRs, with `terraform apply` on merge to main (with approval gate).

## Notes

- Never commit state files or `.tfvars` with secrets.
- Use workspaces or separate state files for dev/staging/prod.
- Pin provider versions to avoid breaking changes.
- Run `terraform fmt` before committing.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.