t*: normalize docs (#9339)

* t*: normalize docs

* Apply suggestions from code review

Co-authored-by: Felix Fontein <felix@fontein.de>

* break long line to regain sanity

---------

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Alexei Znamensky 2024-12-24 23:59:56 +13:00 committed by GitHub
parent c141f86883
commit 6e84c1375e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 109 additions and 134 deletions

View file

@ -8,13 +8,11 @@ from __future__ import absolute_import, division, print_function
__metaclass__ = type
DOCUMENTATION = r'''
---
DOCUMENTATION = r"""
module: terraform
short_description: Manages a Terraform deployment (and plans)
description:
- Provides support for deploying resources with Terraform and pulling
resource information back into Ansible.
- Provides support for deploying resources with Terraform and pulling resource information back into Ansible.
extends_documentation_fragment:
- community.general.attributes
attributes:
@ -27,18 +25,16 @@ options:
state:
choices: ['planned', 'present', 'absent']
description:
- Goal state of given stage/project
- Goal state of given stage/project.
type: str
default: present
binary_path:
description:
- The path of a terraform binary to use, relative to the 'service_path'
unless you supply an absolute path.
- The path of a C(terraform) binary to use, relative to the 'service_path' unless you supply an absolute path.
type: path
project_path:
description:
- The path to the root of the Terraform directory with the
vars.tf/main.tf/etc to use.
- The path to the root of the Terraform directory with the C(vars.tf)/C(main.tf)/etc to use.
type: path
required: true
plugin_paths:
@ -48,88 +44,80 @@ options:
- When set, the plugin discovery and auto-download behavior of Terraform is disabled.
- The directory structure in the plugin path can be tricky. The Terraform docs
U(https://learn.hashicorp.com/tutorials/terraform/automate-terraform#pre-installed-plugins)
show a simple directory of files, but actually, the directory structure
has to follow the same structure you would see if Terraform auto-downloaded the plugins.
See the examples below for a tree output of an example plugin directory.
show a simple directory of files, but actually, the directory structure has to follow the same structure you would see if Terraform auto-downloaded
the plugins. See the examples below for a tree output of an example plugin directory.
type: list
elements: path
version_added: 3.0.0
workspace:
description:
- The terraform workspace to work with. This sets the E(TF_WORKSPACE) environmental variable
that is used to override workspace selection. For more information about workspaces
have a look at U(https://developer.hashicorp.com/terraform/language/state/workspaces).
- The terraform workspace to work with. This sets the E(TF_WORKSPACE) environmental variable that is used to override workspace selection.
For more information about workspaces have a look at U(https://developer.hashicorp.com/terraform/language/state/workspaces).
type: str
default: default
purge_workspace:
description:
- Only works with state = absent
- Only works with state = absent.
- If true, the workspace will be deleted after the "terraform destroy" action.
- The 'default' workspace will not be deleted.
default: false
type: bool
plan_file:
description:
- 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.
- 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.
type: path
state_file:
description:
- The path to an existing Terraform state file to use when building plan.
If this is not specified, the default C(terraform.tfstate) will be used.
- The path to an existing Terraform state file to use when building plan. If this is not specified, the default C(terraform.tfstate) will
be used.
- This option is ignored when plan is specified.
type: path
variables_files:
description:
- The path to a variables file for Terraform to fill into the TF
configurations. This can accept a list of paths to multiple variables files.
- The path to a variables file for Terraform to fill into the TF configurations. This can accept a list of paths to multiple variables files.
type: list
elements: path
aliases: [ 'variables_file' ]
aliases: ['variables_file']
variables:
description:
- A group of key-values pairs to override template variables or those in variables files.
By default, only string and number values are allowed, which are passed on unquoted.
- A group of key-values pairs to override template variables or those in variables files. By default, only string and number values are
allowed, which are passed on unquoted.
- Support complex variable structures (lists, dictionaries, numbers, and booleans) to reflect terraform variable syntax when O(complex_vars=true).
- Ansible integers or floats are mapped to terraform numbers.
- Ansible strings are mapped to terraform strings.
- Ansible dictionaries are mapped to terraform objects.
- Ansible lists are mapped to terraform lists.
- Ansible booleans are mapped to terraform booleans.
- "B(Note) passwords passed as variables will be visible in the log output. Make sure to use C(no_log=true) in production!"
- B(Note) passwords passed as variables will be visible in the log output. Make sure to use C(no_log=true) in production!.
type: dict
complex_vars:
description:
- Enable/disable capability to handle complex variable structures for C(terraform).
- If V(true) the O(variables) also accepts dictionaries, lists, and booleans to be passed to C(terraform).
Strings that are passed are correctly quoted.
- If V(true) the O(variables) also accepts dictionaries, lists, and booleans to be passed to C(terraform). Strings that are passed are correctly
quoted.
- When disabled, supports only simple variables (strings, integers, and floats), and passes them on unquoted.
type: bool
default: false
version_added: 5.7.0
targets:
description:
- A list of specific resources to target in this plan/application. The
resources selected here will also auto-include any dependencies.
- A list of specific resources to target in this plan/application. The resources selected here will also auto-include any dependencies.
type: list
elements: str
default: []
lock:
description:
- Enable statefile locking, if you use a service that accepts locks (such
as S3+DynamoDB) to store your statefile.
- Enable statefile locking, if you use a service that accepts locks (such as S3+DynamoDB) to store your statefile.
type: bool
default: true
lock_timeout:
description:
- How long to maintain the lock on the statefile, if you use a service
that accepts locks (such as S3+DynamoDB).
- How long to maintain the lock on the statefile, if you use a service that accepts locks (such as S3+DynamoDB).
type: int
force_init:
description:
- To avoid duplicating infra, if a state file can't be found this will
force a C(terraform init). Generally, this should be turned off unless
- To avoid duplicating infra, if a state file can't be found this will force a C(terraform init). Generally, this should be turned off unless
you intend to provision an entirely new Terraform deployment.
default: false
type: bool
@ -145,8 +133,8 @@ options:
type: dict
backend_config_files:
description:
- The path to a configuration file to provide at init state to the -backend-config parameter.
This can accept a list of paths to multiple configuration files.
- The path to a configuration file to provide at init state to the -backend-config parameter. This can accept a list of paths to multiple
configuration files.
type: list
elements: path
version_added: '0.2.0'
@ -164,8 +152,8 @@ options:
version_added: '1.3.0'
check_destroy:
description:
- Apply only when no resources are destroyed. Note that this only prevents "destroy" actions,
but not "destroy and re-create" actions. This option is ignored when O(state=absent).
- Apply only when no resources are destroyed. Note that this only prevents "destroy" actions, but not "destroy and re-create" actions. This
option is ignored when O(state=absent).
type: bool
default: false
version_added: '3.3.0'
@ -175,12 +163,12 @@ options:
type: int
version_added: '3.8.0'
notes:
- To just run a C(terraform plan), use check mode.
requirements: [ "terraform" ]
- To just run a C(terraform plan), use check mode.
requirements: ["terraform"]
author: "Ryan Scott Brown (@ryansb)"
'''
"""
EXAMPLES = """
EXAMPLES = r"""
- name: Basic deploy of a service
community.general.terraform:
project_path: '{{ project_dir }}'
@ -248,7 +236,7 @@ EXAMPLES = """
# └── terraform-provider-vsphere_v1.26.0_x4
"""
RETURN = """
RETURN = r"""
outputs:
type: complex
description: A dictionary of all the TF outputs by their assigned name. Use RV(ignore:outputs.MyOutputName.value) to access the value.
@ -258,18 +246,18 @@ outputs:
sensitive:
type: bool
returned: always
description: Whether Terraform has marked this value as sensitive
description: Whether Terraform has marked this value as sensitive.
type:
type: str
returned: always
description: The type of the value (string, int, etc)
description: The type of the value (string, int, etc).
value:
type: str
returned: always
description: The value of the output as interpolated by Terraform
description: The value of the output as interpolated by Terraform.
stdout:
type: str
description: Full C(terraform) command stdout, in case you want to display it or examine the event log
description: Full C(terraform) command stdout, in case you want to display it or examine the event log.
returned: always
sample: ''
command: