oracle.oci.oci_resource_manager_stack – Manage a Stack resource in Oracle Cloud Infrastructure

Note

This plugin is part of the oracle.oci collection (version 5.3.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.

New in version 2.9.0: of oracle.oci

Synopsis

  • This module allows the user to create, update and delete a Stack resource in Oracle Cloud Infrastructure

  • For state=present, creates a stack in the specified compartment. You can create a stack from a Terraform configuration. The Terraform configuration can be directly uploaded or referenced from a source code control system. You can also create a stack from an existing compartment, which generates a Terraform configuration. You can also upload the Terraform configuration from an Object Storage bucket. For more information, see Creating Stacks.

  • This resource has the following action operations in the oracle.oci.oci_resource_manager_stack_actions module: change_compartment, detect_stack_drift.

Requirements

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

Parameters

Parameter Choices/Defaults Comments
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
  • security_token
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
Unique identifier (OCID) of the compartment in which the stack resides.
Required for create using state=present.
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.
config_source
dictionary
Required for create using state=present.
This parameter is updatable.
branch_name
string
The name of the branch that contains the Terraform configuration.
This parameter is updatable.
Applicable when config_source_type is one of ['DEVOPS_CONFIG_SOURCE', 'GIT_CONFIG_SOURCE', 'BITBUCKET_SERVER_CONFIG_SOURCE', 'BITBUCKET_CLOUD_CONFIG_SOURCE']
bucket_name
string
The name of the bucket that contains the Terraform configuration files.
This parameter is updatable.
Applicable when config_source_type is 'OBJECT_STORAGE_CONFIG_SOURCE'
Required when config_source_type is 'OBJECT_STORAGE_CONFIG_SOURCE'
compartment_id
string
The OCID of the compartment to use for creating the stack. The new stack will include definitions for supported resource types in scope of the specified compartment OCID (tenancy level for root compartment, compartment level otherwise).
Required when config_source_type is 'COMPARTMENT_CONFIG_SOURCE'
config_source_type
string / required
    Choices:
  • DEVOPS_CONFIG_SOURCE
  • BITBUCKET_CLOUD_CONFIG_SOURCE
  • ZIP_UPLOAD
  • BITBUCKET_SERVER_CONFIG_SOURCE
  • GIT_CONFIG_SOURCE
  • OBJECT_STORAGE_CONFIG_SOURCE
  • COMPARTMENT_CONFIG_SOURCE
  • TEMPLATE_CONFIG_SOURCE
Specifies the `configSourceType` for uploading the Terraform configuration.
This parameter is updatable.
configuration_source_provider_id
string
The OCID of the Bitbucket Cloud configuration source.
This parameter is updatable.
Required when config_source_type is one of ['GIT_CONFIG_SOURCE', 'BITBUCKET_SERVER_CONFIG_SOURCE', 'BITBUCKET_CLOUD_CONFIG_SOURCE']
namespace
string
The Object Storage namespace that contains the bucket.
This parameter is updatable.
Applicable when config_source_type is 'OBJECT_STORAGE_CONFIG_SOURCE'
Required when config_source_type is 'OBJECT_STORAGE_CONFIG_SOURCE'
project_id
string
The OCID of the DevOps project.
This parameter is updatable.
Applicable when config_source_type is 'BITBUCKET_SERVER_CONFIG_SOURCE'
Required when config_source_type is 'DEVOPS_CONFIG_SOURCE'
region
string
The name of the bucket's region. Example: `us-phoenix-1`
This parameter is updatable.
Applicable when config_source_type is 'OBJECT_STORAGE_CONFIG_SOURCE'
Required when config_source_type is one of ['COMPARTMENT_CONFIG_SOURCE', 'OBJECT_STORAGE_CONFIG_SOURCE']
repository_id
string
This parameter is updatable.
Applicable when config_source_type is 'BITBUCKET_SERVER_CONFIG_SOURCE'
Required when config_source_type is 'DEVOPS_CONFIG_SOURCE'
repository_url
string
The URL of the Bitbucket Cloud repository for the configuration source.
This parameter is updatable.
Applicable when config_source_type is one of ['GIT_CONFIG_SOURCE', 'BITBUCKET_SERVER_CONFIG_SOURCE', 'BITBUCKET_CLOUD_CONFIG_SOURCE']
Required when config_source_type is one of ['BITBUCKET_SERVER_CONFIG_SOURCE', 'BITBUCKET_CLOUD_CONFIG_SOURCE']
services_to_discover
list / elements=string
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.
Applicable when config_source_type is 'COMPARTMENT_CONFIG_SOURCE'
template_id
string
Required when config_source_type is 'TEMPLATE_CONFIG_SOURCE'
working_directory
string
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).
This parameter is updatable.
workspace_id
string
The id of the workspace in Bitbucket Cloud for the configuration source
This parameter is updatable.
Applicable when config_source_type is 'BITBUCKET_CLOUD_CONFIG_SOURCE'
Required when config_source_type is 'BITBUCKET_CLOUD_CONFIG_SOURCE'
zip_file_base64_encoded
string
This parameter is updatable.
Applicable when config_source_type is 'ZIP_UPLOAD'
Required when config_source_type is 'ZIP_UPLOAD'
custom_terraform_provider
dictionary
This parameter is updatable.
bucket_name
string / required
The name of the bucket that contains the binary files for the custom Terraform providers. For information about buckets, see Managing Buckets.
namespace
string / required
The Object Storage namespace that contains the bucket you want. For information about Object Storage namespaces, see Understanding Object Storage Namespaces.
region
string / required
The name of the region that contains the bucket you want. For information about regions, see Regions and Availability Domains. Example: `us-phoenix-1`
defined_tags
dictionary
Defined tags associated with this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags. Example: `{"Operations": {"CostCenter": "42"}}`
This parameter is updatable.
description
string
Description of the stack.
This parameter is updatable.
display_name
string
The stack's display name.
Required for create, update, delete when environment variable OCI_USE_NAME_AS_IDENTIFIER is set.
This parameter is updatable when OCI_USE_NAME_AS_IDENTIFIER is not set.

