From 05bf684ed98ad50e239a3e4f5a95654f62c66d59 Mon Sep 17 00:00:00 2001 From: "Patel, VijayKumar" Date: Thu, 23 Jul 2020 22:48:32 +0530 Subject: [PATCH 01/33] added jenkins file --- terraform-aws-ec2-userdata/Jenkinsfile | 73 ++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 terraform-aws-ec2-userdata/Jenkinsfile diff --git a/terraform-aws-ec2-userdata/Jenkinsfile b/terraform-aws-ec2-userdata/Jenkinsfile new file mode 100644 index 0000000..4d8490f --- /dev/null +++ b/terraform-aws-ec2-userdata/Jenkinsfile @@ -0,0 +1,73 @@ + +pipeline { + + parameters { + string(name: 'environment', defaultValue: 'terraform', description: 'Workspace/environment file to use for deployment') + string(name: 'service', defaultValue: 'apache', description: 'please provide service name') + booleanParam(name: 'autoApprove', defaultValue: false, description: 'Automatically run apply after generating plan?') + + } + + + environment { + AWS_ACCESS_KEY_ID = credentials('AWS_ACCESS_KEY_ID') + AWS_SECRET_ACCESS_KEY = credentials('AWS_SECRET_ACCESS_KEY') + } + + agent any + options { + timestamps () + } + stages { + stage('checkout') { + steps { + git "https://github.com/easyawslearn/Terraform-Tutorial.git" + } + } + + stage('Plan') { + steps { + sh ''' + cd terraform-aws-ec2-userdata ; + terraform init \ + -upgrade=true \ + -get=true \ + -input=false \ + -force-copy \ + -backend=true \ + -backend-config "bucket='aws-terraform-devops-backend'" \ + -backend-config "key=terraform/${SERVICE}.tfstate" \ + -backend-config "region=us-east-1" \ + -backend-config "dynamodb_table=terraform" \ + -lock=true + + terraform workspace show | grep -q ${environment} ; if [ $? == 0 ];then echo "workspace already exists";else terraform workspace new ${environment}; fi; + terraform plan -input=false -out tfplan ; + terraform show -no-color tfplan > tfplan.txt + ''' + } + } + stage('Approval') { + when { + not { + equals expected: true, actual: params.autoApprove + } + } + + steps { + script { + def plan = readFile 'terraform/aws-instance-first-script/tfplan.txt' + input message: "Do you want to apply the plan?", + parameters: [text(name: 'Plan', description: 'Please review the plan', defaultValue: plan)] + } + } + } + + stage('Apply') { + steps { + sh "pwd;cd terraform/aws-instance-first-script ; terraform apply -input=false tfplan" + } + } + } + + } From eb73de14aff5fa81254bf59674deff044cc3ec92 Mon Sep 17 00:00:00 2001 From: "Patel, VijayKumar" Date: Thu, 23 Jul 2020 23:01:15 +0530 Subject: [PATCH 02/33] updated config --- EC2withJenkins/ec2_jenkins.tf | 6 ++++++ terraform-aws-ec2-userdata/Jenkinsfile | 8 +++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/EC2withJenkins/ec2_jenkins.tf b/EC2withJenkins/ec2_jenkins.tf index b99c0ef..7c17958 100644 --- a/EC2withJenkins/ec2_jenkins.tf +++ b/EC2withJenkins/ec2_jenkins.tf @@ -20,6 +20,12 @@ resource "aws_instance" "ec2_jenkins" { curl --silent --location http://pkg.jenkins-ci.org/redhat-stable/jenkins.repo | sudo tee /etc/yum.repos.d/jenkins.repo sudo rpm --import https://jenkins-ci.org/redhat/jenkins-ci.org.key yum install -y jenkins + yum install -y git + + wget https://releases.hashicorp.com/terraform/0.12.29/terraform_0.12.29_linux_amd64.zip + unzip terraform_0.12.29_linux_amd64.zip + mv terraform /usr/bin + systemctl start jenkins systemctl status jenkins systemctl enable jenkins diff --git a/terraform-aws-ec2-userdata/Jenkinsfile b/terraform-aws-ec2-userdata/Jenkinsfile index 4d8490f..78cfc14 100644 --- a/terraform-aws-ec2-userdata/Jenkinsfile +++ b/terraform-aws-ec2-userdata/Jenkinsfile @@ -17,6 +17,7 @@ pipeline { agent any options { timestamps () + ansiColor('xterm') } stages { stage('checkout') { @@ -41,7 +42,8 @@ pipeline { -backend-config "dynamodb_table=terraform" \ -lock=true - terraform workspace show | grep -q ${environment} ; if [ $? == 0 ];then echo "workspace already exists";else terraform workspace new ${environment}; fi; + terraform workspace show | grep -q ${environment} ; if [ $? == 0 ];then echo "workspace already exists";else terraform workspace new ${environment}; fi; + echo "INFO: Terraform -> Working for "${environment name} terraform plan -input=false -out tfplan ; terraform show -no-color tfplan > tfplan.txt ''' @@ -56,7 +58,7 @@ pipeline { steps { script { - def plan = readFile 'terraform/aws-instance-first-script/tfplan.txt' + def plan = readFile 'terraform-aws-ec2-userdata/tfplan.txt' input message: "Do you want to apply the plan?", parameters: [text(name: 'Plan', description: 'Please review the plan', defaultValue: plan)] } @@ -65,7 +67,7 @@ pipeline { stage('Apply') { steps { - sh "pwd;cd terraform/aws-instance-first-script ; terraform apply -input=false tfplan" + sh "cd terraform-aws-ec2-userdata ; terraform apply -input=false tfplan" } } } From 5b63fc0b7fac227d21edee3258e033724a9efa49 Mon Sep 17 00:00:00 2001 From: "Patel, VijayKumar" Date: Thu, 23 Jul 2020 23:49:17 +0530 Subject: [PATCH 03/33] cosmetic chnages --- terraform-aws-ec2-userdata/provider.tf | 14 ++++++++++++++ terraform-aws-ec2-userdata/security_group.tf | 2 +- terraform-aws-ec2-userdata/tfplan | Bin 0 -> 4675 bytes 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 terraform-aws-ec2-userdata/tfplan diff --git a/terraform-aws-ec2-userdata/provider.tf b/terraform-aws-ec2-userdata/provider.tf index b3e50a9..0c58d08 100644 --- a/terraform-aws-ec2-userdata/provider.tf +++ b/terraform-aws-ec2-userdata/provider.tf @@ -2,3 +2,17 @@ provider "aws" { region = "${var.region}" version = "~> 2.0" } + +# data "terraform_remote_state" "network" { +# backend = "s3" +# config = { +# bucket = "aws-terraform-devops-backend" +# key = "network/terraform.tfstate" +# region = "us-east-1" +# } +# } + +terraform { + backend "s3" { + } +} diff --git a/terraform-aws-ec2-userdata/security_group.tf b/terraform-aws-ec2-userdata/security_group.tf index f0d59de..6bbf55a 100644 --- a/terraform-aws-ec2-userdata/security_group.tf +++ b/terraform-aws-ec2-userdata/security_group.tf @@ -1,5 +1,5 @@ resource "aws_security_group" "allow_ssh" { - name = "allow_SSH" + name = "apche-sg" description = "Allow SSH inbound traffic" #vpc_id = aws_vpc.vpc_demo.id diff --git a/terraform-aws-ec2-userdata/tfplan b/terraform-aws-ec2-userdata/tfplan new file mode 100644 index 0000000000000000000000000000000000000000..254616016a6dc86f19f72f7ae8b936cf1a64059a GIT binary patch literal 4675 zcmai1c{tQv8y@Re%bv9ek$uZfDO=VtmZU6W8)Iz4jD0JSeJ7+)*+UpR*+O<9YZ;Pc z&pO%ijrY6WlJ9-{p1FR1oIlPz&$-WYKlgJ$ngoP&0217dEPEVaxvZoi$%FpSgFNb{q30dQ?1pKDYVyY1+x4rceawGzL+}F%@(dE!>)*{ zCg#;u?BYdIcZ~ZnvkS&tzqB}S??z^nI=y{%MA1dL^a=dzD@ij@03t{7p?C;mk$GN` zsn=|NNi|dQ>TcLpA*P17MlFyfSYP=2mA;g!;U#Rm&fr`cR<=-rqKX5nni(}(Yt<3- ziaz)SP!xG3DnEK*CS(rZe=L@}9Qkw!^xvwetj^BFmc5_GR# zPGS@zD+p8D+hi%<6yJUXg(E5h)?b3nEV?WF@N2*<%M?>hM ztyGI!3h;}B8_}AKhP)a?OkcYv{mT#TY{e9BM64KxQQXXmEbsXIDk8e42C2^%I?k+- zDjBNh2h-$(5K=Gjo4IU$m)Xjuq=fl84~5#-++zIbk*?j|?NBUlD+#^8^B8sGGv}bp ze#-vU{WEJv%OORdv;}VBd!t4bGwmBJH6x{Y4JJ@(%^(UuzC2MBp&A`n#KpOF+R)U2 zDf!;pD52sr-1)Y?>$>8?)uF8<&1rg!3lD5oH^`j~347fe=R6*@xL3*C95HooXi``^ ze^;ygJ=w&^*NwwVtVxU)W9(&DGTC-~8-2iT>-FSCywToSYk19LrU9F2DbPG6f1FrQ>wlS5l?LibN5=` zI?y`IaH|ODX;|@GlD0bQ)EZ>uO$iqyX(f*Bd7eo9hN~rUVs=%oPf-4iKpVB@N|YHD z>kivIah%M>>v$J0&f8)TPLrWG=`0H32o0l?5k!ehFSw}~#P2(zOlvh$+x5suG(#xz zBG+9r$AZ*v8HVsuFqLZFtrF#+>>eY^Y-5Whwa#?$27AKkDdLTn;y`GLuTxGf7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d_o z20)+DH1Y810KZ<~Cufo4 z7x?dS>OFpX^T|QscwG4vR5&FgZGRtLPVYWx+Q%pU6|er<{io65G}cMKJGS{>VM%hF z$uF#bGX2wNC;R-dNB#;o+~OqKzdPn>%#$7M*dcyJC)w|q|IaT@BcIgTv7&y3IK}@W z|4)BB4R^9ce}~(o{2lHe<$4 Date: Thu, 23 Jul 2020 23:52:14 +0530 Subject: [PATCH 04/33] cosmetic chnages --- terraform-aws-ec2-userdata/Jenkinsfile | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/terraform-aws-ec2-userdata/Jenkinsfile b/terraform-aws-ec2-userdata/Jenkinsfile index 78cfc14..f08f19c 100644 --- a/terraform-aws-ec2-userdata/Jenkinsfile +++ b/terraform-aws-ec2-userdata/Jenkinsfile @@ -36,17 +36,16 @@ pipeline { -input=false \ -force-copy \ -backend=true \ - -backend-config "bucket='aws-terraform-devops-backend'" \ + -backend-config "bucket=aws-terraform-devops-backend" \ -backend-config "key=terraform/${SERVICE}.tfstate" \ -backend-config "region=us-east-1" \ -backend-config "dynamodb_table=terraform" \ -lock=true - - terraform workspace show | grep -q ${environment} ; if [ $? == 0 ];then echo "workspace already exists";else terraform workspace new ${environment}; fi; - echo "INFO: Terraform -> Working for "${environment name} - terraform plan -input=false -out tfplan ; - terraform show -no-color tfplan > tfplan.txt ''' + sh 'terraform workspace show | grep -q ${environment} ; if [ $? == 0 ];then echo "workspace already exists";else terraform workspace new ${environment}; fi;' + sh 'echo "INFO: Terraform -> Working for "${environment name}'; + sh 'terraform plan -input=false -out tfplan -lock=true' + sh 'terraform show -no-color tfplan > tfplan.txt' } } stage('Approval') { From fe40aa4bd113cbd8dd0b3f06af806392273a5063 Mon Sep 17 00:00:00 2001 From: "Patel, VijayKumar" Date: Fri, 24 Jul 2020 10:32:24 +0530 Subject: [PATCH 05/33] test --- terraform-aws-ec2-userdata/Jenkinsfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/terraform-aws-ec2-userdata/Jenkinsfile b/terraform-aws-ec2-userdata/Jenkinsfile index f08f19c..71aae6f 100644 --- a/terraform-aws-ec2-userdata/Jenkinsfile +++ b/terraform-aws-ec2-userdata/Jenkinsfile @@ -42,10 +42,10 @@ pipeline { -backend-config "dynamodb_table=terraform" \ -lock=true ''' - sh 'terraform workspace show | grep -q ${environment} ; if [ $? == 0 ];then echo "workspace already exists";else terraform workspace new ${environment}; fi;' - sh 'echo "INFO: Terraform -> Working for "${environment name}'; - sh 'terraform plan -input=false -out tfplan -lock=true' - sh 'terraform show -no-color tfplan > tfplan.txt' + // sh 'terraform workspace show | grep -q ${environment} ; if [ $? == 0 ];then echo "workspace already exists";else terraform workspace new ${environment}; fi;' + // sh 'echo "INFO: Terraform -> Working for "${environment name}'; + // sh 'terraform plan -input=false -out tfplan -lock=true' + // sh 'terraform show -no-color tfplan > tfplan.txt' } } stage('Approval') { From b7b32893657773bc73d7cce51936495e1356a37a Mon Sep 17 00:00:00 2001 From: "Patel, VijayKumar" Date: Fri, 24 Jul 2020 11:10:27 +0530 Subject: [PATCH 06/33] updated configuration --- terraform-aws-ec2-userdata/Jenkinsfile | 4 ++-- terraform-aws-ec2-userdata/provider.tf | 4 ++-- terraform-aws-ec2-userdata/tfplan | Bin 4675 -> 0 bytes 3 files changed, 4 insertions(+), 4 deletions(-) delete mode 100644 terraform-aws-ec2-userdata/tfplan diff --git a/terraform-aws-ec2-userdata/Jenkinsfile b/terraform-aws-ec2-userdata/Jenkinsfile index 71aae6f..559844f 100644 --- a/terraform-aws-ec2-userdata/Jenkinsfile +++ b/terraform-aws-ec2-userdata/Jenkinsfile @@ -42,9 +42,9 @@ pipeline { -backend-config "dynamodb_table=terraform" \ -lock=true ''' - // sh 'terraform workspace show | grep -q ${environment} ; if [ $? == 0 ];then echo "workspace already exists";else terraform workspace new ${environment}; fi;' + sh 'cd terraform-aws-ec2-userdata ;terraform workspace show | grep -q ${environment} ; if [ $? == 0 ];then echo "workspace already exists";else terraform workspace new ${environment}; fi;' // sh 'echo "INFO: Terraform -> Working for "${environment name}'; - // sh 'terraform plan -input=false -out tfplan -lock=true' + // sh 'terraform plan -input=false -out tfplan -lock=true' // sh 'terraform show -no-color tfplan > tfplan.txt' } } diff --git a/terraform-aws-ec2-userdata/provider.tf b/terraform-aws-ec2-userdata/provider.tf index 0c58d08..3b88635 100644 --- a/terraform-aws-ec2-userdata/provider.tf +++ b/terraform-aws-ec2-userdata/provider.tf @@ -1,6 +1,6 @@ provider "aws" { - region = "${var.region}" - version = "~> 2.0" + region = var.region + version = ~> 2.0 } # data "terraform_remote_state" "network" { diff --git a/terraform-aws-ec2-userdata/tfplan b/terraform-aws-ec2-userdata/tfplan deleted file mode 100644 index 254616016a6dc86f19f72f7ae8b936cf1a64059a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4675 zcmai1c{tQv8y@Re%bv9ek$uZfDO=VtmZU6W8)Iz4jD0JSeJ7+)*+UpR*+O<9YZ;Pc z&pO%ijrY6WlJ9-{p1FR1oIlPz&$-WYKlgJ$ngoP&0217dEPEVaxvZoi$%FpSgFNb{q30dQ?1pKDYVyY1+x4rceawGzL+}F%@(dE!>)*{ zCg#;u?BYdIcZ~ZnvkS&tzqB}S??z^nI=y{%MA1dL^a=dzD@ij@03t{7p?C;mk$GN` zsn=|NNi|dQ>TcLpA*P17MlFyfSYP=2mA;g!;U#Rm&fr`cR<=-rqKX5nni(}(Yt<3- ziaz)SP!xG3DnEK*CS(rZe=L@}9Qkw!^xvwetj^BFmc5_GR# zPGS@zD+p8D+hi%<6yJUXg(E5h)?b3nEV?WF@N2*<%M?>hM ztyGI!3h;}B8_}AKhP)a?OkcYv{mT#TY{e9BM64KxQQXXmEbsXIDk8e42C2^%I?k+- zDjBNh2h-$(5K=Gjo4IU$m)Xjuq=fl84~5#-++zIbk*?j|?NBUlD+#^8^B8sGGv}bp ze#-vU{WEJv%OORdv;}VBd!t4bGwmBJH6x{Y4JJ@(%^(Uuz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`Fe0U(l4)#Hn5JpsWgnNwiV*saZ80k zlO9>cux9Er4|AQ(yDZDcU*F3y%z?%2Yt;s@W(U&&Lv<|K$Fk+i-JzT&twKr{?k8-| z4F!3AuXas2$dfg>HXW!~e?P9-NS`==NzmY-|Izo<^vW=x;a8XDe$3`B{=3!#L%EyW-ARN_B%&Fhb7E74SbuaAXb6FS#i`3&35x;|wK z{2=;UDgEd^E(GrG-2SMP)A#2NafLxF9cfI*!hh?kan?QSOrB*KSbL|@+3(MN)}nh$wc~4Tx#pdgQQOzlpQXrSyVvh54eSXL zXXq|TD((*QL_StnhHJ8}J;nU&Agb@u#XE7UCx5K#->ucz8g)#Gy_@r|mvK055Xd_o z20)+DH1Y810KZ<~Cufo4 z7x?dS>OFpX^T|QscwG4vR5&FgZGRtLPVYWx+Q%pU6|er<{io65G}cMKJGS{>VM%hF z$uF#bGX2wNC;R-dNB#;o+~OqKzdPn>%#$7M*dcyJC)w|q|IaT@BcIgTv7&y3IK}@W z|4)BB4R^9ce}~(o{2lHe<$4 Date: Fri, 24 Jul 2020 11:12:11 +0530 Subject: [PATCH 07/33] updated configuration --- terraform-aws-ec2-userdata/provider.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terraform-aws-ec2-userdata/provider.tf b/terraform-aws-ec2-userdata/provider.tf index 3b88635..0463061 100644 --- a/terraform-aws-ec2-userdata/provider.tf +++ b/terraform-aws-ec2-userdata/provider.tf @@ -1,6 +1,6 @@ provider "aws" { region = var.region - version = ~> 2.0 + version = "~> 2.0" } # data "terraform_remote_state" "network" { From 832e9a87fb205908fca0e9e773bda4fe8427e711 Mon Sep 17 00:00:00 2001 From: "Patel, VijayKumar" Date: Fri, 24 Jul 2020 11:50:16 +0530 Subject: [PATCH 08/33] updated configuration --- terraform-aws-ec2-userdata/Jenkinsfile | 33 ++++++++++++++------------ 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/terraform-aws-ec2-userdata/Jenkinsfile b/terraform-aws-ec2-userdata/Jenkinsfile index 559844f..3b51304 100644 --- a/terraform-aws-ec2-userdata/Jenkinsfile +++ b/terraform-aws-ec2-userdata/Jenkinsfile @@ -22,7 +22,7 @@ pipeline { stages { stage('checkout') { steps { - git "https://github.com/easyawslearn/Terraform-Tutorial.git" + git branch: "devops1", url: "https://github.com/easyawslearn/Terraform-Tutorial.git" } } @@ -42,27 +42,30 @@ pipeline { -backend-config "dynamodb_table=terraform" \ -lock=true ''' - sh 'cd terraform-aws-ec2-userdata ;terraform workspace show | grep -q ${environment} ; if [ $? == 0 ];then echo "workspace already exists";else terraform workspace new ${environment}; fi;' - // sh 'echo "INFO: Terraform -> Working for "${environment name}'; - // sh 'terraform plan -input=false -out tfplan -lock=true' - // sh 'terraform show -no-color tfplan > tfplan.txt' + sh """#!/bin/bash + cd terraform-aws-ec2-userdata ; terraform workspace show | grep ${environment} ; if [ "\$?" == 0 ];then echo "workspace already exists ";else terraform workspace new ${environment}; fi; + + cd terraform-aws-ec2-userdata ; echo "INFO: Terraform -> Working for ${environment}"; + terraform plan -input=false -out tfplan -lock=true; + terraform show -no-color tfplan > tfplan.txt; + """ } } stage('Approval') { - when { - not { - equals expected: true, actual: params.autoApprove - } - } + when { + not { + equals expected: true, actual: params.autoApprove + } + } - steps { - script { + steps { + script { def plan = readFile 'terraform-aws-ec2-userdata/tfplan.txt' input message: "Do you want to apply the plan?", parameters: [text(name: 'Plan', description: 'Please review the plan', defaultValue: plan)] - } - } - } + } + } + } stage('Apply') { steps { From 4be5cb31559f11260dd82118d3d1f3e008708e16 Mon Sep 17 00:00:00 2001 From: "Patel, VijayKumar" Date: Fri, 24 Jul 2020 12:00:57 +0530 Subject: [PATCH 09/33] updated configuration --- terraform-aws-ec2-userdata/Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/terraform-aws-ec2-userdata/Jenkinsfile b/terraform-aws-ec2-userdata/Jenkinsfile index 3b51304..414b04b 100644 --- a/terraform-aws-ec2-userdata/Jenkinsfile +++ b/terraform-aws-ec2-userdata/Jenkinsfile @@ -37,14 +37,14 @@ pipeline { -force-copy \ -backend=true \ -backend-config "bucket=aws-terraform-devops-backend" \ - -backend-config "key=terraform/${SERVICE}.tfstate" \ + -backend-config "key=terraform/${service}.tfstate" \ -backend-config "region=us-east-1" \ -backend-config "dynamodb_table=terraform" \ -lock=true ''' sh """#!/bin/bash cd terraform-aws-ec2-userdata ; terraform workspace show | grep ${environment} ; if [ "\$?" == 0 ];then echo "workspace already exists ";else terraform workspace new ${environment}; fi; - + cd terraform-aws-ec2-userdata ; echo "INFO: Terraform -> Working for ${environment}"; terraform plan -input=false -out tfplan -lock=true; terraform show -no-color tfplan > tfplan.txt; From ceb390ea03ae358e1236819d5277b034c871a303 Mon Sep 17 00:00:00 2001 From: "Patel, VijayKumar" Date: Fri, 24 Jul 2020 12:08:55 +0530 Subject: [PATCH 10/33] new project added --- Devops-project1/Jenkinsfile | 77 +++++++++++++++++++++++++ Devops-project1/apache_config.sh | 6 ++ Devops-project1/output.tf | 6 ++ Devops-project1/provider.tf | 18 ++++++ Devops-project1/security_group.tf | 28 +++++++++ Devops-project1/user-data-file-input.tf | 17 ++++++ Devops-project1/variables.tf | 20 +++++++ 7 files changed, 172 insertions(+) create mode 100644 Devops-project1/Jenkinsfile create mode 100644 Devops-project1/apache_config.sh create mode 100644 Devops-project1/output.tf create mode 100644 Devops-project1/provider.tf create mode 100644 Devops-project1/security_group.tf create mode 100644 Devops-project1/user-data-file-input.tf create mode 100644 Devops-project1/variables.tf diff --git a/Devops-project1/Jenkinsfile b/Devops-project1/Jenkinsfile new file mode 100644 index 0000000..414b04b --- /dev/null +++ b/Devops-project1/Jenkinsfile @@ -0,0 +1,77 @@ + +pipeline { + + parameters { + string(name: 'environment', defaultValue: 'terraform', description: 'Workspace/environment file to use for deployment') + string(name: 'service', defaultValue: 'apache', description: 'please provide service name') + booleanParam(name: 'autoApprove', defaultValue: false, description: 'Automatically run apply after generating plan?') + + } + + + environment { + AWS_ACCESS_KEY_ID = credentials('AWS_ACCESS_KEY_ID') + AWS_SECRET_ACCESS_KEY = credentials('AWS_SECRET_ACCESS_KEY') + } + + agent any + options { + timestamps () + ansiColor('xterm') + } + stages { + stage('checkout') { + steps { + git branch: "devops1", url: "https://github.com/easyawslearn/Terraform-Tutorial.git" + } + } + + stage('Plan') { + steps { + sh ''' + cd terraform-aws-ec2-userdata ; + terraform init \ + -upgrade=true \ + -get=true \ + -input=false \ + -force-copy \ + -backend=true \ + -backend-config "bucket=aws-terraform-devops-backend" \ + -backend-config "key=terraform/${service}.tfstate" \ + -backend-config "region=us-east-1" \ + -backend-config "dynamodb_table=terraform" \ + -lock=true + ''' + sh """#!/bin/bash + cd terraform-aws-ec2-userdata ; terraform workspace show | grep ${environment} ; if [ "\$?" == 0 ];then echo "workspace already exists ";else terraform workspace new ${environment}; fi; + + cd terraform-aws-ec2-userdata ; echo "INFO: Terraform -> Working for ${environment}"; + terraform plan -input=false -out tfplan -lock=true; + terraform show -no-color tfplan > tfplan.txt; + """ + } + } + stage('Approval') { + when { + not { + equals expected: true, actual: params.autoApprove + } + } + + steps { + script { + def plan = readFile 'terraform-aws-ec2-userdata/tfplan.txt' + input message: "Do you want to apply the plan?", + parameters: [text(name: 'Plan', description: 'Please review the plan', defaultValue: plan)] + } + } + } + + stage('Apply') { + steps { + sh "cd terraform-aws-ec2-userdata ; terraform apply -input=false tfplan" + } + } + } + + } diff --git a/Devops-project1/apache_config.sh b/Devops-project1/apache_config.sh new file mode 100644 index 0000000..b4ca964 --- /dev/null +++ b/Devops-project1/apache_config.sh @@ -0,0 +1,6 @@ +#! /bin/bash +sudo yum update -y +sudo yum install -y httpd.x86_64 +sudo service httpd start +sudo service httpd enable +echo "

Welcome to apche server

" | sudo tee /var/www/html/index.html diff --git a/Devops-project1/output.tf b/Devops-project1/output.tf new file mode 100644 index 0000000..85beb61 --- /dev/null +++ b/Devops-project1/output.tf @@ -0,0 +1,6 @@ +output "public_ip" { + value = "${aws_instance.user_data_example.public_ip}" +} +output "user_data_example_input_file" { + value = "${aws_instance.user_data_example_input_file.public_ip}" +} diff --git a/Devops-project1/provider.tf b/Devops-project1/provider.tf new file mode 100644 index 0000000..0463061 --- /dev/null +++ b/Devops-project1/provider.tf @@ -0,0 +1,18 @@ +provider "aws" { + region = var.region + version = "~> 2.0" +} + +# data "terraform_remote_state" "network" { +# backend = "s3" +# config = { +# bucket = "aws-terraform-devops-backend" +# key = "network/terraform.tfstate" +# region = "us-east-1" +# } +# } + +terraform { + backend "s3" { + } +} diff --git a/Devops-project1/security_group.tf b/Devops-project1/security_group.tf new file mode 100644 index 0000000..6bbf55a --- /dev/null +++ b/Devops-project1/security_group.tf @@ -0,0 +1,28 @@ +resource "aws_security_group" "allow_ssh" { + name = "apche-sg" + description = "Allow SSH inbound traffic" + #vpc_id = aws_vpc.vpc_demo.id + + ingress { + # SSH Port 22 allowed from any IP + from_port = 22 + to_port = 22 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + + ingress { + # SSH Port 80 allowed from any IP + from_port = 80 + to_port = 80 + protocol = "tcp" + cidr_blocks = ["0.0.0.0/0"] + } + + egress { + from_port = 0 + to_port = 0 + protocol = "-1" + cidr_blocks = ["0.0.0.0/0"] + } +} diff --git a/Devops-project1/user-data-file-input.tf b/Devops-project1/user-data-file-input.tf new file mode 100644 index 0000000..501e20a --- /dev/null +++ b/Devops-project1/user-data-file-input.tf @@ -0,0 +1,17 @@ + +resource "aws_instance" "user_data_example_input_file" { + ami = lookup(var.ami_id, var.region) + instance_type = var.instance_type +# subnet_id = aws_subnet.public_1.id + + # Security group assign to instance + vpc_security_group_ids = [aws_security_group.allow_ssh.id] + + # key name + key_name = var.key_name + user_data = "${file("apache_config.sh")}" + + tags = { + Name = "Ec2-User-data-with-file" + } +} diff --git a/Devops-project1/variables.tf b/Devops-project1/variables.tf new file mode 100644 index 0000000..6d51914 --- /dev/null +++ b/Devops-project1/variables.tf @@ -0,0 +1,20 @@ +variable "region" { + type = "string" + default = "us-east-1" +} +variable "ami_id" { + type = "map" + default = { + us-east-1 = "ami-035b3c7efe6d061d5" + eu-west-2 = "ami-132b3c7efe6sdfdsfd" + eu-central-1 = "ami-9787h5h6nsn75gd33" + } +} +variable "instance_type" { + type = "string" + default = "t2.micro" +} +variable "key_name" { + type = "string" + default = "ec2-demo" +} From 4b7c010c5c9194843482ea07d871337666a3cbe4 Mon Sep 17 00:00:00 2001 From: "Patel, VijayKumar" Date: Fri, 24 Jul 2020 12:09:58 +0530 Subject: [PATCH 11/33] new project added --- Devops-project1/Jenkinsfile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Devops-project1/Jenkinsfile b/Devops-project1/Jenkinsfile index 414b04b..7737599 100644 --- a/Devops-project1/Jenkinsfile +++ b/Devops-project1/Jenkinsfile @@ -29,7 +29,7 @@ pipeline { stage('Plan') { steps { sh ''' - cd terraform-aws-ec2-userdata ; + cd Devops-project1 ; terraform init \ -upgrade=true \ -get=true \ @@ -43,9 +43,9 @@ pipeline { -lock=true ''' sh """#!/bin/bash - cd terraform-aws-ec2-userdata ; terraform workspace show | grep ${environment} ; if [ "\$?" == 0 ];then echo "workspace already exists ";else terraform workspace new ${environment}; fi; + cd Devops-project1 ; terraform workspace show | grep ${environment} ; if [ "\$?" == 0 ];then echo "workspace already exists ";else terraform workspace new ${environment}; fi; - cd terraform-aws-ec2-userdata ; echo "INFO: Terraform -> Working for ${environment}"; + cd Devops-project1 ; echo "INFO: Terraform -> Working for ${environment}"; terraform plan -input=false -out tfplan -lock=true; terraform show -no-color tfplan > tfplan.txt; """ @@ -60,7 +60,7 @@ pipeline { steps { script { - def plan = readFile 'terraform-aws-ec2-userdata/tfplan.txt' + def plan = readFile 'Devops-project1/tfplan.txt' input message: "Do you want to apply the plan?", parameters: [text(name: 'Plan', description: 'Please review the plan', defaultValue: plan)] } @@ -69,7 +69,7 @@ pipeline { stage('Apply') { steps { - sh "cd terraform-aws-ec2-userdata ; terraform apply -input=false tfplan" + sh "cd Devops-project1 ; terraform apply -input=false tfplan" } } } From 469c6d30b8a0f581bc141fdf0bdbafecf24c3797 Mon Sep 17 00:00:00 2001 From: "Patel, VijayKumar" Date: Fri, 24 Jul 2020 12:12:20 +0530 Subject: [PATCH 12/33] new project added --- Devops-project1/output.tf | 3 --- 1 file changed, 3 deletions(-) diff --git a/Devops-project1/output.tf b/Devops-project1/output.tf index 85beb61..41f6bbc 100644 --- a/Devops-project1/output.tf +++ b/Devops-project1/output.tf @@ -1,6 +1,3 @@ output "public_ip" { value = "${aws_instance.user_data_example.public_ip}" } -output "user_data_example_input_file" { - value = "${aws_instance.user_data_example_input_file.public_ip}" -} From f808f542c55660a2135ee0ca38f508a922383c49 Mon Sep 17 00:00:00 2001 From: "Patel, VijayKumar" Date: Fri, 24 Jul 2020 12:17:24 +0530 Subject: [PATCH 13/33] new project added --- Devops-project1/output.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Devops-project1/output.tf b/Devops-project1/output.tf index 41f6bbc..38a1773 100644 --- a/Devops-project1/output.tf +++ b/Devops-project1/output.tf @@ -1,3 +1,3 @@ -output "public_ip" { - value = "${aws_instance.user_data_example.public_ip}" +output "user_data_example_input_file" { + value = "${aws_instance.user_data_example_input_file.public_ip}" } From 5a343bed3babe071a683dd25e6fec63e116bfeac Mon Sep 17 00:00:00 2001 From: "Patel, VijayKumar" Date: Fri, 24 Jul 2020 12:55:39 +0530 Subject: [PATCH 14/33] added region variable --- Devops-project1/Jenkinsfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Devops-project1/Jenkinsfile b/Devops-project1/Jenkinsfile index 7737599..1200e01 100644 --- a/Devops-project1/Jenkinsfile +++ b/Devops-project1/Jenkinsfile @@ -3,6 +3,7 @@ pipeline { parameters { string(name: 'environment', defaultValue: 'terraform', description: 'Workspace/environment file to use for deployment') + string(name: 'region', defaultValue: 'us-east-1 ', description: 'select ') string(name: 'service', defaultValue: 'apache', description: 'please provide service name') booleanParam(name: 'autoApprove', defaultValue: false, description: 'Automatically run apply after generating plan?') @@ -37,8 +38,8 @@ pipeline { -force-copy \ -backend=true \ -backend-config "bucket=aws-terraform-devops-backend" \ - -backend-config "key=terraform/${service}.tfstate" \ - -backend-config "region=us-east-1" \ + -backend-config "key=terraform-${region}/${service}.tfstate" \ + -backend-config "region=${region}" \ -backend-config "dynamodb_table=terraform" \ -lock=true ''' @@ -46,7 +47,7 @@ pipeline { cd Devops-project1 ; terraform workspace show | grep ${environment} ; if [ "\$?" == 0 ];then echo "workspace already exists ";else terraform workspace new ${environment}; fi; cd Devops-project1 ; echo "INFO: Terraform -> Working for ${environment}"; - terraform plan -input=false -out tfplan -lock=true; + terraform plan -input=false -var region= ${region} -out tfplan -lock=true; terraform show -no-color tfplan > tfplan.txt; """ } From ef8d42386794166082e1f2e060c22e5952dd30df Mon Sep 17 00:00:00 2001 From: "Patel, VijayKumar" Date: Fri, 24 Jul 2020 12:58:47 +0530 Subject: [PATCH 15/33] added region variable --- Devops-project1/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Devops-project1/Jenkinsfile b/Devops-project1/Jenkinsfile index 1200e01..8b72ea6 100644 --- a/Devops-project1/Jenkinsfile +++ b/Devops-project1/Jenkinsfile @@ -3,7 +3,7 @@ pipeline { parameters { string(name: 'environment', defaultValue: 'terraform', description: 'Workspace/environment file to use for deployment') - string(name: 'region', defaultValue: 'us-east-1 ', description: 'select ') + string(name: 'region', defaultValue: 'us-east-1', description: 'select region to deployment') string(name: 'service', defaultValue: 'apache', description: 'please provide service name') booleanParam(name: 'autoApprove', defaultValue: false, description: 'Automatically run apply after generating plan?') From fe0965f3cb26677119026dd58ffdfbbb53aabaf1 Mon Sep 17 00:00:00 2001 From: "Patel, VijayKumar" Date: Fri, 24 Jul 2020 13:00:53 +0530 Subject: [PATCH 16/33] added region variable --- Devops-project1/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Devops-project1/Jenkinsfile b/Devops-project1/Jenkinsfile index 8b72ea6..e99b268 100644 --- a/Devops-project1/Jenkinsfile +++ b/Devops-project1/Jenkinsfile @@ -47,7 +47,7 @@ pipeline { cd Devops-project1 ; terraform workspace show | grep ${environment} ; if [ "\$?" == 0 ];then echo "workspace already exists ";else terraform workspace new ${environment}; fi; cd Devops-project1 ; echo "INFO: Terraform -> Working for ${environment}"; - terraform plan -input=false -var region= ${region} -out tfplan -lock=true; + terraform plan -var region= ${region} -out tfplan -lock=true; terraform show -no-color tfplan > tfplan.txt; """ } From a32a37ab98c290355b6650c952bc4500912df5a4 Mon Sep 17 00:00:00 2001 From: "Patel, VijayKumar" Date: Fri, 24 Jul 2020 13:03:14 +0530 Subject: [PATCH 17/33] added region variable --- Devops-project1/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Devops-project1/Jenkinsfile b/Devops-project1/Jenkinsfile index e99b268..05eede3 100644 --- a/Devops-project1/Jenkinsfile +++ b/Devops-project1/Jenkinsfile @@ -34,7 +34,7 @@ pipeline { terraform init \ -upgrade=true \ -get=true \ - -input=false \ + -input=true \ -force-copy \ -backend=true \ -backend-config "bucket=aws-terraform-devops-backend" \ From 8ef55ca2adf1d47a0e7fa1d02c71c916daf1b41e Mon Sep 17 00:00:00 2001 From: "Patel, VijayKumar" Date: Fri, 24 Jul 2020 13:24:45 +0530 Subject: [PATCH 18/33] added region variable --- Devops-project1/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Devops-project1/Jenkinsfile b/Devops-project1/Jenkinsfile index 05eede3..50b8693 100644 --- a/Devops-project1/Jenkinsfile +++ b/Devops-project1/Jenkinsfile @@ -46,7 +46,7 @@ pipeline { sh """#!/bin/bash cd Devops-project1 ; terraform workspace show | grep ${environment} ; if [ "\$?" == 0 ];then echo "workspace already exists ";else terraform workspace new ${environment}; fi; - cd Devops-project1 ; echo "INFO: Terraform -> Working for ${environment}"; + echo "INFO: Terraform -> Working for ${environment}"; terraform plan -var region= ${region} -out tfplan -lock=true; terraform show -no-color tfplan > tfplan.txt; """ From 72896407ed69c189fba8280e65d2bca19fa87b34 Mon Sep 17 00:00:00 2001 From: "Patel, VijayKumar" Date: Fri, 24 Jul 2020 13:27:31 +0530 Subject: [PATCH 19/33] added region variable --- Devops-project1/Jenkinsfile | 2 +- Devops-project1/tfplan | Bin 0 -> 4015 bytes 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 Devops-project1/tfplan diff --git a/Devops-project1/Jenkinsfile b/Devops-project1/Jenkinsfile index 50b8693..cbc165a 100644 --- a/Devops-project1/Jenkinsfile +++ b/Devops-project1/Jenkinsfile @@ -47,7 +47,7 @@ pipeline { cd Devops-project1 ; terraform workspace show | grep ${environment} ; if [ "\$?" == 0 ];then echo "workspace already exists ";else terraform workspace new ${environment}; fi; echo "INFO: Terraform -> Working for ${environment}"; - terraform plan -var region= ${region} -out tfplan -lock=true; + terraform plan -var region=${region} -out tfplan -lock=true; terraform show -no-color tfplan > tfplan.txt; """ } diff --git a/Devops-project1/tfplan b/Devops-project1/tfplan new file mode 100644 index 0000000000000000000000000000000000000000..80ea830ff8a9176e9b06dde8de9f9f6c977f5500 GIT binary patch literal 4015 zcmai1c|4SB8y;qiH9}D#A;~((Qj$G1!Zd?KcEikA#u>vfBsBIVvSeQ(Yh;%rXZS)# zL-y)8*$QQyC|j2K#`%7yJLS;=zIGhO6 zBb~2;l~oci*<2-Vmt!C=VM>6ufJsi*_ew%^W z8#od^YkTu+qoOZD2`CiFC-NP?Tq zZz_vJkDISbyE&zCUm4_b2(AZmmX>K;zu;qgM3xR$QMQ;$fFL$LQ+pY*w^WjJj7M zS*^0$IXF@hHDN!8$B=hs=0>2atHUqc%E^Be>7OKyW!*vQqmDp#m*bL%3ZgVRr$=e#X%(M+0A&3@OP#-96W2lCbn@zh8;Mx?5sDL@q28hG7U{22VxYHO=rTu7P>gHiHnK^`qX zJaG2+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BJkN*Ny2(;(Ls=G7Hic0u!h<&%LWTV>fN|(F^F7v?Jo=yV|g-B0@RZ5M^!4dcgJ@_ynh)^>%Kd z6Zo#&Vzf$c1X^M>u71JlB^}cLNF2BN0=+?BdHob5{{fI*IIJ()8Hw8uQ$3+4{*F8c ziE8-t+3%Mkb}rUFhWodfv80&A3)ERv_u7V$rg*wO`>U_%-pVq#b{HG->9tDm3y(GF zfqCv5%{L9X0ZDH1Dk6PS4gNOqlKcQo zb(xy@F3G@am4|||X9T_`U3uee+0N5p?KM0a$Fn2$Wbh*OxCz@ z5y29I-M6ydF%IH(;7nXUvXS zTx@zxxO>;5FsDDXuejtvM~;nJd3Y%oBgxZRt@Icd<5)CP@aycb`9FgD7`S|o3M9I9 z>O1q_6U%ku+LT=Iy*sg;L&Tn{u5^pg_4DT_$x2t7o_rpREb8<%Q$xt$UT%ha#J0b#}lz$hx52k+Nvd1ASqZU>fsYo}+^r639Hc zlpkhnzn=5nc3rU>eT+0$5`}UUpm<6o2d%fw=H_d35qmYe9#@K%_x39uQuhjA!;lzqS}k(@b^U>Uq!*@|no7dj(^kWGoI4 fkJr-4u|M5El_kuGiGJ~bzeaOgy2xHUw72>%aX@J& literal 0 HcmV?d00001 From 8727318445a7330f03ddf71ed06d35e9846114c9 Mon Sep 17 00:00:00 2001 From: "Patel, VijayKumar" Date: Fri, 24 Jul 2020 14:27:07 +0530 Subject: [PATCH 20/33] added region variable --- Devops-project1/variables.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Devops-project1/variables.tf b/Devops-project1/variables.tf index 6d51914..246c6d7 100644 --- a/Devops-project1/variables.tf +++ b/Devops-project1/variables.tf @@ -1,6 +1,6 @@ variable "region" { type = "string" - default = "us-east-1" + default = "us-east-2" } variable "ami_id" { type = "map" From 20f71c461a25e32a83a3e9e9955e57793dd670c6 Mon Sep 17 00:00:00 2001 From: "Patel, VijayKumar" Date: Fri, 24 Jul 2020 14:34:16 +0530 Subject: [PATCH 21/33] added region variable --- Devops-project1/Jenkinsfile | 3 ++- Devops-project1/user-data-file-input.tf | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Devops-project1/Jenkinsfile b/Devops-project1/Jenkinsfile index cbc165a..bd05dc7 100644 --- a/Devops-project1/Jenkinsfile +++ b/Devops-project1/Jenkinsfile @@ -4,6 +4,7 @@ pipeline { parameters { string(name: 'environment', defaultValue: 'terraform', description: 'Workspace/environment file to use for deployment') string(name: 'region', defaultValue: 'us-east-1', description: 'select region to deployment') + string(name: 'env', defaultValue: 'prod', description: 'select environment to deployment') string(name: 'service', defaultValue: 'apache', description: 'please provide service name') booleanParam(name: 'autoApprove', defaultValue: false, description: 'Automatically run apply after generating plan?') @@ -44,7 +45,7 @@ pipeline { -lock=true ''' sh """#!/bin/bash - cd Devops-project1 ; terraform workspace show | grep ${environment} ; if [ "\$?" == 0 ];then echo "workspace already exists ";else terraform workspace new ${environment}; fi; + cd Devops-project1 ; terraform workspace show | grep ${environment} ; if [ "\$?" == 0 ];then echo "workspace already exists ";else terraform workspace new ${environment}; fi; echo "INFO: Terraform -> Working for ${environment}"; terraform plan -var region=${region} -out tfplan -lock=true; diff --git a/Devops-project1/user-data-file-input.tf b/Devops-project1/user-data-file-input.tf index 501e20a..cae6797 100644 --- a/Devops-project1/user-data-file-input.tf +++ b/Devops-project1/user-data-file-input.tf @@ -12,6 +12,6 @@ resource "aws_instance" "user_data_example_input_file" { user_data = "${file("apache_config.sh")}" tags = { - Name = "Ec2-User-data-with-file" + Name = "Apache" } } From 8cf0040066bbe13c77639315b35ccb70e4ca1c49 Mon Sep 17 00:00:00 2001 From: "Patel, VijayKumar" Date: Fri, 24 Jul 2020 14:43:57 +0530 Subject: [PATCH 22/33] added region variable --- Devops-project1/user-data-file-input.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Devops-project1/user-data-file-input.tf b/Devops-project1/user-data-file-input.tf index cae6797..d4f9e29 100644 --- a/Devops-project1/user-data-file-input.tf +++ b/Devops-project1/user-data-file-input.tf @@ -12,6 +12,6 @@ resource "aws_instance" "user_data_example_input_file" { user_data = "${file("apache_config.sh")}" tags = { - Name = "Apache" + Name = "Apache-Server" } } From 950870f12a5fddcb6d091f3e727d82412a34e2bb Mon Sep 17 00:00:00 2001 From: "Patel, VijayKumar" Date: Fri, 24 Jul 2020 14:48:52 +0530 Subject: [PATCH 23/33] removed tf plan as its not require --- Devops-project1/tfplan | Bin 4015 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 Devops-project1/tfplan diff --git a/Devops-project1/tfplan b/Devops-project1/tfplan deleted file mode 100644 index 80ea830ff8a9176e9b06dde8de9f9f6c977f5500..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4015 zcmai1c|4SB8y;qiH9}D#A;~((Qj$G1!Zd?KcEikA#u>vfBsBIVvSeQ(Yh;%rXZS)# zL-y)8*$QQyC|j2K#`%7yJLS;=zIGhO6 zBb~2;l~oci*<2-Vmt!C=VM>6ufJsi*_ew%^W z8#od^YkTu+qoOZD2`CiFC-NP?Tq zZz_vJkDISbyE&zCUm4_b2(AZmmX>K;zu;qgM3xR$QMQ;$fFL$LQ+pY*w^WjJj7M zS*^0$IXF@hHDN!8$B=hs=0>2atHUqc%E^Be>7OKyW!*vQqmDp#m*bL%3ZgVRr$=e#X%(M+0A&3@OP#-96W2lCbn@zh8;Mx?5sDL@q28hG7U{22VxYHO=rTu7P>gHiHnK^`qX zJaG2+ndY-_*zu9=8NJ$-b^@(w<(}#3tE}$%`R$#etE#pu6v+}o#G(rgUi{}{VdOk^ zLz_bW2vI{|8?8rotNhV@7g@E7OdW}%7LDgnDqF4!*X6$UaTa*>p~0|v$+0`feZxi|{BSTN8$MV2p~hHdfze* z$P=Q{-ODU4+<_7n9SgtKfsF4@@pvQ`C_wJ7wLoNrblC9SUXJfMnlhj~I#(rh(zn-m zkcp0oA0=(<*fv`n@AJjVu{PftV2hs}6|1*7Nm2C~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3G@am4|||X9T_`U3uee+0N5p?KM0a$Fn2$Wbh*OxCz@ z5y29I-M6ydF%IH(;7nXUvXS zTx@zxxO>;5FsDDXuejtvM~;nJd3Y%oBgxZRt@Icd<5)CP@aycb`9FgD7`S|o3M9I9 z>O1q_6U%ku+LT=Iy*sg;L&Tn{u5^pg_4DT_$x2t7o_rpREb8<%Q$xt$UT%ha#J0b#}lz$hx52k+Nvd1ASqZU>fsYo}+^r639Hc zlpkhnzn=5nc3rU>eT+0$5`}UUpm<6o2d%fw=H_d35qmYe9#@K%_x39uQuhjA!;lzqS}k(@b^U>Uq!*@|no7dj(^kWGoI4 fkJr-4u|M5El_kuGiGJ~bzeaOgy2xHUw72>%aX@J& From 6a0eb41e91c71869b28a2d792fe25ea649593975 Mon Sep 17 00:00:00 2001 From: "Patel, VijayKumar" Date: Fri, 24 Jul 2020 16:53:26 +0530 Subject: [PATCH 24/33] added destroy --- Devops-project1/Jenkinsfile | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Devops-project1/Jenkinsfile b/Devops-project1/Jenkinsfile index bd05dc7..7e4d76c 100644 --- a/Devops-project1/Jenkinsfile +++ b/Devops-project1/Jenkinsfile @@ -74,6 +74,25 @@ pipeline { sh "cd Devops-project1 ; terraform apply -input=false tfplan" } } + stage('Approval-Destroy') { + when { + not { + equals expected: true, actual: params.autoApprove + } + } + steps { + script { + def plan = readFile 'Devops-project1/tfplan.txt' + input message: "Do you want to apply the plan?", + parameters: [text(name: 'Plan', description: 'Please review the plan', defaultValue: plan)] + } + } + } + stage('Destroy') { + steps { + sh "cd Devops-project1 ; terraform destroy -input=false tfplan" + } + } } } From 8fe89800ee86f70674ed72e183ca70d96bff2748 Mon Sep 17 00:00:00 2001 From: "Patel, VijayKumar" Date: Fri, 24 Jul 2020 17:01:46 +0530 Subject: [PATCH 25/33] added destroy --- Devops-project1/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Devops-project1/Jenkinsfile b/Devops-project1/Jenkinsfile index 7e4d76c..076c555 100644 --- a/Devops-project1/Jenkinsfile +++ b/Devops-project1/Jenkinsfile @@ -90,7 +90,7 @@ pipeline { } stage('Destroy') { steps { - sh "cd Devops-project1 ; terraform destroy -input=false tfplan" + sh "cd Devops-project1 ; terraform plan -destroy -auto-approve " } } } From 93b6c013481cee79c3fb2151d0e5242751fa89d7 Mon Sep 17 00:00:00 2001 From: "Patel, VijayKumar" Date: Fri, 24 Jul 2020 17:06:36 +0530 Subject: [PATCH 26/33] added destroy --- Devops-project1/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Devops-project1/Jenkinsfile b/Devops-project1/Jenkinsfile index 076c555..fcb0233 100644 --- a/Devops-project1/Jenkinsfile +++ b/Devops-project1/Jenkinsfile @@ -90,7 +90,7 @@ pipeline { } stage('Destroy') { steps { - sh "cd Devops-project1 ; terraform plan -destroy -auto-approve " + sh "cd Devops-project1 ; terraform plan -destroy " } } } From 3f27043c68bc19099381ba091e6430951b50861b Mon Sep 17 00:00:00 2001 From: "Patel, VijayKumar" Date: Fri, 24 Jul 2020 17:18:30 +0530 Subject: [PATCH 27/33] added destroy --- Devops-project1/Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Devops-project1/Jenkinsfile b/Devops-project1/Jenkinsfile index fcb0233..6ece878 100644 --- a/Devops-project1/Jenkinsfile +++ b/Devops-project1/Jenkinsfile @@ -71,7 +71,7 @@ pipeline { stage('Apply') { steps { - sh "cd Devops-project1 ; terraform apply -input=false tfplan" + sh "cd Devops-project1 ; terraform apply -input=false tfplan -state-out=test" } } stage('Approval-Destroy') { @@ -90,7 +90,7 @@ pipeline { } stage('Destroy') { steps { - sh "cd Devops-project1 ; terraform plan -destroy " + sh "cd Devops-project1 ; terraform destroy -state=test" } } } From b4c63ef6a3790c13a64630dac2ae0c5fdd440ea1 Mon Sep 17 00:00:00 2001 From: "Patel, VijayKumar" Date: Fri, 24 Jul 2020 17:31:34 +0530 Subject: [PATCH 28/33] added destroy --- Devops-project1/Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Devops-project1/Jenkinsfile b/Devops-project1/Jenkinsfile index 6ece878..4c33eef 100644 --- a/Devops-project1/Jenkinsfile +++ b/Devops-project1/Jenkinsfile @@ -71,7 +71,7 @@ pipeline { stage('Apply') { steps { - sh "cd Devops-project1 ; terraform apply -input=false tfplan -state-out=test" + sh "cd Devops-project1 ; terraform apply -input=false tfplan " } } stage('Approval-Destroy') { @@ -90,7 +90,7 @@ pipeline { } stage('Destroy') { steps { - sh "cd Devops-project1 ; terraform destroy -state=test" + sh "cd Devops-project1 ; terraform destroy" } } } From 30b70c1a4e4cc21ade23d31273b2fd391547c0ba Mon Sep 17 00:00:00 2001 From: "Patel, VijayKumar" Date: Fri, 24 Jul 2020 17:36:07 +0530 Subject: [PATCH 29/33] added destroy --- Devops-project1/Jenkinsfile | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/Devops-project1/Jenkinsfile b/Devops-project1/Jenkinsfile index 4c33eef..17e1aeb 100644 --- a/Devops-project1/Jenkinsfile +++ b/Devops-project1/Jenkinsfile @@ -74,25 +74,7 @@ pipeline { sh "cd Devops-project1 ; terraform apply -input=false tfplan " } } - stage('Approval-Destroy') { - when { - not { - equals expected: true, actual: params.autoApprove - } - } - steps { - script { - def plan = readFile 'Devops-project1/tfplan.txt' - input message: "Do you want to apply the plan?", - parameters: [text(name: 'Plan', description: 'Please review the plan', defaultValue: plan)] - } - } - } - stage('Destroy') { - steps { - sh "cd Devops-project1 ; terraform destroy" - } - } + } } From 60c220ea6d454d205cd76a1a4be61dc35d265364 Mon Sep 17 00:00:00 2001 From: Vijay Patel <35554905+easyawslearn@users.noreply.github.com> Date: Fri, 24 Jul 2020 18:04:56 +0530 Subject: [PATCH 30/33] Update user-data-file-input.tf --- Devops-project1/user-data-file-input.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Devops-project1/user-data-file-input.tf b/Devops-project1/user-data-file-input.tf index d4f9e29..ac7cbce 100644 --- a/Devops-project1/user-data-file-input.tf +++ b/Devops-project1/user-data-file-input.tf @@ -12,6 +12,6 @@ resource "aws_instance" "user_data_example_input_file" { user_data = "${file("apache_config.sh")}" tags = { - Name = "Apache-Server" + Name = "Apache-Server1" } } From 8305750f48e5982e93c8f1ccee0708a551a7786e Mon Sep 17 00:00:00 2001 From: Kerem-Tokgoz <66677679+Kerem-Tokgoz@users.noreply.github.com> Date: Mon, 15 Mar 2021 17:57:51 +0100 Subject: [PATCH 31/33] Update Jenkinsfile --- Devops-project1/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Devops-project1/Jenkinsfile b/Devops-project1/Jenkinsfile index 17e1aeb..9367688 100644 --- a/Devops-project1/Jenkinsfile +++ b/Devops-project1/Jenkinsfile @@ -38,7 +38,7 @@ pipeline { -input=true \ -force-copy \ -backend=true \ - -backend-config "bucket=aws-terraform-devops-backend" \ + -backend-config "bucket=aws-terraform-devops-backend-kerem" \ -backend-config "key=terraform-${region}/${service}.tfstate" \ -backend-config "region=${region}" \ -backend-config "dynamodb_table=terraform" \ From 8c52d70ae3853b7c0cc68c17963c1fe0278c880d Mon Sep 17 00:00:00 2001 From: Kerem-Tokgoz <66677679+Kerem-Tokgoz@users.noreply.github.com> Date: Mon, 15 Mar 2021 18:07:36 +0100 Subject: [PATCH 32/33] Update Jenkinsfile --- Devops-project1/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Devops-project1/Jenkinsfile b/Devops-project1/Jenkinsfile index 9367688..7ee9cc9 100644 --- a/Devops-project1/Jenkinsfile +++ b/Devops-project1/Jenkinsfile @@ -24,7 +24,7 @@ pipeline { stages { stage('checkout') { steps { - git branch: "devops1", url: "https://github.com/easyawslearn/Terraform-Tutorial.git" + git branch: "devops1", url: "https://github.com/Kerem-Tokgoz/Terraform-Tutorial.git" } } From 32bd00d6e1277d92a0f3d020a7952e571af87811 Mon Sep 17 00:00:00 2001 From: Kerem-Tokgoz <66677679+Kerem-Tokgoz@users.noreply.github.com> Date: Mon, 15 Mar 2021 18:14:11 +0100 Subject: [PATCH 33/33] Update Jenkinsfile --- Devops-project1/Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Devops-project1/Jenkinsfile b/Devops-project1/Jenkinsfile index 7ee9cc9..763a76c 100644 --- a/Devops-project1/Jenkinsfile +++ b/Devops-project1/Jenkinsfile @@ -32,7 +32,7 @@ pipeline { steps { sh ''' cd Devops-project1 ; - terraform init \ + TF_LOG=DEBUG terraform init \ -upgrade=true \ -get=true \ -input=true \