Skip to content

Instantly share code, notes, and snippets.

resource "newrelic_one_dashboard" "this" {
name = var.dashboard_name
permissions = "public_read_only"
# To create TABS in dashboard
dynamic "page" {
for_each = var.resources
content {
# To display TABS name in dashboard
name = page.value["bu"]
# To create graph in dashboard
variable "resources" {
description = "My Dashboard"
type = list(object({
bu = string
title = string
query = list(string)
}))
}
resources = [{
bu = "netflix"
title = ["title_1", "title_2", "title_3", "title_4", "title_5", "title_6"]
query = ["SELECT max(provider.currItems.Maximum) FROM DatastoreSample as 'Cache Items' FROM DatastoreSample WHERE provider='ElastiCacheRedisNode' AND providerAccountName = 'xxx' AND displayName LIKE '${widget_line.value}%' TIMESERIES AUTO FACET displayName", "query_2", "query_3", "query_4", "query_5", "query_6"]
}, {
bu = "apple"
title = ["title_1", "title_2", "title_3", "title_4", "title_5", "title_6"]
query = ["query_1", "query_2", "query_3", "query_4", "query_5", "query_6"]
}, {
bu = "youtube"

Terraforming API Gateway to SQS queue

Example of a bare-minimum terraform script to setup an API Gateway endpoint that takes records and puts them into an SQS queue.

SQS

Start by creating the SQS queue.

resource "aws_sqs_queue" "queue" {
@ppshein
ppshein / tags.sh
Last active November 10, 2022 08:08
#!/bin/bash
ARGS=${@:1}
input="./tags.txt"
tagCluster() {
local clusterName=$1
local region=$2
nodeGroups=$(aws eks list-nodegroups --cluster-name $clusterName --region $region --query 'nodegroups' --output text)
# Time complexity = O(n^3)
for nodeGroup in $nodeGroups; do
autoScalings=$(aws eks describe-nodegroup --cluster-name $clusterName --nodegroup-name $nodeGroup --region $region --query 'nodegroup.resources.autoScalingGroups[0]' --output text)