Skip to content

Instantly share code, notes, and snippets.

View stvdilln's full-sized avatar

Steve Dillon stvdilln

  • South Florida
View GitHub Profile
@stvdilln
stvdilln / caller.tf
Created January 14, 2021 17:38
terraform-azurerm: Calling CosmosDB to create a container
module "cosmosdb_northwind_customers" {
source = "../../../submodules/terraform-azurerm/services/cosmos-db/container/v1"
context = module.coreinfra.context
service_settings = {
account_name = module.cosmosdb_account.name
database_name = module.cosmosdb_database.name
@stvdilln
stvdilln / main.tf
Created January 14, 2021 17:19
azurerm_cosmosdb_sql_database
resource "azurerm_cosmosdb_sql_database" "database" {
name = var.service_settings.name
resource_group_name = var.context.resource_group_name
account_name = var.service_settings.account_name
autoscale_settings {
max_throughput = var.service_settings.max_throughput
}
}
@stvdilln
stvdilln / main.tf
Created January 14, 2021 17:14
CosmosDB - Database Creation
module cosmosdb_database {
source = "../../../submodules/terraform-azurerm/services/cosmos-db/database/sql/base/v1"
context = module.coreinfra.context
service_settings = {
name = "Northwind-Customers"
account_name = module.cosmosdb_account.name
# for autoscaling resources, shared between all containers
# the module just does shared autoscaling at this time.
# We can create more modules in the library as needed.
max_throughput = 4000
@stvdilln
stvdilln / main.tf
Created January 14, 2021 13:55
cosmos-db account module source
resource "azurerm_cosmosdb_account" "account" {
name = "${var.service_settings.name}-${random_string.random.result}"
location = var.context.location
resource_group_name = var.context.resource_group_name
offer_type = var.service_settings.tier
kind = var.service_settings.kind
enable_automatic_failover = true
consistency_policy {
@stvdilln
stvdilln / cosmosdb.tf
Created January 14, 2021 13:30
terraform-azurerm-sample-cosmosdb
#
# Create a cosmosDB account
#
module cosmosdb_account {
depends_on = [ azurerm_key_vault_access_policy.current_user ]
source = "../../../submodules/terraform-azurerm/services/cosmos-db/endpoint/dual/secure/v1"
context = module.coreinfra.context
observability_settings = module.coreinfra.observability_settings
service_settings = {
name = local.resource_name
@stvdilln
stvdilln / demo.sh
Last active January 11, 2021 17:44
Cloning Terraform-AzureRM-Samples with Submodules
steve_dillon@Azure:~$ git clone git://github.com/persistentsystems/terraform-azurerm-samples.git
Cloning into 'terraform-azurerm-samples'...
steve_dillon@Azure:~$ cd terraform-azurerm-samples/
steve_dillon@Azure:~/terraform-azurerm-samples$ git submodule init
Submodule 'submodules/terraform-azurerm' (git://github.com/persistentsystems/terraform-azurerm.git) registered for path 'submodules/terraform-azurerm'
steve_dillon@Azure:~/terraform-azurerm-samples$ git submodule update
Cloning into '/home/steve_dillon/terraform-azurerm-samples/submodules/terraform-azurerm'...
Submodule path 'submodules/terraform-azurerm': checked out '0fe1907fc7bb48ea989893715a1532f5b5879421'
@stvdilln
stvdilln / ambassador-demo-hello-world.yaml
Created February 13, 2020 20:34
Hello world app for Ambassador Edge Connect Blog.
apiVersion: v1
kind: ServiceAccount
metadata:
# This must match annotation "consul.hashicorp.com/connect-service":
name: demo-helloworld
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
# if you deployed consul with consul-helm then
# you need to verify spec->address matches your
# helm release name. Do a 'kubectl get service'
# to verify your consul server name. Or
# helm list to get the release name
---
apiVersion: getambassador.io/v2
kind: ConsulResolver
metadata:
name: consul-dc1
@stvdilln
stvdilln / ambassador-consul-connect.yaml
Last active February 13, 2020 17:44
ambassador-consul-connect.yaml with CONSUL_HTTP_TOKEN for ACL enabled consul clusters.
#
# You MUST edit the last line of file file and add
# the name of your consul-helm deployment.
# most likely this is consul
#
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
kubectl apply -f - << EOF
#
# This mapping maps to the sidecar-proxy
# so that Ambassador can do mTLS with Consul
---
apiVersion: getambassador.io/v2
kind: Mapping
metadata:
name: demo-helloworld
spec: