Skip to content

Sample Repository for Creating a Kubernetes Cluster and replicating the infrastructure by a thin Terraform wrapper, i.e. Terragrunt Open Source Framework using Multi Branch Gitops approach

License

Notifications You must be signed in to change notification settings

leiarenee/k8s-tg-gitops

Repository files navigation

K8s-TG-Gitops

Sample Repository for Creating a Kubernetes Cluster over a private VPC and replicating the infrastructure using Multi Branch Gitops approach by Terragrunt & Terraform.

Documentation

Pre-Requisites

  • Terraform > v1.0
  • Terragrunt > v31.0
  • AWS Client > v2.0
  • Jq
  • timeout

Install

brew install terraform terragrunt awscli jq coreutils

Running

You should have an empty sub organizational account with a Route53 hosted zone created to test this code. Duplicate the sample_override.hcl file and rename it as .override.hcl Enter the parameters in override.hcl file.

Run:

./deploy.sh
Output
direnv: loading ~/Dev/Leia/k8s-tg-gitops/.envrc                                                                                                         
direnv: export +AWS_BATCH_ID +AWS_PAGER
leia@Leias-MBP k8s-tg-gitops % ./deploy.sh
/Users/leia/Dev/Leia/k8s-tg-gitops/aws/live
0ba60e3c3736ae1567b44d866fb2a51db9dd8142
Platform: darwin
Running 'apply' command in Environment:

testing
{
  "account_name": "testing",
  "aws_account_id": "57878****1",
  "aws_profile": "leia-testing", (Section title in your `./aws/credentials` file)
  "bucket_suffix": "",
  "parameters": { 
    "CERTIFICATE": "arn:aws:acm:eu-west-1:***68852***2943:certificate/43***1ea9***58-254b-4f8c-995f-a31**1559f**cce5", (Not compulsory)
    "CLUSTER": "my-testing-k8s", (required)
    "DNS_ZONE_ID": "Z0892705215W14M9I9W9N", 
    "DOMAIN": "test.leiarenee.io"
  }
}

AWS Caller Identity
arn:aws:iam::553**52****2943:user/cicd
AIDAY****B27X7****24ZTQXZ

Do you confirm? (y/n)
y

Enter y

Output

Enter y again

Process 89238 Confirmed.
Processing aws/live/api/cluster
Parent PID:89238, Current PID:89264
Processing aws/live/api/deploymets/api/flask
Parent PID:89238, Current PID:89267
Processing aws/live/api/deploymets/services/api/flask/external
Parent PID:89238, Current PID:89272
Processing aws/live/api/deploymets/services/api/flask/internal
Parent PID:89238, Current PID:89275
Processing aws/live/api/deploymets/shared/namespace
Parent PID:89238, Current PID:89278
Processing aws/live/api/vpc
Parent PID:89238, Current PID:89290
INFO[0007] The stack at /Users/leia/Dev/Leia/k8s-tg-gitops/aws/live will be processed in the following order for command apply:
Group 1
- Module /Users/leia/Dev/Leia/k8s-tg-gitops/aws/live/api/build/flask
- Module /Users/leia/Dev/Leia/k8s-tg-gitops/aws/live/api/vpc

Group 2
- Module /Users/leia/Dev/Leia/k8s-tg-gitops/aws/live/api/cluster

Group 3
- Module /Users/leia/Dev/Leia/k8s-tg-gitops/aws/live/api/deploymets/shared/namespace

Group 4
- Module /Users/leia/Dev/Leia/k8s-tg-gitops/aws/live/api/deploymets/api/flask
- Module /Users/leia/Dev/Leia/k8s-tg-gitops/aws/live/api/deploymets/services/api/flask/external
- Module /Users/leia/Dev/Leia/k8s-tg-gitops/aws/live/api/deploymets/services/api/flask/internal

Notes

To disable user interaction:

  • Use --terragrunt-non-interactive with deoploy.sh command
  • Set $TG_DISABLE_CONFIRM environment variable true

Links

Dependencies


Credits

Leia Renée
Senior Cloud Architect

References


Liability

THIS SOFTWARE ALONG WITH ITS DOCUMENTATION IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH IT.

About

Sample Repository for Creating a Kubernetes Cluster and replicating the infrastructure by a thin Terraform wrapper, i.e. Terragrunt Open Source Framework using Multi Branch Gitops approach

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published