{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://infragr.am/schemas/bundle-v3.schema.json",
  "title": "Infragr.am sanitized Terraform bundle",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "resources",
    "sanitization"
  ],
  "properties": {
    "schema_version": {
      "const": 3
    },
    "terraform_version": {
      "type": "string"
    },
    "terraform_format_version": {
      "type": "string"
    },
    "resources": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "address",
          "type",
          "name"
        ],
        "properties": {
          "address": {
            "type": "string"
          },
          "module_address": {
            "type": "string"
          },
          "mode": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "provider_name": {
            "type": "string"
          },
          "actions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "values": {
            "type": "object"
          }
        }
      }
    },
    "references": {
      "description": "Every reference each configured resource makes, unresolved. Sources and refs are the addresses the configuration writes, qualified by module and without count subscripts; expanding them against `resources`, and deciding which instance pairs with which, is the renderer's job.",
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "source",
          "ref",
          "block_index"
        ],
        "properties": {
          "source": {
            "type": "string",
            "description": "The referring resource, without count subscripts."
          },
          "via": {
            "type": "string",
            "description": "The attribute carrying the reference; within a nested block when block_type is set."
          },
          "block_type": {
            "type": "string",
            "description": "Enclosing nested block, empty for a top-level attribute."
          },
          "block_index": {
            "type": "integer",
            "description": "Ordinal of the enclosing block instance, -1 for a top-level attribute. Always encoded: 0 is meaningful."
          },
          "ref": {
            "type": "string",
            "description": "What the reference names, normalized to an address: a resource, or a local that keys into `symbols`."
          }
        }
      }
    },
    "symbols": {
      "description": "What each module-qualified symbol references: a local, a module input variable (`module.x.var.name`), or a module output (`module.x.name`). Together they carry a reference across a module boundary, which neither half does alone. Values never appear: a symbol holding a literal has no references and is omitted, and a symbol that reaches no resource is not emitted at all.",
      "type": "object",
      "additionalProperties": {
        "type": "array",
        "items": {
          "type": "string"
        }
      }
    },
    "sanitization": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "profile",
        "sensitive_paths_removed",
        "denied_keys_removed"
      ],
      "properties": {
        "profile": {
          "const": "standard"
        },
        "sensitive_paths_removed": {
          "type": "integer",
          "minimum": 0
        },
        "denied_keys_removed": {
          "type": "integer",
          "minimum": 0
        }
      }
    }
  }
}
