Skip to content

Latest commit

 

History

History
63 lines (47 loc) · 2.64 KB

README.md

File metadata and controls

63 lines (47 loc) · 2.64 KB

terraform

This directory contains Terraform modules and configurations for some of the GCP projects maintained by sig-k8s-infra.

Layout

.
├── modules           # modules inteded for re-use in-repo
│   └── <module>      # a reusable group of terraform resources 
└── <project>         # module scoped to terraform resources within GCP project <project> (.tf files live here)
    └── <cluster>     # GKE cluster named <cluster> for each cluster in the project
        └── resources # cluster-scoped k8s resources live in resources
            └── <ns>  # namespace-scoped k8s resources live in <namespace>

Each directory in modules represents a Terraform module intended for reuse inside of this repo. Not every configuration is able to use these modules yet due to differences in google provider version.

Each directory in projects represents a GCP project. Those that have GKE clusters have a subdirectory per cluster which may contain a resources folder containing manifests that are deployed to the cluster

Prerequsites

Developing

  • From within a module directory:
  • tfswitch will ensure the correct version of terraform is used
  • terraform fmt will auto-format all .tf files
  • terraform validate will validate that all .tf files are valid

Deploying

  • Ensure you are logged into your GCP account with gcloud auth application-default login
  • From within a module directory:
    • terraform init will initialize your local state (refresh modules)
    • terraform plan will print changes needed to create/update a cluster
    • terraform apply will apply them

Deleting

  • Get approval from a WG K8s Infra lead (ask in #sig-k8s-infra before doing this)
  • Ensure you are logged into your GCP account with gcloud auth application-default login
  • From within a module directory:
    • terraform destroy will destroy and clean up all created resources