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