aliases: name
force_create
boolean
    Choices:
  • no ←
  • yes
Whether to attempt non-idempotent creation of a resource. By default, create resource is an idempotent operation, and doesn't create the resource if it already exists. Setting this option to true, forcefully creates a copy of the resource, even if it already exists.This option is mutually exclusive with key_by.
freeform_tags
dictionary
Free-form tags associated with this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags. Example: `{"Department": "Finance"}`
This parameter is updatable.
is_third_party_provider_experience_enabled
boolean
    Choices:
  • no
  • yes
When `true`, changes the stack's sourcing of third-party Terraform providers to Terraform Registry and allows custom providers. Applies to older stacks. Once set to `true`, cannot be reverted. For more information about stack sourcing of third-party Terraform providers, see Third-party Provider Configuration.
This parameter is updatable.
key_by
list / elements=string
The list of attributes of this resource which should be used to uniquely identify an instance of the resource. By default, all the attributes of a resource are used to uniquely identify a resource.
realm_specific_endpoint_template_enabled
boolean
    Choices:
  • no
  • yes
Enable/Disable realm specific endpoint template for service client. By Default, realm specific endpoint template is disabled. If not set, then the value of the OCI_REALM_SPECIFIC_SERVICE_ENDPOINT_TEMPLATE_ENABLED variable, if any, is used.
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.
stack_id
string
The OCID of the stack.
Required for update using state=present when environment variable OCI_USE_NAME_AS_IDENTIFIER is not set.
Required for delete using state=absent when environment variable OCI_USE_NAME_AS_IDENTIFIER is not set.

aliases: id
state
string
    Choices:
  • present ←
  • absent
The state of the Stack.
Use state=present to create or update a Stack.
Use state=absent to delete a Stack.
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
terraform_version
string
The version of Terraform to use with the stack. Example: `0.12.x`
This parameter is updatable.
variables
dictionary
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"}`
This parameter is updatable.
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: Create stack
  oci_resource_manager_stack:
    # required
    compartment_id: "ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx"
    config_source:
      # required
      config_source_type: DEVOPS_CONFIG_SOURCE
      project_id: "ocid1.project.oc1..xxxxxxEXAMPLExxxxxx"
      repository_id: "ocid1.repository.oc1..xxxxxxEXAMPLExxxxxx"

      # optional
      working_directory: working_directory_example
      branch_name: branch_name_example

    # optional
    display_name: display_name_example
    description: description_example
    custom_terraform_provider:
      # required
      region: us-phoenix-1
      namespace: namespace_example
      bucket_name: bucket_name_example
    variables: null
    terraform_version: terraform_version_example
    freeform_tags: {'Department': 'Finance'}
    defined_tags: {'Operations': {'CostCenter': 'US'}}

