Git Product home page Git Product logo

gitops-terraform-onboarding's Introduction

Harness GitOps onboarding via Terraform

Summary

This project automates the GitOps workflow steps of the Harness Guestbook app CD tutorial using Terraform. The Tf module:

  • Provisions the GitOps agent in Harness
  • Installs the agent in a local Kubernetes cluster
  • Creates Harness repo, cluster, environment, and service resources
  • Deploys and syncronizes the guestbook application to the cluster.

High level instructions

Provisioning

  1. Clone this repo to a machine that has Terraform command line tools installed, and can connect to a local K8 cluster.
  2. Change into gitops-terraform-onboarding/ and run terraform init.
  3. Open terraform.tfvars. This file is pre-filled with demo values for the Harness resources. Leave them as they are or change to reflect your environment.
  4. Set your Harness credentials. Run export TF_VAR_harness_api_token=<your Harness access token>.
    NOTE Be sure not to add your PAT to .tfvars!
  5. Set your Harness account info. Run export TF_VAR_account_id=<your Harness account ID>. Your account ID can be found in the web URL when accessing the Harness app.
  6. Run terraform plan. Terraform should output that 9 resoures will be created.
  7. Run terraform apply and confirm when prompted. Terraform will provision the Harness GitOps agent, install the agent in the cluster, create other Harness resources, and deploy the guestbook application.
  8. Run kubectl get pods and verify the guestbook application was deployed.
  9. Run kubectl port-forward svc/guestbook-ui 8080:80 and verify the guestbook application opens as expected.

Cleanup

  1. Run terraform destroy from the gitops-terraform-onboarding/ directory. Confirm when prompted.
  2. Run kubectl get pods to confirm the Harness resources were deleted.

gitops-terraform-onboarding's People

Contributors

nicholaslotz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.