Docs

Overview

The official Shieldome provider (shieldome/shieldome) manages your Shieldome account from the same code that builds your infrastructure. The most useful part is domain verification: the domain, its DNS ownership record and the verification are created in a single apply, so the active checks are enabled without any manual step.

NameTypeWhat it manages
shieldome_siteResourceA domain the account may scan, and the DNS TXT record that proves ownership
shieldome_site_verificationResourceWaits until Shieldome confirms the ownership record
shieldome_scheduled_scanResourceA recurring scan (Gold-tier plan)
shieldome_scan_profileResourceSaved scan settings, including authentication and custom headers
shieldome_latest_scanData sourceThe newest completed scan of a URL: risk score and finding counts

Prerequisites

  • Terraform 1.0 or later, or OpenTofu
  • A Shieldome API key - see API Keys. The key acts as your account: keep it in your secret store, not in the code.

Step 1 - Configure the provider

hcl - versions.tf
terraform {
  required_providers {
    shieldome = {
      source  = "shieldome/shieldome"
      version = "~> 0.1"
    }
  }
}

provider "shieldome" {}  # reads SHIELDOME_API_KEY from the environment
bash
export SHIELDOME_API_KEY="shd_..."
terraform init
💡
OpenTofu. The provider is published in both the Terraform and the OpenTofu registry under the same address, so the configuration above works unchanged with tofu init.

Step 2 - Add and verify a domain

Without verification Shieldome runs the passive assessment only (see Domain Verification). The site exposes the exact TXT record to publish; any DNS provider works. With Cloudflare:

hcl - shieldome.tf
resource "shieldome_site" "shop" {
  domain = "shop.example.com"
}

resource "cloudflare_record" "shieldome_verify" {
  zone_id = var.zone_id
  name    = shieldome_site.shop.verify_record_name
  type    = "TXT"
  content = shieldome_site.shop.verify_record_value
}

resource "shieldome_site_verification" "shop" {
  site_id    = shieldome_site.shop.id
  timeout    = "15m"   # keeps checking while DNS propagates
  depends_on = [cloudflare_record.shieldome_verify]
}

With AWS Route 53 the record is aws_route53_record with records = [shieldome_site.shop.verify_record_value]. Once confirmed, the verification stays active; keep the record in place anyway, as it is your proof of ownership if the site ever needs verifying again.

Step 3 - Schedule scans

hcl
resource "shieldome_scheduled_scan" "weekly" {
  target_url     = "https://shop.example.com"
  scan_type      = "both"      # vuln | perf | both | api
  interval_hours = 168
  webhook_url    = var.slack_webhook
  excluded_paths = "/cart\n/checkout"
  depends_on     = [shieldome_site_verification.shop]
}

resource "shieldome_scan_profile" "staging" {
  name        = "staging"
  target_url  = "https://staging.shop.example.com"
  auth_header = "Bearer ${var.staging_token}"
  custom_headers = {
    "X-Scanner-Allow" = var.waf_allow_token
  }
}

Changing scan_type, interval_hours, enabled, the notification targets or the excluded paths updates the schedule in place. See Scheduled Scans and Scan Profiles.

Step 4 - Stop a release on critical findings

hcl
data "shieldome_latest_scan" "shop" {
  target_url = "https://shop.example.com"
}

resource "terraform_data" "release_gate" {
  lifecycle {
    precondition {
      condition     = !data.shieldome_latest_scan.shop.found || data.shieldome_latest_scan.shop.critical == 0
      error_message = "shop.example.com has critical findings in its latest Shieldome scan."
    }
  }
}

target_url must match the URL exactly as it was submitted for scanning. Also available: risk_score, high, medium, low, completed_at and found.

Existing resources

Import what you already set up in the app:

bash
terraform import shieldome_site.shop <site id>
terraform import shieldome_scheduled_scan.weekly <schedule id>
terraform import shieldome_scan_profile.staging <profile id>

The ids are returned by GET /api/me/allowed-sites, GET /api/scheduled-scans and GET /api/profiles (REST API). Creating a site that already exists in the account fails with a message asking for this import.

ℹ️
Removing a site. Authorized sites cannot be removed self-service. Destroying a shieldome_site removes it from the Terraform state only and prints a warning; open a support ticket to remove it from the account. Schedules and profiles are deleted normally.

Configuration

ArgumentEnvironment variableDescription
api_keySHIELDOME_API_KEYYour API key (sensitive)
base_urlSHIELDOME_BASE_URLDefaults to https://app.shieldome.com; set it for a self-hosted installation

Every argument and attribute is listed in the registry documentation; the source is on GitHub.

🔒
State contains secrets. Scan profile credentials (auth_header, auth_cookie, custom_headers) are marked sensitive but are stored in the Terraform state, like any provider's secrets. Use an encrypted remote backend.

Troubleshooting

ProblemSolution
the API did not answer with JSON - check api_key and base_urlThe API key is wrong, revoked, or for another installation
Domain not verified in timeThe error names the TXT record Shieldome expects. Check it with dig TXT _shieldome-verify.<domain> and raise timeout if DNS is slow to propagate
Site already existsImport the site instead of creating it (see above)
Creating a scheduled scan returns 403Scheduled scans need a Gold-tier plan