Terraform / Sensitive data, governance, and recovery / Lesson 21
Test Terraform modules with mocked providers
Design provider-mocked Terraform tests and state clearly what their assertions cannot prove.
On this page
Lesson goals
- Explain what a mocked provider supplies during a test.
- Design meaningful assertions on module contracts.
- Separate mock evidence from real provider integration.
- Design input-output and negative assertions that detect meaningful module contract defects.
- Explain the evidence and isolation limits of each mocked run and its provider mappings.
Choose the test boundary
Terraform tests can use mocked providers to exercise a module without creating real infrastructure through those mocked resources. Mocking is available in Terraform 1.7 and later; check the version and provider configuration used by the actual test. A test file may also include real providers, so inspect every run before assuming it is offline. The snippets here are illustrative and are not execution evidence.
Read the mock configuration
This fragment declares a mocked provider and plan-mode run. A complete test also needs module configuration, inputs and assertions. Plan mode does not prove apply behavior. Inspect provider mappings in every run, especially when real and mocked aliases coexist.
mock_provider "aws" {}
run "synthetic_check" {
command = plan
}
The fragment is incomplete by design: it illustrates a mock and run, not a complete or executed test.
Control generated values
Mock providers use provider schemas and generate values for computed attributes. Generated values need not resemble actual service identifiers. Supply explicit mock data when a meaningful assertion needs a stable value, and never treat a fabricated attribute as evidence that an API accepted it. The second record states the scope of a hypothetical result rather than claiming a real service outcome.
test_scope: module-contract
provider_behavior: mocked
real_api_contact: not-established
service_availability: not-tested
The record identifies a module contract test and explicitly leaves real API behavior untested.
Assert the contract
Choose assertions that express caller-visible behavior: an input produces an expected output, an invalid input fails the intended validation, or a module selects the expected configuration. Include both a positive and a negative case. Avoid assertions that merely repeat a private implementation detail, and review whether unknown values prevent a conclusion during plan.
Layer independent evidence
Run approved mock tests in isolation and retain the version and inputs. Use a separately authorized integration lab for API behavior, permissions or eventual consistency, with reviewed cleanup and costs. Passing mocks support their assertions, not production readiness.
Choose the question before choosing the mock
A provider mock substitutes synthetic provider behavior for the configurations to which it is mapped in a Terraform test. It can let a test examine how a module uses inputs, resource attributes, and outputs without creating real infrastructure through those mocked resources. It does not automatically mock every provider in a test file: inspect each run and its mappings, including aliases, before execution. Terraform supports provider mocking from version 1.7; this course’s configuration targets the 1.16 family.
Start with a specific contract question, such as whether a supplied service name appears in a module output. State the inputs, provider mappings, command stage, expected assertion, and what evidence would falsify the expectation. A plan-mode assertion can address values available during planning; it does not establish that a provider accepted an apply or that a service became ready. All records below are fictional test reviews, not reports of executed tests.
Make computed values meaningful without treating them as real
Mocked providers use provider schemas and generate synthetic values for computed attributes. A generated string may satisfy a schema type while looking nothing like a real identifier. If the module contract depends on a particular computed value, provide deliberate mock data using the documented test mechanism and make the expected output explicit. Check whether the module transforms that value correctly rather than declaring the generated value evidence of a real API response.
For instance, if a module should expose the endpoint supplied by a mocked data source, a stable synthetic endpoint allows an equality assertion. An arbitrary generated value might make the same assertion nondeterministic or irrelevant. Conversely, setting every expected output directly in test data can hide a broken transformation; choose fixture values that exercise the path under review and include a counterexample. Neither fixture verifies DNS, network access, service readiness, or provider-side constraints.
Write assertions that distinguish useful outcomes
A strong assertion checks an observable contract with concrete inputs and an expected result. Pair a valid case with a negative or boundary case that can fail for the intended reason, and inspect the actual diagnostic rather than assuming any failure demonstrates the desired validation. Prefer a caller-visible output or documented error condition to a private resource address when the interface is the goal. A test that compares a value with itself can pass even if the module ignores the input.
Some values can remain unknown at plan time. An assertion requiring a known value needs a suitable fixture, a different stage, or an explicit acknowledgement that the plan cannot decide it. Do not interpret an unknown as either a confirmed safe value or a failure of real infrastructure. Keep the expected outcome tied to the run, inputs, and selected mock; test-run state and execution behavior must be reviewed under the documented Terraform version and test setup.
Review mappings and isolate credentials
A file containing a mock may also contain real provider configurations or a run mapped to a real alias. A green result for one mocked run says nothing about the execution path of another run. List each run’s provider configurations and effective mappings, and identify any real provider, data source, credential, backend, or external command that could cross the intended isolation boundary. If the mapping or environment is unclear, do not execute until an authorized owner resolves it.
Mocked apply behavior is still simulated provider behavior. A separately approved integration lab is needed to investigate real API permissions, provider validation, eventual consistency, service behavior, cleanup, and costs. Such a lab needs its own isolated target and authorization; mock fixtures cannot establish that the lab is safe or that a production change will succeed. Record exactly which evidence comes from each layer rather than merging all green checks into one claim.
Interpret failures and preserve the evidence boundary
When a test fails, first distinguish a configuration or provider-mapping error from an assertion mismatch and from an expected negative validation outcome. Record the run name, inputs, selected provider configurations, command stage, expected result, and observed diagnostic without exposing secrets. A test may fail before it reaches the assertion, so a failure alone does not prove the assertion detected the intended defect. Repair the fixture or configuration only after identifying the failing boundary.
After a test passes, report its version, fixture, stage and actual assertions, together with unresolved integration and service checks. A mock can be valuable even when it covers only a narrow contract because it makes that contract repeatable and reviewable. Its limits matter equally: generated values do not prove real identifier formats, plan success does not prove apply, and synthetic provider results do not prove operational recovery. No test, provider, Terraform command, credential, or infrastructure operation was executed for these examples.
20 worked examples
1. Plan output contract
Problem: A mocked plan receives service_name=atlas and should expose that name. What does a passing equality assertion establish?
- The fixture binds the assertion to a concrete input and expected output.
- A pass supports that output contract in this mocked plan, not real service creation.
run=plan
input service_name=atlas
assert output.name == atlas
provider=mocked
This fictional record is not an executed Terraform test or a real provider result.
Expected result: Report the asserted plan contract only.
Why this result follows: The assertion observes a caller-visible value under stated synthetic conditions.
2. Mocked ID format
Problem: A mock supplies id=example-id and the assertion passes. Does this establish a real provider ID format?
- The identifier is supplied by the fixture rather than returned by a service.
- Equality can test propagation but cannot validate the real API format.
mock id=example-id
assert output.id == example-id
real API=not contacted
This fictional record is not an executed Terraform test or a real provider result.
Expected result: Report value propagation and leave real format unverified.
Why this result follows: Synthetic values demonstrate module behavior, not remote acceptance.
3. Unknown at plan
Problem: A plan assertion expects a known endpoint, but the endpoint remains unknown. Can equality be reported as passed?
- The value is not established at this stage.
- An unknown is not evidence of equality or of a real service failure.
stage=plan
endpoint=unknown
expected=api.example.test
This fictional record is not an executed Terraform test or a real provider result.
Expected result: Review fixture and stage; do not claim the equality passed.
Why this result follows: Assertions require evidence for the value they compare.
4. Mixed provider mappings
Problem: A file has a mock and a real alias; run B maps to the real alias. Is the file fully mocked?
- The mock used by A does not replace the mapping selected by B.
- The real alias and credentials require separate authorization and isolation review.
run A provider=mock
run B provider=real alias
credentials=unknown
This fictional record is not an executed Terraform test or a real provider result.
Expected result: Treat run B as potentially real and resolve its environment before execution.
Why this result follows: Provider selection is evaluated for each run.
5. Expected validation failure
Problem: An invalid name should fail validation, but the run fails first because the provider mapping is missing. Did it test validation?
- The mapping error occurs before the intended validation evidence.
- Any failure is not equivalent to the specified diagnostic.
input name=invalid
expected=validation error
observed=missing provider mapping
This fictional record is not an executed Terraform test or a real provider result.
Expected result: Correct the mapping and separately verify the intended validation result.
Why this result follows: A negative test must fail for the expected reason.
6. Tautological assertion
Problem: A test asserts output.name equals output.name. Can it detect an ignored input?
- Both sides use the same output regardless of the input.
- The assertion can pass even if the module always returns a constant.
input name=atlas
assert output.name == output.name
module output=constant
This fictional record is not an executed Terraform test or a real provider result.
Expected result: Compare output.name to the concrete expected value derived from the input.
Why this result follows: An assertion must distinguish correct and incorrect behavior.
7. Stable mock data
Problem: A module should return a data-source endpoint, but a generated string varies across runs. How can the test assert propagation?
- The generated value does not provide a stable expected fixture for the intended comparison.
- Supply a deliberate synthetic endpoint through the documented mock mechanism and compare the output.
data source endpoint=generated string
expected endpoint=unstable
contract=return endpoint
This fictional record is not an executed Terraform test or a real provider result.
Expected result: Use a stable fixture and assert the matching module output.
Why this result follows: Controlled data makes the contract comparison meaningful.
8. Plan versus apply
Problem: A mock plan test passes for an output. Does it prove real apply and readiness?
- The run examined planning with synthetic provider behavior.
- Neither real apply nor readiness was observed by the assertion.
command=plan
provider=mock
output assertion=pass
service readiness=not tested
This fictional record is not an executed Terraform test or a real provider result.
Expected result: Limit the report to the mocked plan assertion.
Why this result follows: A test stage cannot prove stages it did not exercise.
9. Boundary input
Problem: A name contract permits 3 through 8 characters. Which synthetic values exercise both edges?
- The first two inputs sit exactly on the declared inclusive limits.
- The two-character input is outside the lower bound and should produce the intended validation outcome.
minimum=3
maximum=8
inputs=abc, abcdefgh, ab
This fictional record is not an executed Terraform test or a real provider result.
Expected result: Expect the first two valid and the last invalid, subject to the actual rule.
Why this result follows: Boundary and counterexample cases distinguish inclusive limits from outside values.
10. Transformation rather than fixture echo
Problem: A module should prefix an input with svc-. The fixture input is atlas and output is atlas. What should an assertion expect?
- The documented transformation requires combining the prefix with the supplied input.
- The observed value lacks that prefix and should fail a contract assertion.
input=atlas
contract=prefix svc-
observed output=atlas
This fictional record is not an executed Terraform test or a real provider result.
Expected result: Expect svc-atlas and investigate the incorrect output.
Why this result follows: A concrete expected transformation detects an omitted operation.
11. Synthetic data versus DNS
Problem: A mock returns api.example.test and the output assertion passes. Has DNS resolution been verified?
- The fixture supplies the string without contacting DNS.
- The assertion checks propagation, not whether the hostname resolves.
mock endpoint=api.example.test
output assertion=pass
DNS lookup=not run
This fictional record is not an executed Terraform test or a real provider result.
Expected result: Report the output result and leave DNS unverified.
Why this result follows: Mock data has no inherent network evidence.
12. Wrong alias on a run
Problem: A test intends a mock for both regions, but one run maps the second configuration to a real alias. What review outcome follows?
- The secondary mapping differs from the intended isolation boundary.
- A real alias may use real credentials or operations, depending on the setup.
intended primary=mock, secondary=mock
actual secondary=real alias
This fictional record is not an executed Terraform test or a real provider result.
Expected result: Stop and correct or explicitly authorize the mapping before execution.
Why this result follows: An intended mock does not override an explicit real mapping.
13. Assertion not reached
Problem: A run reports a syntax error before evaluating its output assertion. What does the failure show?
- The configuration fails before the assertion can inspect the output.
- The failure therefore cannot demonstrate that the assertion catches the intended mismatch.
configuration=parse error
output assertion=not reached
expected=output mismatch
This fictional record is not an executed Terraform test or a real provider result.
Expected result: Fix the syntax issue and rerun only in an approved test environment.
Why this result follows: A diagnostic identifies the boundary actually reached.
14. Mocked apply limitation
Problem: A simulated apply succeeds and returns an output. Does it prove cloud permissions?
- The mock supplies simulated provider behavior rather than exercising cloud authorization.
- Permission evidence requires an appropriately authorized separate integration check.
command=apply
provider=mock
result=pass
real credentials=not used
This fictional record is not an executed Terraform test or a real provider result.
Expected result: Report mocked apply behavior and leave real permissions unverified.
Why this result follows: Synthetic provider success is not an API authorization result.
15. Two input cases
Problem: A module returns a normalized name. Test cases use Atlas and BETA with expected atlas and beta. What defect can they reveal?
- Each case supplies a distinct mixed-case input and a concrete lower-case result.
- A constant output or omitted normalization fails at least one expected comparison.
input Atlas -> expected atlas
input BETA -> expected beta
This fictional record is not an executed Terraform test or a real provider result.
Expected result: Check both outputs independently against their expected strings.
Why this result follows: Multiple inputs make an ignored-input implementation observable.
16. Mock fixture hides a defect
Problem: A test sets both a computed attribute and expected output to the same constant, but the module never uses its input. What is missing?
- The fixed expected value does not establish any relationship to the input.
- A second input with a different required result would expose an ignored-input defect.
input=atlas
mock output=fixed
expected=fixed
This fictional record is not an executed Terraform test or a real provider result.
Expected result: Add an independent input-output contract case.
Why this result follows: Fixture agreement alone can conceal missing module logic.
17. Missing credentials boundary
Problem: A test run is mapped to a real provider and its credential source is not known. Can it be called offline?
- A real provider can interact with external systems depending on configuration and operation.
- Unknown credentials and network controls do not establish offline isolation.
provider mapping=real
credential source=unknown
network policy=unknown
This fictional record is not an executed Terraform test or a real provider result.
Expected result: Do not execute until the real mapping and environment are reviewed.
Why this result follows: Isolation must be established for the actual execution path.
18. Integration evidence
Problem: A mock test passes, but a lab test reports permission denied. Which result describes real permissions?
- The mock result covers its synthetic assertion and did not exercise the real permission.
- The lab diagnostic is evidence of the permission failure in that lab context.
mock assertion=pass
lab API result=permission denied
lab target=isolated
This fictional record is not an executed Terraform test or a real provider result.
Expected result: Investigate the lab identity and scope; keep the mock result separate.
Why this result follows: Independent evidence layers answer different testing and operational questions.
19. Sensitive diagnostic
Problem: A failing test log includes a credential value alongside the run name. What should the report retain?
- The run identifier helps diagnosis but the credential is sensitive.
- Follow the exposure process and retain a sanitized diagnostic with scope and timing.
run=contract_check
diagnostic=credential exposed
log audience=wide
This fictional record is not an executed Terraform test or a real provider result.
Expected result: Remove or restrict exposed material and report without the secret.
Why this result follows: Useful evidence can be preserved without repeating sensitive values.
20. Service acceptance
Problem: A mocked module test verifies an endpoint output, while an authorized service health check has not run. Is readiness established?
- The output assertion verifies a synthetic contract, not a running service.
- Without a health observation, readiness remains unverified.
mock output assertion=pass
health check=not run
service readiness=unknown
This fictional record is not an executed Terraform test or a real provider result.
Expected result: Report the mock pass and the missing service check separately.
Why this result follows: A value contract is not a service acceptance test.
Common errors and fixes
A mocked identifier is treated as a real service identifier
- Why it happens
- Computed mock data is generated from schema, not the service.
- How to fix it
- Use explicit test data and validate real formats in an authorized integration test.
- Prevent it next time
- Document mock and integration boundaries.
A test file is assumed fully mocked
- Why it happens
- A run may use a real provider configuration.
- How to fix it
- Inspect provider mappings and every run before execution.
- Prevent it next time
- Separate real integration tests and restrict credentials.
A passing plan test is treated as apply verification
- Why it happens
- Planning and application exercise different behavior.
- How to fix it
- Test the required lifecycle separately in a bounded lab.
- Prevent it next time
- Name the stage and assertions in the result.
20 practice exercises
1. A mock returns an arbitrary string for a computed ID. Does it prove the API will accept that format?
Show hint
Separate a generated schema-level value from an API response.
Show worked solution
No. The mock follows schema-level test behavior; use an authorized integration test for real API constraints.
An arbitrary computed string from a mock can help test how the module handles an identifier, but it is not evidence that a real API accepts the format. Use deliberate synthetic values for contract assertions and a separately authorized integration test to investigate actual provider and API constraints.
Check your solution
- Identify the ID as mock-generated synthetic data.
- Leave actual API format acceptance to independent evidence.
2. A test file contains mocked and real provider aliases. What must be reviewed?
Show hint
Inspect the selected mapping for every run, not just the presence of a mock.
Show worked solution
Inspect each run’s provider mapping and credentials, and keep any real-resource operation within an approved isolated lab.
A test file can contain both mocked and real provider aliases. Review each run’s mapping, credentials, target, command stage and external interactions; an authorized isolated lab is needed for any real-resource operation. Do not assume the whole file is offline because one alias is mocked.
Check your solution
- Identify any run mapped to a real alias.
- Review credentials, target and authorization before execution.
3. A module accepts environment=stage and returns a label. Its contract requires label=env:stage. Design a mock-plan assertion and state its limit.
Show hint
Use a concrete expected caller-visible result.
Show worked solution
Supply stage as input and assert that the output equals env:stage in the mocked plan. The result tests this transformation under the selected fixture; it does not prove a provider applied resources or that the staging environment exists.
Check your solution
- The expected output is env:stage.
- The conclusion is limited to the mocked plan contract.
4. A test file contains two runs: one maps both providers to mocks; the other maps a database alias to a real provider. Prepare a pre-execution review.
Show hint
Inspect mappings per run rather than per file.
Show worked solution
Record the provider mapping and command stage for each run, then investigate the real alias, credentials, target, network access and authorization. Do not execute the second run until its real-resource boundary is approved and isolated appropriately.
Check your solution
- The real alias is identified in the second run.
- Credentials and target are reviewed before execution.
5. A module reads a primary and a backup data source through two provider aliases. Both mock fixtures accidentally return zone-a, so a swapped alias could pass. Design fixtures and assertions that expose the swap.
Show hint
Give the two aliases distinct deterministic values.
Show worked solution
Configure the primary fixture to return zone-a and backup to return zone-b, then assert the corresponding primary and backup outputs separately. A swapped mapping produces zone-b and zone-a in the wrong positions and fails; this verifies mapping under mocks, not real provider access.
Check your solution
- The expected primary output is zone-a and backup output is zone-b.
- Swapping aliases fails at least one assertion without contacting a real provider.
6. A module must reject an empty name. A test fails because its test file has malformed syntax. Does the failure satisfy the negative case?
Show hint
Check whether the intended validation was reached.
Show worked solution
No. A syntax error occurs before the expected validation diagnostic and therefore provides no evidence for the empty-name rule. Correct the test configuration and verify that the intended validation fails for the empty input in an approved test environment.
Check your solution
- The syntax error is distinguished from validation.
- The expected diagnostic is checked after correcting the fixture.
7. A module concatenates a prefix and name. Inputs prefix=app- and name=ledger should yield app-ledger, but a test only asserts that output is nonempty. Improve the assertion.
Show hint
A nonempty value can still be wrong.
Show worked solution
Assert the exact output app-ledger for the concrete inputs and add another input with a different expected result. The second case can expose a constant output, while neither case demonstrates provider behavior outside the mocked test.
Check your solution
- The first expected output is app-ledger.
- A second case changes inputs and expected output.
8. A plan-mode test checks an attribute that remains unknown until a later stage. How should a reviewer interpret the result and improve the test design?
Show hint
Unknown is not a confirmed value.
Show worked solution
Do not report equality or a real failure from the unknown value. Determine whether documented mock data can make the relevant attribute known at plan or whether an appropriately isolated later-stage test is needed; report the stage and any unresolved limitation.
Check your solution
- Unknown is not treated as a passing comparison.
- The revised design states its stage and isolation boundary.
9. A mock returns a public-looking IP string, and the module output matches it. The report says the service is reachable. Correct the report.
Show hint
String equality is not a network check.
Show worked solution
Report that the module exposed the synthetic IP string under the mock and that reachability was not tested. A separately authorized integration or service check would be required to support a claim about an actual endpoint.
Check your solution
- The result is described as synthetic output propagation.
- Real reachability remains unverified.
10. A test expects three resource names in a list, but it compares only the list length. Give an incorrect result that would pass and propose a stronger check.
Show hint
A count does not establish contents.
Show worked solution
A list containing three unrelated names would pass the length check. Compare the expected names or set according to the contract, and test duplicates or ordering if those properties matter; document which properties the assertion actually covers.
Check your solution
- An incorrect three-item list can pass the original assertion.
- The revised check verifies the required contents.
11. A mock test’s expected-failure case produces the right validation error, while its valid case also fails for the same reason. What should be investigated?
Show hint
A negative case needs a contrasting valid case.
Show worked solution
Inspect the validation condition and valid fixture because the rule may reject all inputs or the fixture may violate another requirement. Preserve both diagnostics and verify that the valid case passes and the invalid case fails for the intended reason.
Check your solution
- The valid failure is not ignored.
- The final tests distinguish valid and invalid inputs.
12. A test passes with an arbitrary computed ID; a teammate wants to use that ID in a real deployment. Explain the risk and the correct boundary.
Show hint
Generated mock values are not service identities.
Show worked solution
Do not use the synthetic ID as a real resource identifier. Record that the mock checked the module’s handling of a string, and obtain any actual identifier through an authorized real workflow rather than promoting test data into deployment configuration.
Check your solution
- The synthetic identifier is not used as a real target.
- The test result is limited to module behavior.
13. A module maps an input size small to output capacity 2 and large to 8. Design two assertions that catch an implementation always returning 2.
Show hint
Use inputs that require different outcomes.
Show worked solution
Assert capacity 2 for small and capacity 8 for large using explicit fixtures. An implementation that always returns 2 passes the first but fails the second, revealing the defect without claiming anything about real provider capacity.
Check your solution
- The two expected values are 2 and 8.
- The constant-output implementation fails the large case.
14. A test run fails before an assertion because a module input is misspelled. The team labels it a provider failure. What diagnostic sequence is appropriate?
Show hint
Find the earliest actual failure boundary.
Show worked solution
Inspect the error and selected module interface, correct the input name, and then review the resulting assertion or provider diagnostic. Keep the original failure record; an input configuration error does not establish a provider defect.
Check your solution
- The misspelled input is identified as configuration failure.
- The assertion is not claimed to have run before correction.
15. A mock test passes but the provider version used in a later integration lab differs. What should the evidence record contain?
Show hint
The environment is part of the result’s scope.
Show worked solution
Record the Terraform and provider versions, fixture, run stage and assertions for the mock, and separately record the lab versions and actual observations. Investigate compatibility differences before generalizing either result; neither automatically validates the other environment.
Check your solution
- Both environments and versions are recorded separately.
- The mock pass is not generalized to a different provider version.
16. A test fixture hardcodes the expected output and bypasses the module’s input-to-output transformation. How can a reviewer reveal the missing logic?
Show hint
Change the input and predict an independently derived result.
Show worked solution
Choose at least two inputs that should yield different outputs under the documented contract, derive the expectations independently, and assert both. If the output remains the hardcoded value, the changed case exposes the missing transformation.
Check your solution
- The inputs require distinct expected outputs.
- A hardcoded output fails at least one comparison.
17. A module’s invalid-input test fails as expected but its diagnostic contains a secret. What should the test report and incident handoff include?
Show hint
Preserve useful evidence without copying the secret.
Show worked solution
Record the run, expected validation category and sanitized diagnostic, then follow the approved exposure response and restrict affected logs. Review the fixture so future tests use synthetic values; do not repeat the secret in the report.
Check your solution
- The report retains a sanitized diagnostic and run identity.
- The exposed secret is handled through the approved process.
18. A module test uses a mock for one provider but a real external data source for another. The team calls it completely offline. What must be checked?
Show hint
A mock does not cover unrelated providers or processes.
Show worked solution
Inspect every provider mapping, data source, external process, credential and network path for the actual run. Treat the real data source as a possible external interaction until its behavior and isolation are established, and do not execute an unclear setup.
Check your solution
- The second provider and data source are reviewed.
- Offline status is not inferred from one mocked provider.
19. A test asserts a list of tags equals ["team:ops", "env:test"]. The module returns the same tags in reverse order. Decide what to review before changing the assertion.
Show hint
Determine whether order belongs to the contract.
Show worked solution
If the contract promises ordered output, the reversed result is a defect; if tags are explicitly unordered, compare the appropriate collection contents instead. Document the chosen semantics and still verify both required tags rather than weakening the assertion to a count.
Check your solution
- The decision follows the documented ordering contract.
- Both tag values remain checked.
20. A team reports one green mock test as proof that a new service is ready for production. Draft a precise replacement statement.
Show hint
Separate tested behavior from untested service outcomes.
Show worked solution
State the run, Terraform and provider versions, mocked mapping, inputs, stage and assertions that passed. Explicitly leave real API behavior, access permissions, deployment, readiness and recovery unverified until separate authorized evidence supports each claim.
Check your solution
- The statement names the actual mock scope.
- Real deployment and readiness are not claimed from the mock.
Key takeaways
- Mocks test defined contracts under synthetic provider behavior.
- A test can mix mocked and real providers.
- Integration and recovery evidence remain separate.
- Generated mock attributes are synthetic values, not proof of real API formats or permissions.
- Review provider mappings and credentials for every run, especially where real aliases coexist.
- Plan, mocked apply, integration and service acceptance each provide distinct evidence.