Skip to content

Instantly share code, notes, and snippets.

View ItayPodhajcer's full-sized avatar

Itay Podhajcer ItayPodhajcer

View GitHub Profile
@ItayPodhajcer
ItayPodhajcer / main.tf
Created March 15, 2023 15:41
terraform-azure-mastodon/main.tf#aci-redis
container {
name = "redis"
image = "docker.io/bitnami/redis:7.0"
cpu = "0.5"
memory = "1"
environment_variables = {
"ALLOW_EMPTY_PASSWORD" = "yes"
}
@ItayPodhajcer
ItayPodhajcer / main.tf
Created March 15, 2023 15:40
terraform-azure-mastodon/main.tf#aci-elasticsearch
container {
name = "elasticsearch"
image = "docker.io/bitnami/elasticsearch:8"
cpu = "1"
memory = "2"
environment_variables = {
"ELASTICSEARCH_ENABLE_SECURITY" = "true"
"ELASTICSEARCH_SKIP_TRANSPORT_TLS" = "true"
}
@ItayPodhajcer
ItayPodhajcer / main.tf
Created March 15, 2023 15:39
terraform-azure-mastodon/main.tf#aci-postgresql
container {
name = "postgresql"
image = "docker.io/bitnami/postgresql:15"
cpu = "0.5"
memory = "1"
environment_variables = {
"POSTGRESQL_DATABASE" = "bitnami_mastodon"
"POSTGRESQL_USERNAME" = local.database_user
}
@ItayPodhajcer
ItayPodhajcer / main.tf
Created March 15, 2023 15:36
terraform-azure-mastodon/main.tf#aci
resource "azurerm_container_group" "this" {
name = "aci-${local.name}"
location = azurerm_resource_group.this.location
resource_group_name = azurerm_resource_group.this.name
ip_address_type = "Public"
dns_name_label = local.name
os_type = "Linux"
exposed_port {
port = "3000"
@ItayPodhajcer
ItayPodhajcer / main.tf
Created March 15, 2023 15:32
terraform-azure-mastodon/main.tf#tg-vars-pass
locals {
name = "${var.deployment_name}-${var.location}"
database_user = "dbuser"
mastodon_user = "user"
mastodon_email = "user@email.com"
}
resource "azurerm_resource_group" "this" {
name = "rg-${local.name}"
location = var.location
@ItayPodhajcer
ItayPodhajcer / test-ledger.py
Last active January 17, 2023 13:17
terraform-azure-confidential-ledger/test-ledger.py#data
ledger_client = ConfidentialLedgerClient(
endpoint=ledger_url,
credential=credential,
ledger_certificate_path=ledger_tls_cert_file_name
)
sample_entry = {"contents": "Hello world!"}
ledger_client.create_ledger_entry(entry=sample_entry)
latest_entry = ledger_client.get_current_ledger_entry()
@ItayPodhajcer
ItayPodhajcer / test-ledger.py
Created January 17, 2023 13:13
terraform-azure-confidential-ledger/test-ledger.py#identity
identity_client = ConfidentialLedgerCertificateClient(identity_url)
network_identity = identity_client.get_ledger_identity(
ledger_id=ledger_name
)
ledger_tls_cert_file_name = "ledgercert.pem"
with open(ledger_tls_cert_file_name, "w") as cert_file:
cert_file.write(network_identity['ledgerTlsCertificate'])
@ItayPodhajcer
ItayPodhajcer / test-ledger.py
Last active January 17, 2023 13:18
terraform-azure-confidential-ledger/test-ledger.py#management
credential = DefaultAzureCredential()
confidential_ledger_mgmt = ConfidentialLedgerAPI(
credential, subscription_id
)
properties = {
"location": "eastus",
"tags": {},
"properties": {
"ledgerType": "Public",
@ItayPodhajcer
ItayPodhajcer / test-ledger.py
Created January 17, 2023 13:09
terraform-azure-confidential-ledger/test-ledger.py#imports
from azure.identity import DefaultAzureCredential
from azure.mgmt.confidentialledger import ConfidentialLedger as ConfidentialLedgerAPI
from azure.mgmt.confidentialledger.models import ConfidentialLedger
from azure.confidentialledger import ConfidentialLedgerClient
from azure.confidentialledger.certificate import ConfidentialLedgerCertificateClient
resource_group = "rg-confidentialledger-eastus"
ledger_name = "acl-confidentialledger-eastus"
subscription_id = "<azure-subscription-id>"
@ItayPodhajcer
ItayPodhajcer / requirements.txt
Created January 17, 2023 13:06
terraform-azure-confidential-ledger/requirements.txt
azure-identity
azure.mgmt.confidentialledger
azure.confidentialledger