From 500efa141c95bdc14d0e82f8d44a5a87ac4340b6 Mon Sep 17 00:00:00 2001 From: Eldad Assis Date: Fri, 15 Nov 2024 12:00:44 -0700 Subject: [PATCH] Add a snippet of using Artifactory as the Terraform Backend --- 2.kubernetes-nginx/README.md | 2 ++ 2.kubernetes-nginx/main.tf | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/2.kubernetes-nginx/README.md b/2.kubernetes-nginx/README.md index ebffb4f..48ee01f 100644 --- a/2.kubernetes-nginx/README.md +++ b/2.kubernetes-nginx/README.md @@ -3,6 +3,8 @@ The work here assumes you have a Kubernetes cluster with `kubectl` installed and The [main.tf](main.tf) file has the configuration that Terraform will use to create the Nginx in the Kubernetes cluster. +This example also has a commented out snippet of using Artifactory as the [Terraform backend](https://jfrog.com/help/r/jfrog-artifactory-documentation/terraform-backend-repository). + 1. Initialize the Terraform configuration by running the following command ```shell terraform init diff --git a/2.kubernetes-nginx/main.tf b/2.kubernetes-nginx/main.tf index 3992fa2..fce770f 100644 --- a/2.kubernetes-nginx/main.tf +++ b/2.kubernetes-nginx/main.tf @@ -1,3 +1,23 @@ +terraform { + ## Configure the remote backend (Artifactory) + ## This will store the state file in Artifactory. + ## Follow https://jfrog.com/help/r/jfrog-artifactory-documentation/terraform-backend-repository + # backend "remote" { + # hostname = "eldada.jfrog.io" + # organization = "terraform-backend" + # workspaces { + # prefix = "demo-" + # } + # } + + required_providers { + # Kubernetes provider + kubernetes = { + source = "hashicorp/kubernetes" + } + } +} + provider "kubernetes" { config_path = "~/.kube/config" }