forked from AdminTurnedDevOps/DevOps-The-Hard-Way-AWS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from matthewmc1/storage
Storage
- Loading branch information
Showing
21 changed files
with
104 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Configure Credentials To Access GCP At The Programmatic Level | ||
|
||
|
||
The purpse of this lab is to configure IAM credentials on your local computer so that you can access GCP at a programmatic level (SDKs, CLI, Terraform, etc.) | ||
|
||
## Install gcloud CLI | ||
1. [Cloud SDK](https://cloud.google.com/sdk/docs/install) | ||
|
||
## Billing Account | ||
|
||
You should have a billing account assosicated to your account prior to starting this, if you have never used GCP before this will also entitle you to credits on sign-up to use this project but make sure to destroy after so that you are not charged for this. | ||
|
||
## Login & Create Project | ||
1. Running locally to create, first run `gcloud auth application-default login` - this will login using the Google sign-in option. | ||
2. Set your default project for running `gcloud projects create devops-the-hardway` | ||
3. Confirm project is created `gcloud projects list` | ||
4. Link billing account to the project `gcloud beta billing projects link devops-the-hardway --billing-account {BILLING-ID}` | ||
4. Set default project `gcloud config set project devops-the-hardway` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 0 additions & 17 deletions
17
Terraform-AWS-Services-Creation/1-Create-S3-Bucket-To-Store-TFSTATE-Files.md
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
Terraform-AWS-Services-Creation/terraform-state-s3-bucket/main.tf
This file was deleted.
Oops, something went wrong.
38 changes: 38 additions & 0 deletions
38
Terraform-GCP-Services-Creation/1-Create-GCS-Bucket-To-Store-TFSTATE-Files.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Create an Google Cloud Storage bucket to store Terraform state files | ||
|
||
In this lab you will create an Google Cloud Storage bucket that will be used to store Terraform state files | ||
|
||
## Create The Terraform Configurations | ||
|
||
1. You can find the Terraform configuration for the Google Cloud Storage bucket [here](https://github.com/mmcgibbon1/DevOps-The-Hard-Way-GCP/tree/trunk/Terraform-GCP-Services-Creation/terraform-state-gcs-bucket). The Terraform configuration files are used to create an Google Cloud Storage bucket that will store your TFSTATE. | ||
|
||
The Terraform `main.tf` will do a few things: | ||
- Create the Google Cloud Storage bucket in the `EU` region for regional availability | ||
- Ensure that version enabling is set to `True` | ||
|
||
|
||
2. Create the bucket by running the following: | ||
- `terraform init` - To initialize the working directory and pull down the provider | ||
- `terraform plan -out gcs.tfplan` - To go through a "check" and confirm the configurations are valid and create a plan file based on the name provided. | ||
- `terraform apply gcs.tfplan` - To create the resource | ||
|
||
3. Sample output from `terraform plan -out gcs.tfplan` | ||
|
||
``` | ||
# google_storage_bucket.terraform_state will be created | ||
+ resource "google_storage_bucket" "terraform_state" { | ||
+ force_destroy = false | ||
+ id = (known after apply) | ||
+ location = "EU" | ||
+ name = "terraform-state-devopsthehardway-gcp" | ||
+ project = (known after apply) | ||
+ self_link = (known after apply) | ||
+ storage_class = "STANDARD" | ||
+ uniform_bucket_level_access = true | ||
+ url = (known after apply) | ||
+ versioning { | ||
+ enabled = true | ||
} | ||
} | ||
``` |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
repo_name = "devopsthehardway-gcp" |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
13 changes: 13 additions & 0 deletions
13
Terraform-GCP-Services-Creation/terraform-state-gcs-bucket/main.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
resource "google_storage_bucket" "terraform_state" { | ||
name = "terraform-state-devopsthehardway-gcp" | ||
location = "EU" | ||
|
||
versioning { | ||
enabled = true | ||
} | ||
|
||
project = var.project_id | ||
|
||
uniform_bucket_level_access = true | ||
} | ||
|
1 change: 1 addition & 0 deletions
1
Terraform-GCP-Services-Creation/terraform-state-gcs-bucket/terraform.tfvars
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
project_id = "devops-the-hardway" |
5 changes: 5 additions & 0 deletions
5
Terraform-GCP-Services-Creation/terraform-state-gcs-bucket/variables.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
variable project_id { | ||
type = string | ||
default = "devops-the-hardway" | ||
description = "Default Project" | ||
} |