ContinueOps

    continueops

    by: ContinueOps·Resilience & Disaster Recovery

    Published
    Published 4 days ago
    Version
    0.4.0
    Source
    app.terraform.io/continueops/continueops
    Documentation

    continueops_asset_set (Resource)

    A named list of assets from one source (a cloud account, a resource group, a CMDB export, a Terraform state), kept in the ContinueOps asset register and versioned as a whole. Each apply that changes the list writes one revision, uploaded through a staged sync so a large list lands completely or not at all.

    Members are real register assets: register search, tags, where-used and dependencies work on them. An asset that leaves the set, or a set that is destroyed, ends membership only. Nothing is retired.

    A plan with no change costs one API request however large the set: refresh compares the set's content hash and count, and reads the members only when those differ (a change made outside Terraform).

    Guard. A plan that would empty the set, or remove more than 25% of its members, fails unless allow_large_change = true, so a data source that returned nothing stops at plan. The platform applies the same rule when committing.

    Do not put secrets in members. Every value ends up in Terraform state, in the plan and in the register.

    Example Usage

    # Every resource in an Azure resource group as one asset set. Each apply that
    # changes the list writes one revision; a no-change plan costs one API call.
    data "azurerm_resources" "payments" {
      resource_group_name = "rg-payments-prod"
    }
    
    resource "continueops_asset_set" "payments_azure" {
      name        = "payments-azure-prod"
      source_kind = "iac"
      source_ref  = "rg-payments-prod"
    
      assets = {
        for r in data.azurerm_resources.payments.resources :
        r.id => jsonencode({
          name        = r.name
          asset_type  = r.type
          provider    = "azure"
          location    = r.location
          environment = "prod"
          criticality = lookup(r.tags, "criticality", null) # null fields are ignored
          owner       = lookup(r.tags, "team", null)
        })
      }
    
      # Optional: record a daily "re-checked at source" without writing a revision.
      attested_on = formatdate("YYYY-MM-DD", plantimestamp())
    }

    Schema

    Required

    • assets (Map of String) The members, keyed by identifier (an ARN, an Azure resource id, a hostname). Each value is jsonencode({...}) of an object with any of name, asset_type, hostname, ip_address, environment, criticality (low, medium, high, critical), owner, location, provider (strings of at most 1,024 characters), aliases (up to 50 other ids the asset is known by, such as the instance id behind an ARN) and attributes (an object of strings, at most 8 KB). Null fields are ignored, so lookup(r.tags, "team", null) is safe. Each value is checked at plan.
    • name (String) Name, unique in the tenant ignoring case. Also the import id.

    Optional

    • allow_large_change (Boolean) Allow this apply to empty the set or remove more than 25% of it. Set it for one apply, then remove it.
    • attested_on (String) A date (YYYY-MM-DD) on which the source was re-checked. Changing it alone records an attestation (the members count as fresh, "Attested by source") and writes no revision. For a daily attestation use formatdate("YYYY-MM-DD", plantimestamp()).
    • description (String) What the set holds.
    • freshness_window_days (Number) Days an attestation keeps the members fresh. The platform default applies when unset.
    • source_kind (String) Where the list comes from: iac (the default), api, cmdb, csv, directory, manual or other.
    • source_ref (String) A pointer to the source, such as a subscription and resource group, or a workspace name.
    • timeouts (Attributes) (see below for nested schema)

    Read-Only

    • content_sha256 (String) SHA-256 of the canonical JSON of the members, sorted by identifier. Known at plan.
    • id (String) Set id (UUID).
    • member_count (Number) Number of members.
    • revision (Number) Current revision. Each apply that changes the members adds one.

    Nested Schema for timeouts

    Optional:

    • create (String) A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).
    • delete (String) A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Setting a timeout for a Delete operation is only applicable if changes are saved into state before the destroy operation occurs.
    • read (String) A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours). Read operations occur during any refresh or planning operation when refresh is enabled.
    • update (String) A string that can be parsed as a duration consisting of numbers and unit suffixes, such as "30s" or "2h45m". Valid time units are "s" (seconds), "m" (minutes), "h" (hours).

    Import

    Import is supported using the following syntax:

    In Terraform v1.5.0 and later, the import block can be used with the id attribute, for example:

    import {
      to = continueops_asset_set.example
      id = "payments-azure-prod"
    }

    The terraform import command can be used, for example:

    # Import by name (or by id).
    terraform import continueops_asset_set.example payments-azure-prod