Skip to content

Instantly share code, notes, and snippets.

@apr-1985
apr-1985 / 1-using-kubectl-from-jenkins-agents.md
Last active November 1, 2021 08:51
Run kubectl against EKS from Jenkins agent

Run kubectl against EKS from Jenkins agent

  1. Install the Plain Credentials Plugin and the Kubernetes Cli Plugin
  2. Upload your kubeconfig as a Secret file to Jenkins
  3. Ensure you have applied an auth config map with a mapping from IAM to cluster role
  4. Ensure that your agents have the correct IAM role to map with a permission in config-map (IAM Instance Profile on the EC2 Cloud plugin)
@apr-1985
apr-1985 / 1-Jenkins-JCasC-Examples.md
Last active November 28, 2025 09:11
Jenkins Config As Code Examples

Jenkins JCasC Examples

Various examples of how to setup different components using JCasC

@apr-1985
apr-1985 / 1-ISM-for-Elasticsearch.md
Created November 1, 2021 08:57
Adding an ISM to Elasticsearch

Adding an ISM to Elasticsearch

Add an ISM to All Elasticsearch index matching selected index patterns (* to match all patterns). ISM sets number of replicas to 0 after 7 days and then deletes the index after 14.

@apr-1985
apr-1985 / 1-Jenkins-Job-for-BPRs-for-GitHub-Repos.md
Last active November 1, 2021 09:14
Jenkins Job to Add Branch Protection Rules to GitHub Repos

Jenkins Job to Add Branch Protection Rules to GitHub Repos

Jenkins Job that calls a Python script to add Branch Protection Rules, Codeowners files etc to GitHub repos in an Organisation.

@apr-1985
apr-1985 / lambda.tf
Last active September 8, 2022 15:17
Medium: Managing AWS Lambda Code Outside of Terraform
data "archive_file" "bootstrap_lambda" {
type = "zip"
output_path = "${path.module}/lambda_function_payload.zip"
source {
content = "hello"
filename = "bootstrap.txt"
}
}
@apr-1985
apr-1985 / experiments.tf
Created September 12, 2022 13:41
medium: Terraform Optional Attributes and Defaults - enable experiment
terraform {
experiments = [module_variable_optional_attrs]
}
@apr-1985
apr-1985 / cuj.json
Created September 12, 2022 14:01
medium: From Critical User Journey to SLO/SLIs - json
{
"name": "Being able to search new books",
"actions": [
{
"name": "Web Service checks with ID Service to ensure User is allowed to search",
"dependencies": ["ID Service"],
"slos": [
{
"name": "ID Service",
"type": "Availability",
@apr-1985
apr-1985 / variables.tf
Last active September 12, 2022 14:42
medium: Terraform Optional Attributes and Defaults - variable object
variable "lambdas" {
description = "Map of the Lambdas"
type = map(object({
lambda_name = string
lambda_entrypoint = string
timeout = optional(number)
lambda_runtime = optional(string)
lambda_memory_size = optional(number)
}))
}
@apr-1985
apr-1985 / variables.tf
Created September 12, 2022 14:42
medium: Terraform Optional Attributes and Defaults - variable object >=1.3.0
variable "lambdas" {
description = "Map of the Lambdas"
type = map(object({
lambda_name = string
lambda_entrypoint = string
timeout = optional(number, 900)
lambda_runtime = optional(string, "python3.7")
lambda_memory_size = optional(number, 256)
}))
}
@apr-1985
apr-1985 / lambda.tf
Created September 12, 2022 14:48
medium: Terraform Optional Attributes and Defaults - variable object >0.15.0 <1.3.0
variable "lambdas" {
description = "Map of the Lambdas"
type = map(object({
lambda_name = string
lambda_entrypoint = string
timeout = optional(number)
lambda_runtime = optional(string)
lambda_memory_size = optional(number)
}))
}