Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
ankit25587 authored Oct 1, 2021
1 parent 88e23a0 commit 9d225a5
Show file tree
Hide file tree
Showing 64 changed files with 959 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tf-workspace/Basics/data_source/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
data local_file foo {
filename = "sample1.txt"
}

output name1 {
value = data.local_file.foo.content
}

1 change: 1 addition & 0 deletions tf-workspace/Basics/data_source/sample1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is fro datasource.
1 change: 1 addition & 0 deletions tf-workspace/Basics/dependency/explicit.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is random String from RP : frctr]h=H2
9 changes: 9 additions & 0 deletions tf-workspace/Basics/dependency/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
resource local_file name1 {
filename = "explicit.txt"
content = "This is random String from RP : ${random_string.name2.id}"
depends_on = [random_string.name2]
}

resource random_string name2 {
length = 10
}
4 changes: 4 additions & 0 deletions tf-workspace/Basics/first-tf-script/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
resource local_file sample_res {
filename = "sample.txt"
content = "I Love Terraform"
}
1 change: 1 addition & 0 deletions tf-workspace/Basics/first-tf-script/sample.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
I Love Terraform
11 changes: 11 additions & 0 deletions tf-workspace/Basics/lifecycle/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
resource random_integer name {
min = 20
max = 350

lifecycle{
#create_before_destroy = true
#prevent_destroy = true
ignore_changes = [min, max]
}

}
5 changes: 5 additions & 0 deletions tf-workspace/Basics/local_arg/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
resource local_file sample_res {
filename = "sample_args.txt"
sensitive_content = "I Love Terraform"
file_permission = "0700"
}
1 change: 1 addition & 0 deletions tf-workspace/Basics/local_arg/sample_args.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
I Love Terraform
8 changes: 8 additions & 0 deletions tf-workspace/Basics/multiple_provider/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
resource local_file name {
content = "This is HCL"
filename = "sample.txt"
}

resource random_string name {
length = 10
}
1 change: 1 addition & 0 deletions tf-workspace/Basics/multiple_provider/sample.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is HCL
1 change: 1 addition & 0 deletions tf-workspace/Basics/multiple_resource/cat.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
I Love Cats
1 change: 1 addition & 0 deletions tf-workspace/Basics/multiple_resource/dog.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
I Love Dogs
9 changes: 9 additions & 0 deletions tf-workspace/Basics/multiple_resource/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
resource local_file cat_res {
filename = "cat.txt"
content = "I Love Cats"
}

resource local_file dog_res {
filename = "dog.txt"
content = "I Love Dogs"
}
18 changes: 18 additions & 0 deletions tf-workspace/Basics/provider_version/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
terraform {
required_providers {
random = {
source = "hashicorp/random"
version = "2.3.1"
}
}
}

provider "random" {
# Configuration options
}


resource random_integer name {
min = 0
max = 100
}
17 changes: 17 additions & 0 deletions tf-workspace/Basics/random_provider/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
resource random_integer rint{
min = 80
max = 200
}

resource random_string rstring {
length = 15
}


output name1 {
value = random_integer.rint.result
}

output name2 {
value = random_string.rstring.result
}
7 changes: 7 additions & 0 deletions tf-workspace/Basics/types_of_variable/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
resource local_file sample_res {
filename = var.filename1
content = var.content1["name"]
}



1 change: 1 addition & 0 deletions tf-workspace/Basics/types_of_variable/sample1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
I
35 changes: 35 additions & 0 deletions tf-workspace/Basics/types_of_variable/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
variable filename1 {
type = string
default = "sample1.txt"
}
/*
variable content1 {
type = number
default = 23
}
*/

/*
variable content1 {
type = bool
default = true
}
*/
/*
variable content1 {
type = list(string)
default = ["red", "green", "blue"]
}
*/

/*
variable content1 {
type = tuple([string,bool,number])
default = ["red", true, 23]
}
*/

variable content1 {
type = map
default = {name = "Ankit", age = 32}
}
7 changes: 7 additions & 0 deletions tf-workspace/Basics/use_of_variable/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
resource local_file sample_res {
filename = var.filename1
content = var.content1
}



1 change: 1 addition & 0 deletions tf-workspace/Basics/use_of_variable/sample3.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
I am loving Terraform
8 changes: 8 additions & 0 deletions tf-workspace/Basics/use_of_variable/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
variable filename1 {
type = string
}

variable content1 {
type = string
default = "I am loving Terraform"
}
7 changes: 7 additions & 0 deletions tf-workspace/Basics/variables/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
resource local_file sample_res {
filename = var.filename1
content = var.content1
}



1 change: 1 addition & 0 deletions tf-workspace/Basics/variables/sample1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
I am loving Terraform
9 changes: 9 additions & 0 deletions tf-workspace/Basics/variables/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
variable filename1 {
type = string
default = "sample1.txt"
}

variable content1 {
type = string
default = "I am loving Terraform"
}
12 changes: 12 additions & 0 deletions tf-workspace/GCP/BigQuery/keys.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"type": "service_account",
"project_id": "terraform-gcp-326702",
"private_key_id": "4991e78cebe24fd978c16b124f0066ca31ea0d94",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKY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kTvSRDlSo6s\nxgrciBo/+QKBgDwNuP7D03+CikZYbleP7B1q+6PO9YL19xsZ0uVvD+wT8dBw79D/\nvpni6+fLun/eHtSvHs2vms0/gnMcRXHX12+YyK9+kP7mNVKMUCRsRQtWnhNkuZaH\nSfAdgOZWOpsCDtmri0kD59qXiMRy5QmhiMwi1Eahv2d6ilSPb8Hlj0FxAoGABE0C\n9ISrFGR3e1DELp9+RF9npU2+RQMzZgAg9p0vNOVCagdj7cuUiDWNTxfRu33iVaA4\n6fxiSttN0gq/4tsKWDeLds65wblhBiinC+278SLY802Af26QyNLmWOJsE03gbhXr\nubK85nld6kCLK4k98VNpp1drZHiCMpEDFMY3VXECgYBfBTnltTQAxC9qeb4lb+zW\n1eGvGyRaLpdpZwPrqIdBvl77FVwe6ssAraib88eP6cvsrE0fhzSkAoDcxk/KFDe4\nylZe8pshC/VQwm41gn6UEHZHc+mexTWsQDKDPMTgaKdbomwbhrY16y3KXDjSb78/\nHrZMuNBzv3sz9IQQx4kvWw==\n-----END PRIVATE KEY-----\n",
"client_email": "[email protected]",
"client_id": "106740179622123437802",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/terraform-gcp%40terraform-gcp-326702.iam.gserviceaccount.com"
}
9 changes: 9 additions & 0 deletions tf-workspace/GCP/BigQuery/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
resource "google_bigquery_dataset" "bd_ds" {
dataset_id = "ds_from_tf"
}

resource "google_bigquery_table" "table_tf" {
table_id = "table_from_tf"
dataset_id = google_bigquery_dataset.bd_ds.dataset_id

}
27 changes: 27 additions & 0 deletions tf-workspace/GCP/BigQuery/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
terraform {
required_providers {
google = {
source = "hashicorp/google"
version = "3.85.0"
}
}
}

provider "google" {
# Configuration options
project = "terraform-gcp-326702"
region = "us-central1"
zone = "us-central1-a"
credentials = "keys.json"
}











