forked from DataTalksClub/data-engineering-zoomcamp
-
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.
Added new video links for Terraform and two directories to replace la…
…st year's terraform tf files (DataTalksClub#392)
- Loading branch information
1 parent
6101f8a
commit 96e87c0
Showing
7 changed files
with
135 additions
and
80 deletions.
There are no files selected for viewing
2 changes: 0 additions & 2 deletions
2
week_1_basics_n_setup/1_terraform_gcp/terraform/.terraform-version
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
48 changes: 48 additions & 0 deletions
48
week_1_basics_n_setup/1_terraform_gcp/terraform/terraform_basic/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,48 @@ | ||
terraform { | ||
required_providers { | ||
google = { | ||
source = "hashicorp/google" | ||
version = "4.51.0" | ||
} | ||
} | ||
} | ||
|
||
provider "google" { | ||
# Credentials only needs to be set if you do not have the GOOGLE_APPLICATION_CREDENTIALS set | ||
# credentials = | ||
project = "<Your Project ID>" | ||
region = "us-central1" | ||
} | ||
|
||
|
||
|
||
resource "google_storage_bucket" "data-lake-bucket" { | ||
name = "<Your Unique Bucket Name>" | ||
location = "US" | ||
|
||
# Optional, but recommended settings: | ||
storage_class = "STANDARD" | ||
uniform_bucket_level_access = true | ||
|
||
versioning { | ||
enabled = true | ||
} | ||
|
||
lifecycle_rule { | ||
action { | ||
type = "Delete" | ||
} | ||
condition { | ||
age = 30 // days | ||
} | ||
} | ||
|
||
force_destroy = true | ||
} | ||
|
||
|
||
resource "google_bigquery_dataset" "dataset" { | ||
dataset_id = "<The Dataset Name You Want to Use>" | ||
project = "<Your Project ID>" | ||
location = "US" | ||
} |
38 changes: 38 additions & 0 deletions
38
week_1_basics_n_setup/1_terraform_gcp/terraform/terraform_with_variables/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,38 @@ | ||
terraform { | ||
required_providers { | ||
google = { | ||
source = "hashicorp/google" | ||
version = "5.6.0" | ||
} | ||
} | ||
} | ||
|
||
provider "google" { | ||
credentials = file(var.credentials) | ||
project = var.project | ||
region = var.region | ||
} | ||
|
||
|
||
resource "google_storage_bucket" "demo-bucket" { | ||
name = var.gcs_bucket_name | ||
location = var.location | ||
force_destroy = true | ||
|
||
|
||
lifecycle_rule { | ||
condition { | ||
age = 1 | ||
} | ||
action { | ||
type = "AbortIncompleteMultipartUpload" | ||
} | ||
} | ||
} | ||
|
||
|
||
|
||
resource "google_bigquery_dataset" "demo_dataset" { | ||
dataset_id = var.bq_dataset_name | ||
location = var.location | ||
} |
41 changes: 41 additions & 0 deletions
41
week_1_basics_n_setup/1_terraform_gcp/terraform/terraform_with_variables/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,41 @@ | ||
variable "credentials" { | ||
description = "My Credentials" | ||
default = "<Path to your Service Account json file>" | ||
#ex: if you have a directory where this file is called keys with your service account json file | ||
#saved there as my-creds.json you could use default = "./keys/my-creds.json" | ||
} | ||
|
||
|
||
variable "project" { | ||
description = "Project" | ||
default = "<Your Project ID>" | ||
} | ||
|
||
variable "region" { | ||
description = "Region" | ||
#Update the below to your desired region | ||
default = "us-central1" | ||
} | ||
|
||
variable "location" { | ||
description = "Project Location" | ||
#Update the below to your desired location | ||
default = "US" | ||
} | ||
|
||
variable "bq_dataset_name" { | ||
description = "My BigQuery Dataset Name" | ||
#Update the below to what you want your dataset to be called | ||
default = "demo_dataset" | ||
} | ||
|
||
variable "gcs_bucket_name" { | ||
description = "My Storage Bucket Name" | ||
#Update the below to a unique bucket name | ||
default = "terraform-demo-terra-bucket" | ||
} | ||
|
||
variable "gcs_storage_class" { | ||
description = "Bucket Storage Class" | ||
default = "STANDARD" | ||
} |
24 changes: 0 additions & 24 deletions
24
week_1_basics_n_setup/1_terraform_gcp/terraform/variables.tf
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