Skip to content

Instantly share code, notes, and snippets.

View rssnyder's full-sized avatar
🥨
limitless servers in a serverless world

Riley Snyder rssnyder

🥨
limitless servers in a serverless world
View GitHub Profile
@rssnyder
rssnyder / main.tf
Last active September 18, 2024 18:56
terraform to create a harness project with a service account and workspace to create harness resources
terraform {
required_providers {
harness = {
source = "harness/harness"
}
}
}
variable "org_id" {
type = string
@rssnyder
rssnyder / a.project.json
Created September 17, 2024 18:58
create a harness project based on files with a common naming scheme
{
"org_id": "default",
"id": "projectA"
}
@rssnyder
rssnyder / delegate.tf
Created August 30, 2024 13:55
deploy a delegate into an eks cluster using terraform
terraform {
required_providers {
helm = {
source = "hashicorp/helm"
}
harness = {
source = "harness/harness"
}
}
}

deploy a namespaced delegate:

helm upgrade -i namespaced \
  harness-delegate/harness-delegate-ng \
  --set delegateName=namespaced \
  --set accountId=wlgELJ0TTre5aZhzpt8gVA \
  --set delegateToken=XXXXXX \
  --set managerEndpoint=https://app.harness.io/gratis \
 --set delegateDockerImage=harness/delegate:24.05.83001 \
# fill in these values
API_KEY=
FLAG=
HOST=config.ff.harness.io
TARGET=foo
# Authenticate as a client SDK with target
AUTH_TOKEN=$(curl -X POST "https://$HOST/api/1.0/client/auth" -H "accept: application/json" -H "Content-Type: application/json" -d "{\"apiKey\":\"$API_KEY\",\"target\":{\"identifier\":\"$TARGET\"}}" | jq -r '.authToken')
from os import getenv
import pandas as pd
import numpy as np
from requests import post, put
HARNESS_URL = "app3.harness.io"
PARAMS = {
@rssnyder
rssnyder / gh_secret_manager.tf
Created May 21, 2024 17:07
github pat custom secrets manager tf
resource "harness_platform_template" "GitHub_App_Pat_Dispenser" {
identifier = "GitHub_App_Pat_Dispenser"
name = "GitHub App Pat Dispenser"
version = "0.0.1"
is_stable = true
template_yaml = <<-EOT
template:
name: GitHub App Pat Dispenser
identifier: GitHub_App_Pat_Dispenser
versionLabel: 0.0.1
# setup
set the following env vars:
- HARNESS_ACCOUNT_ID: account id
- HARNESS_ORG_ID: org id
- HARNESS_PLATFORM_API_KEY: harness api key
# usage
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis
spec:
replicas: 1
selector:
matchLabels:
app: redis
template:
@rssnyder
rssnyder / oidc.tf
Last active April 30, 2024 20:20
Harness AWS OIDC Role Creation with Terraform
data "aws_caller_identity" "this" {}
data "harness_platform_current_account" "this" {}
# create the identity provider
resource "aws_iam_openid_connect_provider" "this" {
url = "https://app.harness.io/ng/api/oidc/account/${data.harness_platform_current_account.this.id}"
client_id_list = [
"sts.amazonaws.com",
]