oracle.oci.oci_resource_manager_stack_actions – Perform actions on a Stack resource in Oracle Cloud Infrastructure

Note

This plugin is part of the oracle.oci collection (version 4.11.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install oracle.oci.

To use it in a playbook, specify: oracle.oci.oci_resource_manager_stack_actions.

New in version 2.9.0: of oracle.oci

Synopsis

  • Perform actions on a Stack resource in Oracle Cloud Infrastructure

  • For action=change_compartment, moves a stack (and its associated jobs) into a different compartment within the same tenancy. For information about moving resources between compartments, see Moving Resources to a Different Compartment.

  • For action=detect_stack_drift, checks drift status for the specified stack.

Requirements

The below requirements are needed on the host that executes this module.

Parameters

Parameter Choices/Defaults Comments
action
string / required
    Choices:
  • change_compartment
  • detect_stack_drift
The action to perform on the Stack.
api_user
string
The OCID of the user, on whose behalf, OCI APIs are invoked. If not set, then the value of the OCI_USER_ID environment variable, if any, is used. This option is required if the user is not specified through a configuration file (See config_file_location). To get the user's OCID, please refer https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm.
api_user_fingerprint
string
Fingerprint for the key pair being used. If not set, then the value of the OCI_USER_FINGERPRINT environment variable, if any, is used. This option is required if the key fingerprint is not specified through a configuration file (See config_file_location). To get the key pair's fingerprint value please refer https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm.
api_user_key_file
string
Full path and filename of the private key (in PEM format). If not set, then the value of the OCI_USER_KEY_FILE variable, if any, is used. This option is required if the private key is not specified through a configuration file (See config_file_location). If the key is encrypted with a pass-phrase, the api_user_key_pass_phrase option must also be provided.
api_user_key_pass_phrase
string
Passphrase used by the key referenced in api_user_key_file, if it is encrypted. If not set, then the value of the OCI_USER_KEY_PASS_PHRASE variable, if any, is used. This option is required if the key passphrase is not specified through a configuration file (See config_file_location).
auth_purpose
string
    Choices:
  • service_principal
The auth purpose which can be used in conjunction with 'auth_type=instance_principal'. The default auth_purpose for instance_principal is None.
auth_type
string
    Choices:
  • api_key ←
  • instance_principal
  • instance_obo_user
  • resource_principal
The type of authentication to use for making API requests. By default auth_type="api_key" based authentication is performed and the API key (see api_user_key_file) in your config file will be used. If this 'auth_type' module option is not specified, the value of the OCI_ANSIBLE_AUTH_TYPE, if any, is used. Use auth_type="instance_principal" to use instance principal based authentication when running ansible playbooks within an OCI compute instance.
cert_bundle
string
The full path to a CA certificate bundle to be used for SSL verification. This will override the default CA certificate bundle. If not set, then the value of the OCI_ANSIBLE_CERT_BUNDLE variable, if any, is used.
compartment_id
string
The OCID of the compartment into which the Stack should be moved.
Required for action=change_compartment.
config_file_location
string
Path to configuration file. If not set then the value of the OCI_CONFIG_FILE environment variable, if any, is used. Otherwise, defaults to ~/.oci/config.
config_profile_name
string
The profile to load from the config file referenced by config_file_location. If not set, then the value of the OCI_CONFIG_PROFILE environment variable, if any, is used. Otherwise, defaults to the "DEFAULT" profile in config_file_location.
is_provider_upgrade_required
boolean
    Choices:
  • no
  • yes
Specifies whether or not to upgrade provider versions. Within the version constraints of your Terraform configuration, use the latest versions available from the source of Terraform providers. For more information about this option, see L(Dependency Lock File (terraform.io),https://www.terraform.io/language/files/dependency-lock).
Applicable only for action=detect_stack_drift.
region
string
The Oracle Cloud Infrastructure region to use for all OCI API requests. If not set, then the value of the OCI_REGION variable, if any, is used. This option is required if the region is not specified through a configuration file (See config_file_location). Please refer to https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/regions.htm for more information on OCI regions.
resource_addresses
list / elements=string
The list of resources in the specified stack to detect drift for. Each resource is identified by a resource address, which is a string derived from the resource type and name specified in the stack's Terraform configuration plus an optional index. For example, the resource address for the fourth Compute instance with the name "test_instance" is oci_core_instance.test_instanceL(3]. For more details and examples of resource addresses, see the Terraform documentation at [Resource spec,https://www.terraform.io/docs/internals/resource-addressing.html#examples).
Applicable only for action=detect_stack_drift.
stack_id
string / required
The OCID of the stack.

aliases: id
tenancy
string
OCID of your tenancy. If not set, then the value of the OCI_TENANCY variable, if any, is used. This option is required if the tenancy OCID is not specified through a configuration file (See config_file_location). To get the tenancy OCID, please refer https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm
wait
boolean
    Choices:
  • no
  • yes ←
Whether to wait for create or delete operation to complete.
wait_timeout
integer
Time, in seconds, to wait when wait=yes. Defaults to 1200 for most of the services but some services might have a longer wait timeout.

Examples

- name: Perform action change_compartment on stack
  oci_resource_manager_stack_actions:
    # required
    compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx"
    stack_id: "ocid1.stack.oc1..xxxxxxEXAMPLExxxxxx"
    action: change_compartment

- name: Perform action detect_stack_drift on stack
  oci_resource_manager_stack_actions:
    # required
    stack_id: "ocid1.stack.oc1..xxxxxxEXAMPLExxxxxx"
    action: detect_stack_drift

    # optional
    resource_addresses: [ "resource_addresses_example" ]
    is_provider_upgrade_required: true

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
stack
complex
on success
Details of the Stack resource acted upon by the current operation

Sample:
{'compartment_id': 'ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx', 'config_source': {'branch_name': 'branch_name_example', 'bucket_name': 'bucket_name_example', 'compartment_id': 'ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx', 'config_source_type': 'COMPARTMENT_CONFIG_SOURCE', 'configuration_source_provider_id': 'ocid1.configurationsourceprovider.oc1..xxxxxxEXAMPLExxxxxx', 'namespace': 'namespace_example', 'region': 'us-phoenix-1', 'repository_url': 'repository_url_example', 'services_to_discover': [], 'working_directory': 'working_directory_example'}, 'custom_terraform_provider': {'bucket_name': 'bucket_name_example', 'namespace': 'namespace_example', 'region': 'us-phoenix-1'}, 'defined_tags': {'Operations': {'CostCenter': 'US'}}, 'description': 'description_example', 'display_name': 'display_name_example', 'freeform_tags': {'Department': 'Finance'}, 'id': 'ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx', 'is_third_party_provider_experience_enabled': True, 'lifecycle_state': 'CREATING', 'stack_drift_status': 'NOT_CHECKED', 'terraform_version': 'terraform_version_example', 'time_created': '2013-10-20T19:20:30+01:00', 'time_drift_last_checked': '2013-10-20T19:20:30+01:00', 'variables': {}}
 
compartment_id
string
on success
Unique identifier (OCID) for the compartment where the stack is located.

Sample:
ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx
 
config_source
complex
on success

   
branch_name
string
on success
The name of the branch in the Git repository for the configuration source.

Sample:
branch_name_example
   
bucket_name
string
on success
The name of the bucket that contains the Terraform configuration files. Maximum file size (applies to each file in the bucket): 100 MB. (In a bucket, a file is an object.)

Sample:
bucket_name_example
   
compartment_id
string
on success
The OCID of the compartment to use for creating the stack. The new stack will include definitions for supported resource types in this compartment.

Sample:
ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx
   
config_source_type
string
on success
The type of configuration source to use for the Terraform configuration.

Sample:
COMPARTMENT_CONFIG_SOURCE
   
configuration_source_provider_id
string
on success
The OCID of the Git configuration source.

Sample:
ocid1.configurationsourceprovider.oc1..xxxxxxEXAMPLExxxxxx
   
namespace
string
on success
The Object Storage namespace that contains the bucket.

Sample:
namespace_example
   
region
string
on success
The region to use for creating the stack. The new stack will include definitions for supported resource types in this region.

Sample:
us-phoenix-1
   
repository_url
string
on success
The URL of the Git repository for the configuration source.

Sample:
repository_url_example
   
services_to_discover
list / elements=string
on success
Filter for services to use with Resource Discovery. For example, "database" limits resource discovery to resource types within the Database service. The specified services must be in scope of the given compartment OCID (tenancy level for root compartment, compartment level otherwise). If not specified, then all services at the scope of the given compartment OCID are used.

   
working_directory
string
on success
File path to the directory to use for running Terraform. If not specified, the root directory is used. Required when using a zip Terraform configuration (`configSourceType` value of `ZIP_UPLOAD`) that contains folders. Ignored for the `configSourceType` value of `COMPARTMENT_CONFIG_SOURCE`. For more information about required and recommended file structure, see L(File Structure (Terraform Configurations for Resource Manager),https://docs.cloud.oracle.com/iaas/Content/ResourceManager/Concepts/terraformconfigresourcemanager.htm#filestructure).

Sample:
working_directory_example
 
custom_terraform_provider
complex
on success

   
bucket_name
string
on success
The name of the bucket that contains the binary files for the custom Terraform providers. For information about buckets, see Managing Buckets.

Sample:
bucket_name_example
   
namespace
string
on success
The Object Storage namespace that contains the bucket you want. For information about Object Storage namespaces, see Understanding Object Storage Namespaces.

Sample:
namespace_example
   
region
string
on success
The name of the region that contains the bucket you want. For information about regions, see Regions and Availability Domains. Example: `us-phoenix-1`

Sample:
us-phoenix-1
 
defined_tags
dictionary
on success
Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: `{"Operations": {"CostCenter": "42"}}`

Sample:
{'Operations': {'CostCenter': 'US'}}
 
description
string
on success
Description of the stack.

Sample:
description_example
 
display_name
string
on success
Human-readable name of the stack.

Sample:
display_name_example
 
freeform_tags
dictionary
on success
Free-form tags associated with the resource. Each tag is a key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: `{"Department": "Finance"}`

Sample:
{'Department': 'Finance'}
 
id
string
on success
Unique identifier (OCID) for the stack.

Sample:
ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx
 
is_third_party_provider_experience_enabled
boolean
on success
When `true`, the stack sources third-party Terraform providers from Terraform Registry and allows custom providers. For more information about stack sourcing of third-party Terraform providers, see Third-party Provider Configuration.

Sample:
True
 
lifecycle_state
string
on success
The current lifecycle state of the stack. For more information about stack lifecycle states in Resource Manager, see Key Concepts.

Sample:
CREATING
 
stack_drift_status
string
on success
Drift status of the stack. Drift refers to differences between the actual (current) state of the stack and the expected (defined) state of the stack.

Sample:
NOT_CHECKED
 
terraform_version
string
on success
The version of Terraform specified for the stack. Example: `0.12.x`

Sample:
terraform_version_example
 
time_created
string
on success
The date and time at which the stack was created. Format is defined by RFC3339. Example: `2020-01-25T21:10:29.600Z`

Sample:
2013-10-20T19:20:30+01:00
 
time_drift_last_checked
string
on success
The date and time when the drift detection was last executed. Format is defined by RFC3339. Example: `2020-01-25T21:10:29.600Z`

Sample:
2013-10-20T19:20:30+01:00
 
variables
dictionary
on success
Terraform variables associated with this resource. Maximum number of variables supported is 250. The maximum size of each variable, including both name and value, is 8192 bytes. Example: `{"CompartmentId": "compartment-id-value"}`



Authors

  • Oracle (@oracle)