© Zühlke 2023
> "The best way to learn is to teach."
© Zühlke 2023
© Zühlke 2023
© Zühlke 2023
© Zühlke 2023
Patient App | Doctor App | Admin App | :-----------:|:----------:|:---------:|
SIT | SIT | SIT
| |
© Zühlke 2023
Patient App | Doctor App | Admin App | :----------:|:----------:|:---------:| SIT | SIT | SIT UAT | UAT | UAT
| |
© Zühlke 2023
Patient App | Doctor App | Admin App | :----------:|:----------:|:---------:| SIT | SIT | SIT UAT | UAT | UAT PROD | PROD | PROD
© Zühlke 2023
Patient App | Doctor App | Admin App | :----------:|:----------:|:---------:| SIT | SIT | SIT UAT | UAT | UAT STG | STG | STG PROD | PROD | PROD
© Zühlke 2023
© Zühlke 2023
export AUTH0_DOMAIN=***********
export AUTH0_CLIENT_ID=***********
export AUTH0_CLIENT_SECRET=***********
© Zühlke 2023
Configure the Provider in main.tf
terraform {
required_providers {
auth0 = {
source = "auth0/auth0"
version = "~> 0.43.0"
}
}
}
provider "auth0" {}
© Zühlke 2023
Run the command from the module folder:
And you are ready to go!
terraform init
© Zühlke 2023
resource "auth0_client" "admin_app" {
allowed_clients = []
allowed_logout_urls = [...]
allowed_origins = []
app_type = "spa"
callbacks = [...]
client_aliases = []
client_metadata = {}
cross_origin_auth = false
custom_login_page_on = true
grant_types = [
"authorization_code",
"refresh_token",
"password",
"http://auth0.com/oauth/grant-type/password-realm",
]
is_first_party = true
is_token_endpoint_ip_header_trusted = false
name = "Admin App"
oidc_conformant = true
sso = false
sso_disabled = false
token_endpoint_auth_method = "none"
web_origins = [...]
jwt_configuration {
alg = "RS256"
lifetime_in_seconds = 36000
scopes = {}
secret_encoded = false
}
refresh_token {
...
}
}
© Zühlke 2023
resource "auth0_connection" "sms" {
is_domain_connection = false
metadata = {}
name = "sms"
strategy = "sms"
options {
allowed_audiences = []
api_enable_users = false
auth_params = {}
brute_force_protection = true
...
from = "+12184223634"
import_mode = false
ips = []
name = "sms"
non_persistent_attrs = []
pkce_enabled = false
requires_username = false
scopes = []
scripts = {}
sign_saml_request = false
strategy_version = 0
syntax = "md_with_macros"
template = <<-EOT
Your verification code is: @@password@@
EOT
twilio_sid = "***********"
twilio_token = "***********"
...
totp {
length = 6
time_step = 180
}
}
}
© Zühlke 2023
resource "auth0_email" "smtp_email_provider" {
default_from_address = "support@nextgen.com"
enabled = true
name = "smtp"
credentials {
smtp_host = "email-smtp.ap-southeast-1.amazonaws.com"
smtp_port = 587
smtp_user = "***********"
smtp_pass = "***********"
}
}
resource "auth0_connection_client" "sms_conn_patient_app_assoc" {
depends_on = [auth0_connection.sms, auth0_client.native_app]
connection_id = auth0_connection.sms.id
client_id = auth0_client.native_app.id
}
© Zühlke 2023
© Zühlke 2023
© Zühlke 2023
terraform import auth0_client.web_client AaiyAPdpYdesoKnqjj8HJqRn4T5titww
terraform state show auth0_client.web_client
© Zühlke 2023
© Zühlke 2023
Together with TF variables, you manage multiple environments with the same TF module:
terraform workspace list
terraform workspace select sit
terraform workspace new uat
terraform plan -var-file=$(terraform workspace show).tfvars
terraform apply -var-file=$(terraform workspace show).tfvars
© Zühlke 2023
Terraform doesn't provide an official solution for encryption gpg --full-generate-key gpg --list-keys gpg --armor --output sops_key.asc --export kevin.lin@zuhlke.com gpg --fingerprint export SOPSPGPFP="BE5F 7B02 7354 784A CBDD DBA8 8B77 1DA9 D18D FE84"
© Zühlke 2023
© Zühlke 2023
© Zühlke 2023