Skip to content

harness-community/gitops-terraform-onboarding

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages