terraform-gcp

📁 bagelhole/devops-security-agent-skills 📅 9 days ago
8
总安装量
2
周安装量
#34614
全站排名
安装命令
npx skills add https://github.com/bagelhole/devops-security-agent-skills --skill terraform-gcp

Agent 安装分布

opencode 2
codex 2
amp 1
github-copilot 1
claude-code 1

Skill 文档

Terraform GCP

Provision Google Cloud infrastructure with Terraform.

Provider Configuration

terraform {
  required_providers {
    google = {
      source  = "hashicorp/google"
      version = "~> 5.0"
    }
  }
  backend "gcs" {
    bucket = "tf-state-bucket"
    prefix = "terraform/state"
  }
}

provider "google" {
  project = var.project_id
  region  = var.region
}

Example Resources

resource "google_compute_network" "vpc" {
  name                    = "main-vpc"
  auto_create_subnetworks = false
}

resource "google_compute_instance" "vm" {
  name         = "web-server"
  machine_type = "e2-micro"
  zone         = "us-central1-a"

  boot_disk {
    initialize_params {
      image = "debian-cloud/debian-11"
    }
  }

  network_interface {
    network = google_compute_network.vpc.name
  }
}

Best Practices

  • Use service accounts for authentication
  • Store state in GCS
  • Use labels consistently
  • Implement least-privilege IAM