Difference between revisions of "Terraform test"
Jump to navigation
Jump to search
Line 3: | Line 3: | ||
* terraform test: Providers, modules, resources, and [[data sources]] can now be mocked during executions of terraform test. The following new blocks have been introduced within [[.tftest.hcl]] files: | * terraform test: Providers, modules, resources, and [[data sources]] can now be mocked during executions of terraform test. The following new blocks have been introduced within [[.tftest.hcl]] files: | ||
− | ** mock_provider: Can replace provider instances with mocked providers, allowing tests to execute in command = apply mode without requiring a configured cloud provider account and credentials. Terraform will create fake resources for mocked providers and maintain them in state for the lifecycle of the given test file. | + | ** <code>mock_provider</code>: Can replace provider instances with mocked providers, allowing tests to execute in command = apply mode without requiring a configured cloud provider account and credentials. Terraform will create fake resources for mocked providers and maintain them in state for the lifecycle of the given test file. |
− | ** override_resource: Specific resources can be overridden so Terraform will create a fake resource with custom values instead of creating infrastructure for the overridden resource. | + | ** <code>override_resource</code>: Specific resources can be overridden so Terraform will create a fake resource with custom values instead of creating infrastructure for the overridden resource. |
− | ** [[override_data]]: Specific data sources can be overridden so data can be imported into tests without requiring real infrastructure to be created externally first. | + | ** <code>[[override_data]]</code>: Specific data sources can be overridden so data can be imported into tests without requiring real infrastructure to be created externally first. |
** [[override_module]]: Specific modules can be overridden in their entirety to give greater control over the returned outputs without requiring in-depth knowledge of the module itself. | ** [[override_module]]: Specific modules can be overridden in their entirety to give greater control over the returned outputs without requiring in-depth knowledge of the module itself. | ||
Revision as of 10:51, 7 February 2024
- terraform test: Providers, modules, resources, and data sources can now be mocked during executions of terraform test. The following new blocks have been introduced within .tftest.hcl files:
mock_provider
: Can replace provider instances with mocked providers, allowing tests to execute in command = apply mode without requiring a configured cloud provider account and credentials. Terraform will create fake resources for mocked providers and maintain them in state for the lifecycle of the given test file.override_resource
: Specific resources can be overridden so Terraform will create a fake resource with custom values instead of creating infrastructure for the overridden resource.override_data
: Specific data sources can be overridden so data can be imported into tests without requiring real infrastructure to be created externally first.- override_module: Specific modules can be overridden in their entirety to give greater control over the returned outputs without requiring in-depth knowledge of the module itself.
Related
See also
Advertising: