Created
August 30, 2024 13:55
-
-
Save rssnyder/2516abcf4b93a6a59a12e5bfc48f3b44 to your computer and use it in GitHub Desktop.
deploy a delegate into an eks cluster using terraform
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
terraform { | |
required_providers { | |
helm = { | |
source = "hashicorp/helm" | |
} | |
harness = { | |
source = "harness/harness" | |
} | |
} | |
} | |
provider "aws" { | |
region = "us-west-2" | |
} | |
provider "harness" {} | |
variable "name" { | |
type = string | |
} | |
variable "org_id" { | |
type = string | |
default = null | |
} | |
variable "project_id" { | |
type = string | |
default = null | |
} | |
data "harness_platform_current_account" "current" {} | |
data "aws_eks_cluster_auth" "eks" { | |
name = var.name | |
} | |
data "aws_eks_cluster" "eks" { | |
name = var.name | |
} | |
provider "helm" { | |
kubernetes { | |
host = data.aws_eks_cluster.eks.endpoint | |
cluster_ca_certificate = base64decode(data.aws_eks_cluster.eks.certificate_authority[0].data) | |
token = data.aws_eks_cluster_auth.eks.token | |
} | |
} | |
resource "harness_platform_delegatetoken" "this" { | |
name = var.name | |
account_id = data.harness_platform_current_account.current.id | |
org_id = var.org_id | |
project_id = var.project_id | |
} | |
module "delegate" { | |
source = "harness/harness-delegate/kubernetes" | |
version = "0.1.8" | |
account_id = data.harness_platform_current_account.current.id | |
delegate_token = harness_platform_delegatetoken.this.value | |
delegate_name = var.name | |
deploy_mode = "KUBERNETES" | |
namespace = "harness-delegate-ng" | |
manager_endpoint = "https://app.harness.io/gratis" | |
delegate_image = "harness/delegate:24.07.83609" | |
replicas = 1 | |
upgrader_enabled = true | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment