diff --git a/CHANGELOG.rst b/CHANGELOG.rst index defd47ec..617bf814 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,42 @@ The cloud.terraform collection Release Notes .. contents:: Topics +v2.0.0 +====== + +Breaking Changes / Porting Guide +-------------------------------- + +- Remove support for ansible-core < 2.14 (https://github.com/ansible-collections/cloud.terraform/pull/102). + + +Major Changes +------------- + +- terraform_provider - Added ``search_child_modules`` option (https://github.com/ansible-collections/cloud.terraform/pull/55). +- terraform_provider - Allow ``project_path`` in terraform_provider inventory plugin to accept a list of paths (https://github.com/ansible-collections/cloud.terraform/pull/55). + +Minor Changes +------------- + +- Removed integration tests workaround in terrform_provider. (https://github.com/ansible-collections/cloud.terraform/pull/84) +- Set default of ``state_file`` in terraform_provider inventory plugin to a blank string (https://github.com/ansible-collections/cloud.terraform/pull/55). +- terraform - add support for ``workspace`` when running ``terraform output`` (https://github.com/ansible-collections/cloud.terraform/issues/85). +- terraform_output - add support for ``workspace`` when running ``terraform output`` (https://github.com/ansible-collections/cloud.terraform/issues/85). +- tf_output - add support for ``workspace`` when running ``terraform output`` (https://github.com/ansible-collections/cloud.terraform/issues/85). +- terraform - cleanup temporary file create during module execution. (https://github.com/ansible-collections/cloud.terraform/issues/2) + + +Bugfixes +-------- + +- module_utils - Accept Terraform executables present on PATH passed in as ``binary_path`` without specifying their absolute path. (https://github.com/ansible-collections/cloud.terraform/issues/49) +- module_utils - Allow ``nested_type`` attribute in terraform schema. (https://github.com/ansible-collections/cloud.terraform/issues/93) +- module_utils - Fix AWS SQS queue creation. The ``values`` attribute in terraform output is optional. SQS is one of (rare) cases where ``values`` is absent. (https://github.com/ansible-collections/cloud.terraform/issues/86) +- terraform - fix spaces between characters in command field in result (https://github.com/ansible-collections/cloud.terraform/pull/76). +- move test requirements out of the requirements.txt file (https://github.com/ansible-collections/cloud.terraform/pull/67). +- terraform - fix issue with ``plan_file`` option specified with ``check_mode=true`` and ``state`` set to one of ``present`` and ``absent``, the module is enable now to generate a Terraform file to the specified location (https://github.com/ansible-collections/cloud.terraform/issues/87). + v1.1.0 ====== diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index 192f82bf..022d0c9e 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -70,3 +70,40 @@ releases: name: terraform_provider namespace: null release_date: '2023-03-23' + 2.0.0: + changes: + breaking_changes: + - Remove support for ansible-core < 2.14 (https://github.com/ansible-collections/cloud.terraform/pull/102). + bugfixes: + - module_utils - Accept Terraform executables present on PATH passed in as ``binary_path`` without specifying their absolute path. (https://github.com/ansible-collections/cloud.terraform/issues/49) + - module_utils - Allow ``nested_type`` attribute in terraform schema. (https://github.com/ansible-collections/cloud.terraform/issues/93) + - module_utils - Fix AWS SQS queue creation. The ``values`` attribute in terraform output is optional. SQS is one of (rare) cases where ``values`` is absent. (https://github.com/ansible-collections/cloud.terraform/issues/86) + - terraform - fix spaces between characters in command field in result (https://github.com/ansible-collections/cloud.terraform/pull/76). + - move test requirements out of the requirements.txt file (https://github.com/ansible-collections/cloud.terraform/pull/67). + - terraform - fix issue with ``plan_file`` option specified with ``check_mode=true`` and ``state`` set to one of ``present`` and ``absent``, the module is enable now to generate a Terraform file to the specified location (https://github.com/ansible-collections/cloud.terraform/issues/87). + major_changes: + - terraform_provider - Added ``search_child_modules`` option (https://github.com/ansible-collections/cloud.terraform/pull/55). + - terraform_provider - Allow ``project_path`` in terraform_provider inventory plugin to accept a list of paths (https://github.com/ansible-collections/cloud.terraform/pull/55). + minor_changes: + - Removed integration tests workaround in terrform_provider. (https://github.com/ansible-collections/cloud.terraform/pull/84) + - Set default of ``state_file`` in terraform_provider inventory plugin to a blank string (https://github.com/ansible-collections/cloud.terraform/pull/55). + - terraform - add support for ``workspace`` when running ``terraform output`` (https://github.com/ansible-collections/cloud.terraform/issues/85). + - terraform_output - add support for ``workspace`` when running ``terraform output`` (https://github.com/ansible-collections/cloud.terraform/issues/85). + - tf_output - add support for ``workspace`` when running ``terraform output`` (https://github.com/ansible-collections/cloud.terraform/issues/85). + - terraform - cleanup temporary file create during module execution. (https://github.com/ansible-collections/cloud.terraform/issues/2) + fragments: + - 20230524-aws_integration_tests.yml + - 20230913-add-support-for-workspace-when-running-terraform_output.yml + - 20230914-fix-integration-target-terraform_provider.yml + - 20231016-fix-terraform-plan_file-option.yml + - 20231025-fix-aws-sqs.yml + - 20231109-update-supported-ansible-versions.yaml + - 20231110-allow-nested_type-attributes.yml + - 49-command_name_in_binary_path.yaml + - 67-test-requirements.yml + - 76-fix_command_spaces_in_output.yml + - inventory_parse_options.yaml + - standardize_requirements.yml + - terraform-cleanup-file.yml + - terraform_provider_remove_workaround.yml + release_date: '2023-11-17' diff --git a/changelogs/config.yaml b/changelogs/config.yaml index 575777ae..ba599c75 100644 --- a/changelogs/config.yaml +++ b/changelogs/config.yaml @@ -9,12 +9,12 @@ notesdir: fragments prelude_section_name: release_summary prelude_section_title: Release Summary sections: + - - breaking_changes + - Breaking Changes / Porting Guide - - major_changes - Major Changes - - minor_changes - Minor Changes - - - breaking_changes - - Breaking Changes / Porting Guide - - deprecated_features - Deprecated Features - - removed_features diff --git a/changelogs/fragments/20230524-aws_integration_tests.yml b/changelogs/fragments/20230524-aws_integration_tests.yml deleted file mode 100644 index 8b786c12..00000000 --- a/changelogs/fragments/20230524-aws_integration_tests.yml +++ /dev/null @@ -1,2 +0,0 @@ -trivial: - - "Stabilize aws integration tests." diff --git a/changelogs/fragments/20230913-add-support-for-workspace-when-running-terraform_output.yml b/changelogs/fragments/20230913-add-support-for-workspace-when-running-terraform_output.yml deleted file mode 100644 index 63da4e8a..00000000 --- a/changelogs/fragments/20230913-add-support-for-workspace-when-running-terraform_output.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -minor_changes: - - add support for workspace when running `terraform output` in modules `cloud.terraform.terraform`, `cloud.terraform.terraform_output` and lookup - `cloud.terraform.tf_output` (https://github.com/ansible-collections/cloud.terraform/issues/85). diff --git a/changelogs/fragments/20230914-fix-integration-target-terraform_provider.yml b/changelogs/fragments/20230914-fix-integration-target-terraform_provider.yml deleted file mode 100644 index 11e2a1a3..00000000 --- a/changelogs/fragments/20230914-fix-integration-target-terraform_provider.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -bugfixes: - - fix integration test target `terraform_provider`, add step to copy example modules into terraform working directory - (https://github.com/ansible-collections/cloud.terraform/pull/89). diff --git a/changelogs/fragments/20231016-fix-terraform-plan_file-option.yml b/changelogs/fragments/20231016-fix-terraform-plan_file-option.yml deleted file mode 100644 index 93f11785..00000000 --- a/changelogs/fragments/20231016-fix-terraform-plan_file-option.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -bugfixes: - - terraform - fix issue with ``plan_file`` option specified with ``check_mode=true`` and ``state`` set to one of ``present`` and ``absent``, - the module is enable now to generate a Terraform file to the specified location (https://github.com/ansible-collections/cloud.terraform/issues/87). diff --git a/changelogs/fragments/20231025-fix-aws-sqs.yml b/changelogs/fragments/20231025-fix-aws-sqs.yml deleted file mode 100644 index 211b42f2..00000000 --- a/changelogs/fragments/20231025-fix-aws-sqs.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -bugfixes: - - >- - Fix AWS SQS queue creation. - The `values` attribute in terraform output is optional. - SQS is one of (rare) cases where `values` is absent. - (https://github.com/ansible-collections/cloud.terraform/issues/86) diff --git a/changelogs/fragments/20231109-update-supported-ansible-versions.yaml b/changelogs/fragments/20231109-update-supported-ansible-versions.yaml deleted file mode 100644 index c8510239..00000000 --- a/changelogs/fragments/20231109-update-supported-ansible-versions.yaml +++ /dev/null @@ -1,5 +0,0 @@ ---- -breaking_changes: - - Remove support for ansible-core < 2.14 (https://github.com/ansible-collections/cloud.terraform/pull/102). -trivial: - - Update CI workflows and linter versions, fix related linting errors (https://github.com/ansible-collections/cloud.terraform/pull/102). diff --git a/changelogs/fragments/20231110-allow-nested_type-attributes.yml b/changelogs/fragments/20231110-allow-nested_type-attributes.yml deleted file mode 100644 index 8cd1415a..00000000 --- a/changelogs/fragments/20231110-allow-nested_type-attributes.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -bugfixes: - - >- - Allow `nested_type` attributes in terraform schema. - (https://github.com/ansible-collections/cloud.terraform/issues/93) diff --git a/changelogs/fragments/49-command_name_in_binary_path.yaml b/changelogs/fragments/49-command_name_in_binary_path.yaml deleted file mode 100644 index 28bd5d81..00000000 --- a/changelogs/fragments/49-command_name_in_binary_path.yaml +++ /dev/null @@ -1,4 +0,0 @@ ---- -bugfixes: - - Accept Terraform executables present on PATH passed in as binary_path without specifying their absolute path. - (https://github.com/ansible-collections/cloud.terraform/issues/49) diff --git a/changelogs/fragments/67-test-requirements.yml b/changelogs/fragments/67-test-requirements.yml deleted file mode 100644 index 395f7a60..00000000 --- a/changelogs/fragments/67-test-requirements.yml +++ /dev/null @@ -1,2 +0,0 @@ -bugfixes: - - move test requirements out of the requirements.txt file (https://github.com/ansible-collections/cloud.terraform/pull/67). diff --git a/changelogs/fragments/76-fix_command_spaces_in_output.yml b/changelogs/fragments/76-fix_command_spaces_in_output.yml deleted file mode 100644 index 9797161d..00000000 --- a/changelogs/fragments/76-fix_command_spaces_in_output.yml +++ /dev/null @@ -1,2 +0,0 @@ -bugfixes: - - fix spaces between characters in command field in result (https://github.com/ansible-collections/cloud.terraform/pull/76). diff --git a/changelogs/fragments/inventory_parse_options.yaml b/changelogs/fragments/inventory_parse_options.yaml deleted file mode 100644 index e3217084..00000000 --- a/changelogs/fragments/inventory_parse_options.yaml +++ /dev/null @@ -1,5 +0,0 @@ -major_changes: - - Added search_child_modules option to terraform_provider inventory plugin. - - Allow project_path in terraform_provider inventory plugin to accept a list of paths. -minor_changes: - - Set default of state_file in terraform_provider inventory plugin to a blank string. diff --git a/changelogs/fragments/standardize_requirements.yml b/changelogs/fragments/standardize_requirements.yml deleted file mode 100644 index 0743063f..00000000 --- a/changelogs/fragments/standardize_requirements.yml +++ /dev/null @@ -1,2 +0,0 @@ -trivial: - - "As per https://github.com/ansible-community/community-topics/issues/230, standardize tests/requirements.yml file." diff --git a/changelogs/fragments/terraform-cleanup-file.yml b/changelogs/fragments/terraform-cleanup-file.yml deleted file mode 100644 index fd448a5c..00000000 --- a/changelogs/fragments/terraform-cleanup-file.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -minor_changes: - - terraform - cleanup temporary file create during module execution. (https://github.com/ansible-collections/cloud.terraform/issues/2) diff --git a/changelogs/fragments/terraform_provider_remove_workaround.yml b/changelogs/fragments/terraform_provider_remove_workaround.yml deleted file mode 100644 index 2ea0f89d..00000000 --- a/changelogs/fragments/terraform_provider_remove_workaround.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -minor_changes: - - Removed integration tests workaround in terrform_provider. (https://github.com/ansible-collections/cloud.terraform/pull/84) diff --git a/docs/cloud.terraform.terraform_module.rst b/docs/cloud.terraform.terraform_module.rst index 2bda46ae..9436d478 100644 --- a/docs/cloud.terraform.terraform_module.rst +++ b/docs/cloud.terraform.terraform_module.rst @@ -254,8 +254,9 @@ Parameters -
The path to an existing Terraform plan file to apply. If this is not specified, Ansible will build a new TF plan and execute it.
-
Note that this option is required if 'state' has the 'planned' value. In this case, the plan file is only generated, but not applied.
+
The path to a Terraform plan file to apply or generate.
+
When 'check_mode' is set to True or state=planned, a Terraform plan file with be generated and saved into the specified location.
+
When 'check_mode' is set to False and state is set to either present or absent, The existing Terraform plan file will be applied.
diff --git a/docs/cloud.terraform.terraform_output_module.rst b/docs/cloud.terraform.terraform_output_module.rst index 16536905..8995e0d4 100644 --- a/docs/cloud.terraform.terraform_output_module.rst +++ b/docs/cloud.terraform.terraform_output_module.rst @@ -127,6 +127,22 @@ Parameters
The TF_DATA_DIR environment variable is respected.
+ + +
+ workspace + +
+ string +
+
added in 1.2.0
+ + + + +
The terraform workspace to work with.
+ +
@@ -162,6 +178,11 @@ Examples name: individual_output format: raw + - name: List outputs from workspace 'dev' in project_dir + cloud.terraform.terraform_output: + project_path: project_dir + workspace: dev + Return Values diff --git a/docs/cloud.terraform.terraform_provider_inventory.rst b/docs/cloud.terraform.terraform_provider_inventory.rst index 0ae5fbdc..37a73a27 100644 --- a/docs/cloud.terraform.terraform_provider_inventory.rst +++ b/docs/cloud.terraform.terraform_provider_inventory.rst @@ -83,7 +83,7 @@ Parameters project_path
- path + raw
added in 1.1.0
@@ -93,8 +93,31 @@ Parameters
The path to the initialized Terraform directory with the .tfstate file.
-
If state_file is not specified, terraform.tfstate in project_path is used as an inventory source.
-
If state_file and project_path are not specified, terraform.tfstate file in the current working directory is used as an inventory source.
+
If state_file is not specified, Terraform will attempt to automatically find the state file in project_path for use as inventory source.
+
If state_file and project_path are not specified, Terraform will attempt to automatically find the state file in the current working directory.
+
Accepts a string or a list of paths for use with multiple Terraform projects.
+ + + + +
+ search_child_modules + +
+ boolean +
+
added in 1.2.0
+ + + + + + + +
Whether to include ansible_host and ansible_group resources from Terraform child modules.
@@ -113,8 +136,8 @@ Parameters
Path to an existing Terraform state file to be used as an inventory source.
-
If state_file is not specified, terraform.tfstate in project_path is used as an inventory source.
-
If state_file and project_path are not specified, terraform.tfstate file in the current working directory is used as an inventory source.
+
If state_file is not specified, Terraform will attempt to automatically find the state file in project_path for use as inventory source.
+
If state_file and project_path are not specified, Terraform will attempt to automatically find the state file in the current working directory
@@ -128,47 +151,54 @@ Examples .. code-block:: yaml - # Example configuration file inventory.yml, that creates an inventory from terraform.tfstate file in cwd - plugin: cloud.terraform.terraform_provider - # Running command `ansible-inventory -i inventory.yml --graph --vars` would then produce the inventory: - # @all: - # |--@anothergroup: - # | |--somehost - # | | |--{group_hello = from group!} - # | | |--{group_variable = 11} - # | | |--{host_hello = from host!} - # | | |--{host_variable = 7} - # |--@childlessgroup: - # |--@somegroup: - # | |--@anotherchild: - # | |--@somechild: - # | | |--anotherhost - # | | | |--{group_hello = from group!} - # | | | |--{group_variable = 11} - # | | | |--{host_hello = from anotherhost!} - # | | | |--{host_variable = 5} - # | |--somehost - # | | |--{group_hello = from group!} - # | | |--{group_variable = 11} - # | | |--{host_hello = from host!} - # | | |--{host_variable = 7} - # | |--{group_hello = from group!} - # | |--{group_variable = 11} - # |--@ungrouped: - # | |--ungrupedhost - - # Example configuration file that creates an inventory from terraform.tfstate file in selected project directory - plugin: cloud.terraform.terraform_provider - project_path: some/project/path - - # Example configuration file that creates an inventory from specified state file - plugin: cloud.terraform.terraform_provider - state_file: some/state/file/path - - # Example configuration file that creates an inventory from mycustomstate.tfstate file in selected project directory - plugin: cloud.terraform.terraform_provider - project_path: some/project/path - state_file: mycustomstate.tfstate + - name: Create an inventory from state file in current directory + plugin: cloud.terraform.terraform_provider + + # Running command `ansible-inventory -i inventory.yml --graph --vars` would then produce the inventory: + # @all: + # |--@anothergroup: + # | |--somehost + # | | |--{group_hello = from group!} + # | | |--{group_variable = 11} + # | | |--{host_hello = from host!} + # | | |--{host_variable = 7} + # |--@childlessgroup: + # |--@somegroup: + # | |--@anotherchild: + # | |--@somechild: + # | | |--anotherhost + # | | | |--{group_hello = from group!} + # | | | |--{group_variable = 11} + # | | | |--{host_hello = from anotherhost!} + # | | | |--{host_variable = 5} + # | |--somehost + # | | |--{group_hello = from group!} + # | | |--{group_variable = 11} + # | | |--{host_hello = from host!} + # | | |--{host_variable = 7} + # | |--{group_hello = from group!} + # | |--{group_variable = 11} + # |--@ungrouped: + # | |--ungrupedhost + + - name: Create an inventory from state file in provided directory + plugin: cloud.terraform.terraform_provider + project_path: some/project/path + + - name: Create an inventory from state file in multiple provided directories + plugin: cloud.terraform.terraform_provider + project_path: + - some/project/path + - some/other/project/path + + - name: Create an inventory from provided state file + plugin: cloud.terraform.terraform_provider + state_file: some/state/file/path + + - name: Create an inventory from state file in provided project directory + plugin: cloud.terraform.terraform_provider + project_path: some/project/path + state_file: mycustomstate.tfstate diff --git a/docs/cloud.terraform.tf_output_lookup.rst b/docs/cloud.terraform.tf_output_lookup.rst index 8e1bb2d6..67fa8db0 100644 --- a/docs/cloud.terraform.tf_output_lookup.rst +++ b/docs/cloud.terraform.tf_output_lookup.rst @@ -107,6 +107,24 @@ Parameters
The TF_DATA_DIR environment variable is respected.
+ + +
+ workspace + +
+ string +
+
added in 1.2.0
+ + + + + + +
The terraform workspace to work with.
+ +
@@ -130,6 +148,10 @@ Examples ansible.builtin.debug: msg: "{{ lookup('cloud.terraform.tf_output') }}" + - name: get all outputs from terraform.tfstate in workspace 'dev' + ansible.builtin.debug: + msg: "{{ lookup('cloud.terraform.tf_output', workspace='dev') }}" + Return Values diff --git a/galaxy.yml b/galaxy.yml index d13bdc0f..3f3350b8 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -2,7 +2,7 @@ namespace: cloud name: terraform -version: 1.1.0 +version: 3.0.0-dev0 readme: README.md authors: - Ansible (https://github.com/ansible)