Difference between revisions of "Terraform test"
Jump to navigation
Jump to search
(One intermediate revision by the same user not shown) | |||
Line 2: | Line 2: | ||
− | * 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: | + | * <code>terraform test</code>: 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: |
** <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. | ** <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. | ||
** <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. | ** <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. | ||
** <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. | ** <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. | ||
** <code>[[override_module]]</code>: 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. | ** <code>[[override_module]]</code>: 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. | ||
+ | |||
+ | == Activities == | ||
+ | * [[Terraform v1.7]] https://github.com/hashicorp/terraform/blob/v1.7/CHANGELOG.md#170-january-17-2024 | ||
Latest revision as of 14:03, 3 July 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.
Activities[edit]
Related[edit]
See also[edit]
Advertising: