Difference between revisions of "Terraform test"

From wikieduonline
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.
** [[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.
+
** <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.
  
  

Latest revision as of 10:52, 7 February 2024

wikipedia:terraform test


  • 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[edit]

See also[edit]

Advertising: