Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Understanding the Auth0 Provider for Terraform

Understanding the Auth0 Provider for Terraform

In this talk, Alex Kalyvitis (Software Engineer) joins James Quick (Developer Advocate at Auth0) and I to explain the basic concepts of the Auth0 Provider for HashiCorp Terraform.

This version of the presentation was given at two Auth0-hosted webinars in June and July 2020.

---

Companion Code: github.com/alexkappa/terraform-auth0-webinar

Kerim Satirli
PRO

June 30, 2020
Tweet

More Decks by Kerim Satirli

Other Decks in Programming

Transcript

  1. Copyright © 2020 HashiCorp Understanding the Auth0 Provider for Terraform

  2. PRESENTED BY Alex Kalyvitis (He/Him) Software Engineer Kerim Satirli (He/Him)

    Developer Advocate at HashiCorp James Quick (He/Him) Developer Advocate at Auth0
  3. James Quick github.com/jamesqquick Developer Advocate at Auth0

  4. Alex Kalyvitis github.com/alexkappa Software Engineer

  5. Kerim Satirli github.com/ksatirli Developer Advocate at HashiCorp

  6. Agenda Introducing Terraform Infrastructure as Code Managing Auth0 with Terraform

    hands-on with Auth0 and Terraform Community Development working in open source
  7. Infrastructure as Code ▪ executable documentation ▪ enables collaboration ▪

    safe and predictable
  8. Introducing Terraform

  9. Terraform 125+ Official Providers AWS, Azure, GCP, etc. 175+ Community

    Providers Auth0, Sentry, Unifi, etc.
  10. Auth0 and Terraform

  11. Provider set-up CODE EDITOR provider "auth0" { version = "~>

    0.11" domain = var.auth0_domain client_id = var.auth0_client_id client_secret = var.auth0_client_secret }
  12. TERMINAL > terraform init Initializing the backend... Initializing provider plugins...

    - Checking for available provider plugins... - Downloading plugin for provider "auth0" (terraform-providers/auth0) 0.11.0... Terraform has been successfully initialized! You may now begin working with Terraform. Try running "terraform plan" to see any changes that are required for your infrastructure. All Terraform commands should now work. If you ever set or change modules or backend configuration for Terraform, rerun this command to reinitialize your working directory. If you forget, other commands will detect it and remind you to do so if necessary.
  13. Resource: Auth0 API CODE EDITOR resource "auth0_resource_server" "blog" { name

    = "Blog Post API" identifier = "https://api.blog.com" scopes { value = "write:posts" description = "Write posts" } }
  14. Resource: Auth0 Role CODE EDITOR resource "auth0_role" "writer" { name

    = "Writer" identifier = "Blog post writer" permissions { name = "write:post" resource_server_identifier = \ auth0_resource_server.blog.identifier } }
  15. Resource: Auth0 User CODE EDITOR resource "auth0_user" "jane_doe" { connection_name

    = "Username-Password-Authentication" email = "jane.doe@blog.com" username = "jane" password = "I writez the blogz!" roles = [auth0_role.writer.id] }
  16. Command: terraform apply TERMINAL > terraform apply auth0_resource_server.blog: Creating... auth0_resource_server.blog:

    Creation complete after 0s auth0_role.writer: Creating... auth0_role.writer: Creation complete after 0s auth0_user.jane_doe: Creating... auth0_user.jane_doe: Creation complete after 1s Apply complete! Resources: 3 added, 0 changed, 0 destroyed.
  17. Verify: Auth0 Dashboard manage.auth0.com/dashboard/eu/alexkappa/apis

  18. Verify: Auth0 Dashboard manage.auth0.com/dashboard/eu/alexkappa/apis

  19. Verify: Auth0 Dashboard manage.auth0.com/dashboard/eu/alexkappa/roles

  20. Verify: Auth0 Dashboard manage.auth0.com/dashboard/eu/alexkappa/roles

  21. Verify: Auth0 Dashboard manage.auth0.com/dashboard/eu/alexkappa/roles

  22. Verify: Auth0 Dashboard manage.auth0.com/dashboard/eu/alexkappa/roles

  23. Command: terraform import TERMINAL > terraform import ADDR id

  24. Command: terraform import TERMINAL > terraform import auth0_resource_server.blog 5ef...36b auth0_resource_server.blog:

    Importing from ID 5ef...36 auth0_resource_server.blog: Import prepared! Prepared auth0_resource_server for import auth0_resource_server.blog: Refreshing state... [id=5ef...36b] Import successful!
  25. Community Development

  26. Materials ▪ blog: hashi.co/tf-auth0-blog ▪ interview: hashi.co/tf-auth0-interview ▪ community: hashi.co/tf-auth0-blog

    ▪ docs: hashi.co/tf-auth0-provider ▪ code: hashi.co/tf-auth0-code ▪ slides: hashi.co/tf-auth0 ▪ Terraform Cloud: hashi.co/tf-auth0-cloud
  27. Thank You kerim@hashicorp.com