Skip to content

Instantly share code, notes, and snippets.

View lenardchristopher's full-sized avatar
🧖‍♂️

Chris Lenard lenardchristopher

🧖‍♂️
  • Horse Spot
  • Charleston, SC
View GitHub Profile
@lenardchristopher
lenardchristopher / github-action-docker-build.yaml
Created September 4, 2021 20:47
Github Action Docker Build
name: "Docker Build"
on:
pull_request:
branches:
- "main"
jobs:
docker-build:
name: Docker Build
runs-on: ubuntu-latest
name: Testing
on:
- pull_request
jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v2
@lenardchristopher
lenardchristopher / github-action-golang-unit-testing.yaml
Last active September 5, 2021 12:33
Github Action Golang Unit Testing
name: Testing
on: [pull_request]
jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
@lenardchristopher
lenardchristopher / github-action-golang-lint.yml
Last active September 5, 2021 12:32
Github Action Golang Lint
name: Golang Lint
on: [pull_request]
jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: golangci-lint
@lenardchristopher
lenardchristopher / for_each.tf
Created April 14, 2021 13:44
An example of a for_each loop in Terraform.
resource "azurerm_resource_group" "rg" {
for_each = {
a_group = "eastus"
another_group = "westus2"
}
name = each.key
location = each.value
}
@lenardchristopher
lenardchristopher / pulumi-vnets.go
Last active March 15, 2021 22:08
Create virtual network peerings using Pulumi in Golang and CosmosDb config
peerings, err := getRegionPeerings(params)
for _, p := range peerings {
_, err = network.NewVirtualNetworkPeering(ctx, p.Region+"-to-"+p.Name+"-vnet", &network.VirtualNetworkPeeringArgs{
Name: pulumi.StringPtr("to-" + p.Region + "-vnet-" + p.Name),
ResourceGroupName: pulumi.String("ctus-assets"),
VirtualNetworkName: pulumi.String(p.Region + "-vnet"),
RemoteVirtualNetwork: network.SubResourcePtrInput(&network.SubResourceArgs{
Id: pulumi.StringPtr(fmt.Sprintf("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/virtualNetworks/%s", p.SubscriptionID, p.Name, p.Region+"-vnet")),
}),
@lenardchristopher
lenardchristopher / terraform-vnets.tf
Last active March 14, 2021 23:59
Dynamic resource creation with Terraform and CosmosDb Configuration Store
data "external" "clusters" {
program = ["python", "./cosmosdb_reader.py"]
query = {
cosmos_endpoint = var.endpoint
cosmos_key = var.primary_readonly_master_key
region = "centralus"
subscription_id = "00000000-0000-0000-0000-000000000000"
// CosmosDb query function
data_function = "get_region_peerings"
}