Skip to content

Instantly share code, notes, and snippets.

View carljavier's full-sized avatar
☁️
Cloud DevOps Infrastructure Engineering Contract

Carl Javier carljavier

☁️
Cloud DevOps Infrastructure Engineering Contract
View GitHub Profile
@carljavier
carljavier / HCL_Viper.md
Last active November 16, 2022 20:15
Viper Configs in HCL

Using HCL configurations with Viper

Example HCL config file

name="blah"
foo="bar"

profile "site1" {
    api_url    = "https://api.site1.com/client"
 api_key = "key"
@carljavier
carljavier / tf_vault.tf
Created September 30, 2022 05:24
tf_vault Test
data "vault_generic_secret" "awsregion" {
path = "secret/aws"
}
output "awsregion" {
value = data.vault_generic_secret.awsregion.data_json
sensitive = true
}
@carljavier
carljavier / timecheck.sentinel
Last active September 1, 2022 00:37
Time Validate Sentinel
import "time"
# Load Time
currentTime = time.now
# Validate time is between 10 AM and 6 PM AEST
valid_time = rule { (currentTime.hour >= 0 and currentTime.hour < 8)}
# Validate time is between 7am AM and 10 AM AEST
valid_time2 = rule { (currentTime.hour >= 21 and currentTime.hour <= 23)}
@carljavier
carljavier / tf_chucknorris_api.tf
Last active August 31, 2022 00:06
Terracurl API Curl Request Example
terraform {
required_providers {
terracurl = {
source = "devops-rob/terracurl"
}
}
}
provider "terracurl" {}
#! /bin/bash +X
# later we will disable selinux
# sudo setenforce Permissive
# getenforce # just incase youy want to check selinuxmode
# lets make sure we are a clean install of docker
sudo yum remove docker docker-common docker-selinux docker-engine-selinux docker-engine docker-ce
# now install some tools dmpd(for short) ensures rhel 7 respects gpg settings in repos (issue is https://access.redhat.com/solutions/2850911) see https://access.redhat.com/discussions/5336741 for the fix
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
@carljavier
carljavier / team-access.tf
Created June 1, 2022 10:49
TFE Team Access, Plan/Apply
# Two Teams, one is admin (apply) , and the other can only plan
resource "tfe_team" "gcp-network-admin" {
name = "gcp-network-admin"
organization = "my-org-name"
}
resource "tfe_team" "gcp-network-plan" {
name = "gcp-network-plan"
organization = "my-org-name"
}
@carljavier
carljavier / azure-pipeline.yaml
Created May 31, 2022 10:37
Azure DevOps TF Pipeline
trigger:
- master
pool:
vmImage: ubuntu-latest
steps:
- script: echo Starting Terraform Run
@carljavier
carljavier / query-template-catch-all.json
Last active April 11, 2022 00:31
Consul Vault Service Query
{
"Name": "",
"Template": {
"Type": "name_prefix_match"
},
"Service": {
"Service": "${name.full}",
"Failover": {
"NearestN": 2
}
@carljavier
carljavier / external-service-chucknorris.json
Created March 4, 2022 08:21
Consul External Service Registration
{
"Node": "chucknorris",
"Address": "api.chucknorris.io",
"NodeMeta": {
"external-node": "true",
"external-probe": "true"
},
"Service": {
"ID": "chucknorris",
"Service": "chucknorris-api",
@carljavier
carljavier / mermaid-test.md
Last active February 22, 2022 04:14
Mermaid Test
  graph TD;
      A-->B;
      A-->C;
      B-->D;
      C-->D;
flowchart LR