12 changes: 12 additions & 0 deletions tf-workspace/GCP/BigTable/keys.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"type": "service_account",
"project_id": "terraform-gcp-326702",
"private_key_id": "4991e78cebe24fd978c16b124f0066ca31ea0d94",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCnxWTy1uKo51fJ\nDPs+mJopRqrvPHpLdN85KiwhW5iHlzHCCpmEf2ZwkfCWT3+aUL5NdJW+Y7SS48Wz\nLLZTSFj3Jitk4dg5FLRw4EGQK/J6UnxUqMhMEEB/zUnK6QiKNo9xOwqkE4ihBHtZ\nDFI9pmmknQqdvcv3VBDATazbXYRfM01jU2mcX91RmzMq7YHYots0AyZ6uYbXbzfT\n38nsueoxn49G54N1uort/LvkwIFPAdn2pTVrjJGJwuaRLh9xHuTiHY3RAb3aCv9D\nBWH6/kxLB7+bjAatIBetejT0D6/gbm/wzbVJ3NyvmSgW0+zWBE7k++H8oASaXuT5\nCRMyp3ZFAgMBAAECggEABGIwRmicjTe64Yqt34oh0F845sEpahRAhzOz6cI21ZIe\ngTw58Vx2B3/GdPaDLxg2YSYaCdqZO6j3RvV0wYvQWigjrvP4Qcxw1UpLoLH5Q3dw\nVAgPt3xl/+uFwzVnJE2TXkk3OJlv8uDcWaV6r59L+CxdfDqTxt9xEn6PvCKUecKa\nNI6mfvqFDU/EvvsJiU3NS1Y+otHqrOhbygerxIG+2DvKSpCGorUbRq/xY6QadkV0\nIs8pM745jeALP9aSuGuQX2mM/kgwsLR4AhfoYLSGTy+dlNi+yndms6WVm0Azx4V/\nruvkNODxNo4x9ABxH18itfhVaygi7I7OdLwvjOhcSQKBgQDPiX2ajPZ80I+JPjbA\nvvuyxaS6indcAP/13HFiPz+0dNI3ONzEHIFKe4Pzk2OQqpz0CfuHdQSnvvvFBJjk\n6S0wHUUsiZdRy3a/7XYZ+mdz+yjLf6mKaAEuDUwGk2y2dwjaEoiskEq2LYLH1qiI\nKUlZvPD0XSwh1BIhgIRrM7DTrQKBgQDO8rP56h8GTirQThiyH76QqquNOvBafyMv\npxax1j1KJLXPeEkmoJQSb46YFTTf+ZOkwbL52nXlO+XwUY+GwLILofXqm7xrWZvr\nQ4QObn7ZDYyfGSYkqfSbkhOB1hPfSUEG1RwfScrY9Gtw3I4cpa6IVkTvSRDlSo6s\nxgrciBo/+QKBgDwNuP7D03+CikZYbleP7B1q+6PO9YL19xsZ0uVvD+wT8dBw79D/\nvpni6+fLun/eHtSvHs2vms0/gnMcRXHX12+YyK9+kP7mNVKMUCRsRQtWnhNkuZaH\nSfAdgOZWOpsCDtmri0kD59qXiMRy5QmhiMwi1Eahv2d6ilSPb8Hlj0FxAoGABE0C\n9ISrFGR3e1DELp9+RF9npU2+RQMzZgAg9p0vNOVCagdj7cuUiDWNTxfRu33iVaA4\n6fxiSttN0gq/4tsKWDeLds65wblhBiinC+278SLY802Af26QyNLmWOJsE03gbhXr\nubK85nld6kCLK4k98VNpp1drZHiCMpEDFMY3VXECgYBfBTnltTQAxC9qeb4lb+zW\n1eGvGyRaLpdpZwPrqIdBvl77FVwe6ssAraib88eP6cvsrE0fhzSkAoDcxk/KFDe4\nylZe8pshC/VQwm41gn6UEHZHc+mexTWsQDKDPMTgaKdbomwbhrY16y3KXDjSb78/\nHrZMuNBzv3sz9IQQx4kvWw==\n-----END PRIVATE KEY-----\n",
"client_email": "[email protected]",
"client_id": "106740179622123437802",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/terraform-gcp%40terraform-gcp-326702.iam.gserviceaccount.com"
}
20 changes: 20 additions & 0 deletions tf-workspace/GCP/BigTable/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
resource "google_bigtable_instance" "bt-from-tf" {

name = "bt-from-tf"
deletion_protection = false
labels = {
"env" = "testing"
}
cluster {
cluster_id = "bt-from-tf-1"
num_nodes = 1
storage_type = "SSD"
}

}


