terraform

command module
v0.0.0-...-c1bf3d6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 5, 2025 License: MIT Imports: 5 Imported by: 0

README

Terraform Provider for Authava

This Terraform provider allows you to manage your Authava authentication domains and settings through Infrastructure as Code.

Requirements

Building The Provider

  1. Clone the repository
  2. Enter the repository directory
  3. Build the provider using the Go install command:
go install

Adding Dependencies

This provider uses Go modules. Please see the Go documentation for the most up to date information about using Go modules.

To add a new dependency github.com/author/dependency to your Terraform provider:

go get github.com/author/dependency
go mod tidy

Using the provider

To use the provider, add the following to your Terraform configuration:

terraform {
  required_providers {
    authava = {
      source = "authava/authava"
    }
  }
}

provider "authava" {
  api_token = "your-api-token"  # Can also be set using AUTHAVA_API_TOKEN env var
  # Optional: host = "https://api.authava.com/v1"  # Can also be set using AUTHAVA_HOST env var
}
Example Usage
# Create a domain
resource "authava_domain" "example" {
  domain = "example.com"
}

# Configure email settings
resource "authava_email_settings" "example" {
  id            = authava_domain.example.id
  email_provider = "custom_smtp"
  from_email    = "auth@example.com"
  from_name     = "Example Auth"

  smtp = {
    host       = "smtp.gmail.com"
    port       = 587
    username   = "smtp-user"
    password   = "smtp-password"
    encryption = "tls"
    is_active  = true
  }

  theme = {
    style           = "light"
    brand_color     = "#2563eb"
    secondary_color = "#4f46e5"
    button_style    = "solid"
    font_family     = "Roboto"
  }
}

# Configure whitelabel settings
resource "authava_whitelabel_settings" "example" {
  id             = authava_domain.example.id
  company_name   = "Example Corp"
  logo_url       = "https://example.com/logo.png"
  favicon_url    = "https://example.com/favicon.ico"
  primary_color  = "#2563eb"
  secondary_color = "#4f46e5"
  footer_text    = "© 2024 Example Corp"
  terms_url      = "https://example.com/terms"
  privacy_url    = "https://example.com/privacy"
}

# Configure allowed origins
resource "authava_origin" "app" {
  domain_id = authava_domain.example.id
  origin    = "https://app.example.com"
  is_active = true
}

# Configure social providers
resource "authava_social_provider" "google" {
  domain_id      = authava_domain.example.id
  provider       = "google"
  client_id      = "google-client-id"
  client_secret  = "google-client-secret"
  is_active      = true
}

Available Resources

authava_domain

Manages an Authava domain.

Arguments:

  • domain - (Required) The domain name.

Attributes:

  • id - Domain identifier.
  • status - Current status of the domain.
  • user_id - ID of the domain owner.
  • created_at - Creation timestamp.
  • updated_at - Last update timestamp.
authava_email_settings

Manages email settings for a domain.

Arguments:

  • id - (Required) Domain identifier.
  • email_provider - (Required) Email provider type ("authava" or "custom_smtp").
  • from_email - (Required) Email address to send from.
  • from_name - (Optional) Display name for the from email.
  • theme - (Optional) Email theme configuration block.
  • smtp - (Optional) SMTP configuration block for custom_smtp provider.
authava_whitelabel_settings

Manages whitelabel settings for a domain.

Arguments:

  • id - (Required) Domain identifier.
  • company_name - (Optional) Company name to display.
  • logo_url - (Optional) URL to company logo.
  • favicon_url - (Optional) URL to favicon.
  • primary_color - (Optional) Primary brand color (hex).
  • secondary_color - (Optional) Secondary brand color (hex).
  • footer_text - (Optional) Custom footer text.
  • terms_url - (Optional) URL to terms of service.
  • privacy_url - (Optional) URL to privacy policy.
authava_origin

Manages allowed CORS origins for a domain.

Arguments:

  • domain_id - (Required) Domain identifier.
  • origin - (Required) Allowed origin URL.
  • is_active - (Optional) Whether this origin is active.
authava_social_provider

Manages social login providers for a domain.

Arguments:

  • domain_id - (Required) Domain identifier.
  • provider - (Required) OAuth provider type ("google", "github", "microsoft", "apple").
  • client_id - (Required) OAuth client ID.
  • client_secret - (Required) OAuth client secret.
  • is_active - (Optional) Whether this provider is enabled.

Importing Resources

Most resources can be imported using their ID:

# Import a domain
terraform import authava_domain.example "domain-id"

# Import email settings
terraform import authava_email_settings.example "domain-id"

# Import whitelabel settings
terraform import authava_whitelabel_settings.example "domain-id"

# Import an origin (format: domain_id/origin_id)
terraform import authava_origin.app "domain-id/origin-id"

# Import a social provider (format: domain_id/provider_id)
terraform import authava_social_provider.google "domain-id/provider-id"

Development

Requirements
Building
  1. Clone the repository
  2. Enter the repository directory
  3. Build the provider using the Go install command:
go install
Testing

To run the tests:

go test ./...
Generating Documentation

Documentation is generated from the provider schema. The Terraform Registry will automatically generate documentation when the provider is published.

License

MIT

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL