Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sgibson91/terraform-example
An example repo to demonstrate terraform with GCP and Azure
https://github.com/sgibson91/terraform-example
Last synced: about 1 month ago
JSON representation
An example repo to demonstrate terraform with GCP and Azure
- Host: GitHub
- URL: https://github.com/sgibson91/terraform-example
- Owner: sgibson91
- License: mit
- Created: 2021-09-15T12:59:41.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-10-25T16:23:52.000Z (about 2 years ago)
- Last Synced: 2024-10-12T15:08:31.231Z (3 months ago)
- Language: HCL
- Size: 52.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Terraforming the Cloud
This is an example repo to demonstrate `terraform` with GCP and Azure as part of a talk.
Slides are available here :point_right:
The examples in this repo where developed using Hashicorp's Terraform Get Started guides for Azure and GCP.
- [Get Started with Azure](https://learn.hashicorp.com/collections/terraform/azure-get-started)
- [Get started with GCP](https://learn.hashicorp.com/collections/terraform/gcp-get-started)## What you will need
- A `terraform` installation:
- An account with your chosen cloud provider
- If you choose Google Cloud, you will also need to [create a service account](https://cloud.google.com/iam/docs/creating-managing-service-accounts) and [generate a key](https://cloud.google.com/iam/docs/creating-managing-service-account-keys) for it
- The command line interface installation for your chosen cloud provider, either:
- Azure:
- Google Cloud:## How to use this repo
1. Clone the repo
```bash
git clone https://github.com/sgibson91/terraform-example.git
cd terraform-example
```2. Change into the `terraform` subdirectory of your chosen cloud provider
```bash
cd terraform/{{ azure | gcp }}
```3. Authenticate with your chosen cloud provider
```bash
# For Azure
az login
# For Google Cloud
gcloud auth login
```4. Create a copy of `inputs.example.tfvars` and replace the placeholder values with your desired inputs.
You may even choose to change some other values that are listed in `variables.tf`.```bash
cp inputs.example.tfvars inputs.tfvars
```5. Initialise `terraform`
```bash
terraform init
```6. Plan your infrastructure changes
```bash
terraform plan -var-file=inputs.tfvars -out=plan
```7. Apply your infrastructure changes
```bash
terraform apply plan
```:bulb: Steps 6 and 7 can be repeated as many times as you wish as you make changes to your infrastructure
8. Once you are finished, destroy your infrastructure
```bash
terraform plan -var-file=inputs.tfvars -out-plan -destroy
terraform apply plan
```