File tree Expand file tree Collapse file tree 10 files changed +261
-0
lines changed
HelloWorldClient/terraform Expand file tree Collapse file tree 10 files changed +261
-0
lines changed Original file line number Diff line number Diff line change 5959 docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
6060 docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
6161 echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
62+ terraform :
63+ needs : build
64+ name : Terraform Deployment
65+ runs-on : [ ubuntu-latest ]
66+ defaults :
67+ run :
68+ working-directory : ./microservices/HelloWorldClient/terraform
69+ strategy :
70+ max-parallel : 1
71+ env :
72+ aws_secret_access_key : ${{ secrets.AWS_ACCESS_KEY_ID }}
73+ aws_access_key : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
74+ steps :
75+ - uses : actions/checkout@v3
76+ - name : Configure AWS credentials
77+ uses : aws-actions/configure-aws-credentials@v1
78+ with :
79+ aws-access-key-id : ${{ secrets.AWS_ACCESS_KEY_ID }}
80+ aws-secret-access-key : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
81+ aws-region : us-east-1
82+ - uses : hashicorp/setup-terraform@v1
83+ with :
84+ terraform_wrapper : false
85+ - name : Terraform Init
86+ id : init
87+ run : |
88+ rm -rf .terraform
89+ terraform init
90+ - name : Terraform Plan
91+ id : plan
92+ run : |
93+ terraform plan
94+ - name : Terraform apply
95+ if : github.ref == 'refs/heads/main'
96+ id : apply
97+ run : |
98+ terraform apply --auto-approve=true
99+
62100
63101
64102
Original file line number Diff line number Diff line change 5959 docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
6060 docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
6161 echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
62+ terraform :
63+ needs : build
64+ name : Terraform Deployment
65+ runs-on : [ ubuntu-latest ]
66+ defaults :
67+ run :
68+ working-directory : ./microservices/WorldService/terraform
69+ strategy :
70+ max-parallel : 1
71+ env :
72+ aws_secret_access_key : ${{ secrets.AWS_ACCESS_KEY_ID }}
73+ aws_access_key : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
74+ steps :
75+ - uses : actions/checkout@v3
76+ - name : Configure AWS credentials
77+ uses : aws-actions/configure-aws-credentials@v1
78+ with :
79+ aws-access-key-id : ${{ secrets.AWS_ACCESS_KEY_ID }}
80+ aws-secret-access-key : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
81+ aws-region : us-east-1
82+ - uses : hashicorp/setup-terraform@v1
83+ with :
84+ terraform_wrapper : false
85+ - name : Terraform Init
86+ id : init
87+ run : |
88+ rm -rf .terraform
89+ terraform init
90+ - name : Terraform Plan
91+ id : plan
92+ run : |
93+ terraform plan
94+ - name : Terraform apply
95+ if : github.ref == 'refs/heads/main'
96+ id : apply
97+ run : |
98+ terraform apply --auto-approve=true
99+
62100
63101
64102
Original file line number Diff line number Diff line change 1+ data "aws_eks_cluster" "cluster" {
2+ name = " eks-1" # Change this to your EKS cluster name
3+ }
4+
5+ data "aws_eks_cluster_auth" "cluster" {
6+ name = data. aws_eks_cluster . cluster . name
7+ }
Original file line number Diff line number Diff line change 1+ resource "helm_release" "myapp" {
2+ name = " client-svc"
3+ repository = " https://devops4solutions.github.io/springboot-helm-chart/" # Using the published Helm repo
4+ chart = " springboot"
5+ namespace = " app1" # Change as per your setup
6+ version = " 0.1.5" # Use the correct version from index.yaml
7+ create_namespace = " true"
8+ values = [
9+ file (" ${ path . module } /values_client.yaml" ) # Optional: Use custom values file
10+ ]
11+ }
Original file line number Diff line number Diff line change 1+ provider "aws" {
2+ region = " us-east-1"
3+
4+ }
5+
6+ provider "helm" {
7+ kubernetes {
8+ host = data. aws_eks_cluster . cluster . endpoint
9+ token = data. aws_eks_cluster_auth . cluster . token
10+ cluster_ca_certificate = base64decode (data. aws_eks_cluster . cluster . certificate_authority [0 ]. data )
11+ }
12+ }
13+
14+
15+
16+ terraform {
17+ required_providers {
18+ helm = {
19+ source = " hashicorp/helm"
20+ version = " 2.17.0"
21+ }
22+ kubectl = {
23+ source = " bnu0/kubectl"
24+ version = " 0.27.0"
25+ }
26+ }
27+
28+ backend "s3" {
29+ region = " us-east-1"
30+ bucket = " devops4solutions-terraform"
31+ key = " eks/clientservice.tfstate"
32+ }
33+ }
Original file line number Diff line number Diff line change 1+ replicaCount : 1
2+ image :
3+ repository : public.ecr.aws/w0f5g4k6/client-svc
4+ pullPolicy : IfNotPresent
5+ tag : " "
6+ service :
7+ type : ClusterIP
8+ name : client
9+ port : 80
10+ ingress :
11+ enabled : true
12+ className : " alb"
13+ annotations :
14+ alb.ingress.kubernetes.io/scheme : internet-facing
15+ alb.ingress.kubernetes.io/target-type : ip
16+ alb.ingress.kubernetes.io/healthcheck-path : /
17+ alb.ingress.kubernetes.io/group.name : myapp
18+ hosts :
19+ - host : client.com
20+ paths :
21+ - path : /
22+ pathType : Prefix # - secretName: chart-example-tls
23+ livenessProbe :
24+ httpGet :
25+ path : /
26+ port : http
27+ readinessProbe :
28+ httpGet :
29+ path : /
30+ port : http
31+ env :
32+ HELLO_SERVICE_URL : " http://hello.default.svc.cluster.local"
33+ WORLD_SERVICE_URL : " http://world.default.svc.cluster.local"
34+ serviceAccount :
35+ create : true
36+ automount : true
37+ annotations : {}
38+ name : " "
39+ autoscaling :
40+ enabled : false
41+ minReplicas : 1
42+ maxReplicas : 100
43+ targetCPUUtilizationPercentage : 80
Original file line number Diff line number Diff line change 1+ data "aws_eks_cluster" "cluster" {
2+ name = " eks-1" # Change this to your EKS cluster name
3+ }
4+
5+ data "aws_eks_cluster_auth" "cluster" {
6+ name = data. aws_eks_cluster . cluster . name
7+ }
Original file line number Diff line number Diff line change 1+ resource "helm_release" "myapp" {
2+ name = " world-svc"
3+ repository = " https://devops4solutions.github.io/springboot-helm-chart/" # Using the published Helm repo
4+ chart = " springboot"
5+ namespace = " app1" # Change as per your setup
6+ version = " 0.1.5" # Use the correct version from index.yaml
7+ create_namespace = " true"
8+ values = [
9+ file (" ${ path . module } /values_world.yaml" ) # Optional: Use custom values file
10+ ]
11+ }
Original file line number Diff line number Diff line change 1+ provider "aws" {
2+ region = " us-east-1"
3+
4+ }
5+
6+ provider "helm" {
7+ kubernetes {
8+ host = data. aws_eks_cluster . cluster . endpoint
9+ token = data. aws_eks_cluster_auth . cluster . token
10+ cluster_ca_certificate = base64decode (data. aws_eks_cluster . cluster . certificate_authority [0 ]. data )
11+ }
12+ }
13+
14+
15+
16+ terraform {
17+ required_providers {
18+ helm = {
19+ source = " hashicorp/helm"
20+ version = " 2.17.0"
21+ }
22+ kubectl = {
23+ source = " bnu0/kubectl"
24+ version = " 0.27.0"
25+ }
26+ }
27+
28+ backend "s3" {
29+ region = " us-east-1"
30+ bucket = " devops4solutions-terraform"
31+ key = " eks/worldservice.tfstate"
32+ }
33+ }
Original file line number Diff line number Diff line change 1+ replicaCount : 1
2+ image :
3+ repository : public.ecr.aws/w0f5g4k6/world-svc
4+ pullPolicy : IfNotPresent
5+ service :
6+ type : ClusterIP
7+ port : 80
8+ name : world
9+ ingress :
10+ enabled : true
11+ className : " alb"
12+ annotations :
13+ alb.ingress.kubernetes.io/scheme : internet-facing
14+ alb.ingress.kubernetes.io/target-type : ip
15+ alb.ingress.kubernetes.io/healthcheck-path : /world
16+ alb.ingress.kubernetes.io/group.name : myapp
17+ hosts :
18+ - host : world.com
19+ paths :
20+ - path : /world
21+ pathType : Prefix
22+ livenessProbe :
23+ httpGet :
24+ path : /world
25+ port : http
26+ readinessProbe :
27+ httpGet :
28+ path : /world
29+ port : http
30+ serviceAccount :
31+ create : true
32+ automount : true
33+ annotations : {}
34+ name : " "
35+ autoscaling :
36+ enabled : false
37+ minReplicas : 1
38+ maxReplicas : 100
39+ targetCPUUtilizationPercentage : 80
40+
You can’t perform that action at this time.
0 commit comments