Skip to content

Instantly share code, notes, and snippets.

View omarismail's full-sized avatar

Omar Ismail omarismail

  • HashiCorp
View GitHub Profile
@omarismail
omarismail / features.md
Last active September 22, 2023 06:52
provider-functions-features

As a Terraform User

See below for the Provider Author side.

Provider Functions Syntax

  • A function will accept any number of arguments, as defined by the provider function
  • A function will have a result and error/diagnostic handling
  • The function syntax will maintain the top level namespace to allow for future extensibility
  • Each provider will have its own namespace, that of the provider name.
@omarismail
omarismail / main.tf
Last active September 18, 2023 18:06
provider-functions
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
}
}
}
locals {
arn_parts = provider::aws::parse_arn("arn:aws:s3:::examplebucket/developers/design_info.doc")
@omarismail
omarismail / test.py
Created July 21, 2023 15:10
terraform test gpt
import openai
import os
import glob
from dotenv import load_dotenv
load_dotenv()
openai.api_key = os.getenv("OPENAI_API_KEY")
system_message = """
@omarismail
omarismail / terraform_test_docs.md
Created July 20, 2023 20:58
Terraform Test Documentation

Command: test

The terraform test command reads in Terraform testing files and executes the tests detailed within.

The test command, and the test file syntax, are targeted at module authors wishing to validate and test their shared modules. Despite this, it is also possible to use the test command to validate root modules.

Usage

Usage: terraform test [options]

@omarismail
omarismail / agent_with_custom_tool.ipynb
Created April 20, 2023 16:50 — forked from virattt/agent_with_custom_tool.ipynb
agent_with_custom_tool.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@omarismail
omarismail / dd.json
Created November 19, 2021 18:48
datadog tracer config
{
"date":"2021-11-19T17:46:30+00:00",
"os_name":"x86_64-pc-linux-musl",
"version":"0.54.0",
"lang":"ruby",
"lang_version":"2.7.4",
"enabled":true,
"service":"rails",
"agent_url":"http://datadog.tfe:8126?timeout=30",
"debug":false,
@omarismail
omarismail / go-table-driven-tests-parallel.md
Created November 11, 2021 19:11 — forked from posener/go-table-driven-tests-parallel.md
Be Careful with Table Driven Tests and t.Parallel()

Be Careful with Table Driven Tests and t.Parallel()

We Gophers, love table-driven-tests, it makes our unittesting structured, and makes it easy to add different test cases with ease.

Let’s create our table driven test, for convenience, I chose to use t.Log as the test function. Notice that we don't have any assertion in this test, it is not needed to for the demonstration.

func TestTLog(t *testing.T) {
	t.Parallel()
@omarismail
omarismail / main.tf
Created October 16, 2021 19:37
s3 backend
terraform {
backend "s3" {
bucket = "tf-backend-omar"
region = "us-east-1"
acl = "public-read"
}
}
output "env" {
@omarismail
omarismail / main.tf
Created October 16, 2021 19:36
remote backend, name
terraform {
backend "remote" {
hostname = "app.staging.terraform.io"
organization = "omar-test"
workspaces {
name = "app"
}
}
}
@omarismail
omarismail / main.tf
Created October 16, 2021 19:36
remote backend, prefix
terraform {
backend "remote" {
hostname = "app.staging.terraform.io"
organization = "omar-test"
workspaces {
prefix = "app-"
}
}
}