resource "google_bigtable_table" "tb1" {
name = "tb-from-tf"
instance_name = google_bigtable_instance.bt-from-tf.name
}
27 changes: 27 additions & 0 deletions tf-workspace/GCP/BigTable/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
terraform {
required_providers {
google = {
source = "hashicorp/google"
version = "3.85.0"
}
}
}

provider "google" {
# Configuration options
project = "terraform-gcp-326702"
region = "us-central1"
zone = "us-central1-a"
credentials = "keys.json"
}











Binary file added tf-workspace/GCP/Function/index.zip
Binary file not shown.
12 changes: 12 additions & 0 deletions tf-workspace/GCP/Function/keys.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"type": "service_account",
"project_id": "terraform-gcp-326702",
"private_key_id": "4991e78cebe24fd978c16b124f0066ca31ea0d94",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCnxWTy1uKo51fJ\nDPs+mJopRqrvPHpLdN85KiwhW5iHlzHCCpmEf2ZwkfCWT3+aUL5NdJW+Y7SS48Wz\nLLZTSFj3Jitk4dg5FLRw4EGQK/J6UnxUqMhMEEB/zUnK6QiKNo9xOwqkE4ihBHtZ\nDFI9pmmknQqdvcv3VBDATazbXYRfM01jU2mcX91RmzMq7YHYots0AyZ6uYbXbzfT\n38nsueoxn49G54N1uort/LvkwIFPAdn2pTVrjJGJwuaRLh9xHuTiHY3RAb3aCv9D\nBWH6/kxLB7+bjAatIBetejT0D6/gbm/wzbVJ3NyvmSgW0+zWBE7k++H8oASaXuT5\nCRMyp3ZFAgMBAAECggEABGIwRmicjTe64Yqt34oh0F845sEpahRAhzOz6cI21ZIe\ngTw58Vx2B3/GdPaDLxg2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AoDcxk/KFDe4\nylZe8pshC/VQwm41gn6UEHZHc+mexTWsQDKDPMTgaKdbomwbhrY16y3KXDjSb78/\nHrZMuNBzv3sz9IQQx4kvWw==\n-----END PRIVATE KEY-----\n",
"client_email": "[email protected]",
"client_id": "106740179622123437802",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/terraform-gcp%40terraform-gcp-326702.iam.gserviceaccount.com"
}
37 changes: 37 additions & 0 deletions tf-workspace/GCP/Function/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#Create Bucket
#Upload index.zip
#deploy function
#policy binding

resource "google_storage_bucket" "fun_bucket" {
name = "fun_bucket_tf"
}

resource "google_storage_bucket_object" "srccode" {
name = "index.zip"
bucket = google_storage_bucket.fun_bucket.name
source = "index.zip"
}

resource "google_cloudfunctions_function" "fun_from_tf" {
name = "fun-from-tf"
runtime = "nodejs14"
description = "This is my first function from terraform script."

available_memory_mb = 128
source_archive_bucket = google_storage_bucket.fun_bucket.name
source_archive_object = google_storage_bucket_object.srccode.name

trigger_http = true
entry_point = "helloWorldtf"

}

resource "google_cloudfunctions_function_iam_member" "allowaccess" {
region = google_cloudfunctions_function.fun_from_tf.region
cloud_function = google_cloudfunctions_function.fun_from_tf.name

role = "roles/cloudfunctions.invoker"
member = "allUsers"

}
Loading

0 comments on commit 9d225a5

Please sign in to comment.