liveBook · Manning

Active resource

As explained in Infrastructure as Code, Patterns and Practices: With examples in Python and Terraform

An active resource is a provisioned infrastructure resource whose current state can be inspected in its operating environment.

An active resource is a provisioned infrastructure resource whose current state can be inspected in its operating environment. Comparing that state with infrastructure as code verifies whether deployment succeeded and helps detect changes that could break infrastructure. section 6.4.1 section 10.2.1

Use an active resource as the reference point when testing or refactoring infrastructure:

  • Apply the configuration to a testing environment and provision the resource. section 6.4.1
  • Retrieve the resource’s state through the infrastructure provider’s API. section 6.4.1
  • Compare the returned state with the intended configuration; a running server passes, while another status identifies a module problem. section 6.4.1
  • Destroy temporary resources after testing, or import existing resources before moving their configuration so redeployment produces no changes. section 6.4.1 section 10.2.1

Server integration test

A Python integration test creates a GCP server named hello-world-test, uses Libcloud to inspect the GCP API, checks for a running status, and then deletes the server. A successful run reports four passing tests after the provisioning delay. section 6.4.1

How Infrastructure as Code, Patterns and Practices: With examples in Python and Terraform covers it

How deep it goes
Explains API inspection, status comparison, teardown, and import-based idempotency, but does not detail provider-state internals.
Examples
Uses a GCP server test, Libcloud status checks, pytest output, and Terraform IAM-resource import with a no-change plan.
What it assumes
Assumes familiarity with infrastructure as code and provider environments while demonstrating API-based inspection and resource import procedures.
What you can do after
Diagnose deployment failures and verify refactors by inspecting provider state, comparing configuration, importing resources, and confirming no unintended changes.
How it connects
Connects infrastructure as code with integration testing, provider APIs, infrastructure state, resource import, and idempotency.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Infrastructure as Code, Patterns and Practices: With examples in Python and Terraform. The section links point to the parts of the book it draws on.