- name: Update stack
  oci_resource_manager_stack:
    # required
    stack_id: "ocid1.stack.oc1..xxxxxxEXAMPLExxxxxx"

    # optional
    display_name: display_name_example
    description: description_example
    config_source:
      # required
      config_source_type: DEVOPS_CONFIG_SOURCE
      project_id: "ocid1.project.oc1..xxxxxxEXAMPLExxxxxx"
      repository_id: "ocid1.repository.oc1..xxxxxxEXAMPLExxxxxx"

      # optional
      working_directory: working_directory_example
      branch_name: branch_name_example
    custom_terraform_provider:
      # required
      region: us-phoenix-1
      namespace: namespace_example
      bucket_name: bucket_name_example
    is_third_party_provider_experience_enabled: true
    variables: null
    terraform_version: terraform_version_example
    freeform_tags: {'Department': 'Finance'}
    defined_tags: {'Operations': {'CostCenter': 'US'}}

- name: Update stack using name (when environment variable OCI_USE_NAME_AS_IDENTIFIER is set)
  oci_resource_manager_stack:
    # required
    display_name: display_name_example

    # optional
    description: description_example
    config_source:
      # required
      config_source_type: DEVOPS_CONFIG_SOURCE
      project_id: "ocid1.project.oc1..xxxxxxEXAMPLExxxxxx"
      repository_id: "ocid1.repository.oc1..xxxxxxEXAMPLExxxxxx"

      # optional
      working_directory: working_directory_example
      branch_name: branch_name_example
    custom_terraform_provider:
      # required
      region: us-phoenix-1
      namespace: namespace_example
      bucket_name: bucket_name_example
    is_third_party_provider_experience_enabled: true
    variables: null
    terraform_version: terraform_version_example
    freeform_tags: {'Department': 'Finance'}
    defined_tags: {'Operations': {'CostCenter': 'US'}}

- name: Delete stack
  oci_resource_manager_stack:
    # required
    stack_id: "ocid1.stack.oc1..xxxxxxEXAMPLExxxxxx"
    state: absent

- name: Delete stack using name (when environment variable OCI_USE_NAME_AS_IDENTIFIER is set)
  oci_resource_manager_stack:
    # required
    display_name: display_name_example
    state: absent

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', 'clone_url': 'clone_url_example', 'compartment_id': 'ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx', 'config_source_type': 'BITBUCKET_CLOUD_CONFIG_SOURCE', 'configuration_source_provider_id': 'ocid1.configurationsourceprovider.oc1..xxxxxxEXAMPLExxxxxx', 'namespace': 'namespace_example', 'project_id': 'ocid1.project.oc1..xxxxxxEXAMPLExxxxxx', 'region': 'us-phoenix-1', 'repository_id': 'ocid1.repository.oc1..xxxxxxEXAMPLExxxxxx', 'repository_url': 'repository_url_example', 'services_to_discover': [], 'working_directory': 'working_directory_example', 'workspace_id': 'ocid1.workspace.oc1..xxxxxxEXAMPLExxxxxx'}, '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 Bitbucket Cloud 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
   
clone_url
string
on success
The clone URL of Bitbucket Server configuration source.

Sample:
clone_url_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:
BITBUCKET_CLOUD_CONFIG_SOURCE
   
configuration_source_provider_id
string
on success
The OCID of the Bitbucket Cloud configuration source.

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

Sample:
namespace_example
   
project_id
string
on success
Unique identifier for a Bitbucket Server project.

Sample:
ocid1.project.oc1..xxxxxxEXAMPLExxxxxx
   
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_id
string
on success
Bitbucket Server repository identifier, usually identified as <repository>.git.

Sample:
ocid1.repository.oc1..xxxxxxEXAMPLExxxxxx
   
repository_url
string
on success
The URL of the Bitbucket Cloud 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
   
workspace_id
string
on success
The id of the workspace in Bitbucket Cloud for the configuration source

Sample:
ocid1.workspace.oc1..xxxxxxEXAMPLExxxxxx
 
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)