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
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",
]
@rssnyder
rssnyder / readme.md
Last active April 29, 2024 00:53
ai answers in the terminal

open ended ai prompts

insprired by https://nickherrig.com/posts/streaming-requests

type a question into your terminal, get an ai respose

write pretty much the same code as the source blog, just using the entire source command+args to craft our input

question = " ".join(argv)
  1. For each ld project:

    a. Make an API call to get flag definitions:

     i. Be sure to use the summary=0 parameter
    
     ii. https://apidocs.launchdarkly.com/tag/Feature-flags/#operation/getFeatureFlags
    

    b. Make an API call for every ld project to get segment definitions:

@rssnyder
rssnyder / aws.tf
Created March 13, 2024 18:39
create a harness aws ccm connector for your master payer with terraform
terraform {
required_providers {
harness = {
source = "harness/harness"
}
}
}
provider "harness" {}
@rssnyder
rssnyder / azure.tf
Created March 13, 2024 18:20
create harness azure ccm connectors for every subscription in your azure tenant
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "=3.0.0"
}
harness = {
source = "harness/harness"
}
}
@rssnyder
rssnyder / gcp.tf
Last active March 8, 2024 16:54
create harness ccm connectors for gcp projects and assign access to gcp projects with tf
locals {
# pull in accounts csv
projects_raw = csvdecode(file("./projects.csv"))
# only get linked account (ignore masters)
projects = [for account in local.projects_raw : account if account["Type"] == "Linked Account"]
}
variable "harness_gcp_sa" {
type = string
}