stacks
Creates, updates, deletes, gets or lists a stacks resource.
Overview​
| Name | stacks |
| Type | Resource |
| Id | oci.resource_manager.stacks |
Fields​
The following fields are returned by SELECT queries:
- get
- list
Returns the Stack object.
| Name | Datatype | Description |
|---|---|---|
id | string | Unique identifier ([OCID](/iaas/Content/General/Concepts/identifiers.htm)) for the stack. |
compartmentId | string | Unique identifier ([OCID](/iaas/Content/General/Concepts/identifiers.htm)) for the compartment where the stack is located. |
configSource | object | Information about the Terraform configuration. (x-example: Sample 1: Zip file<br /><br />{<br /> "configSourceType": "ZIP_UPLOAD",<br /> "zipFileBase64Encoded": "<var><zip_file_content_encoded_in_base64_format></var>",<br /> "workingDirectory": "<var><file_path_to_directory></var>"<br />}<br /><br />Sample 2: GitHub<br /><br />{<br /> "configSourceType": "GIT_CONFIG_SOURCE",<br /> "configurationSourceProviderId": "ocid1.ormconfigsourceprovider.oc1..<var><unique_ID></var>",<br /> "repositoryUrl": "https:​//github.com/user/repo.git",<br /> "branchName": "MyBranch",<br /> "workingDirectory": "<var><file_path_to_directory></var>",<br />}<br /><br />Sample 3: Bucket<br /><br />{<br /> "configSourceType": "OBJECT_STORAGE_CONFIG_SOURCE",<br /> "region": "us-phoenix-1",<br /> "namespace": "<var><bucket_namespace></var>",<br /> "bucketName": "<var><bucket_name></var>"<br />}<br /><br />Sample 4: Existing compartment (resource discovery)<br /><br />{<br /> "configSourceType": "COMPARTMENT_CONFIG_SOURCE",<br /> "compartmentId": "ocid1.compartment.oc1..<var><unique_ID></var>",<br /> "region": "us-phoenix-1"<br />}<br /><br />Sample 5: DevOps repository<br /><br />{<br /> "configSourceType": "DEVOPS_CONFIG_SOURCE",<br /> "projectId": "ocid1.devopsproject.oc1..<var><unique_ID></var>",<br /> "repositoryId": "ocid1.devopsrepository.oc1..<var><unique_ID></var>",<br /> "branchName": "MyBranch",<br /> "workingDirectory": "<var><file_path_to_directory></var>",<br />}<br />) |
customTerraformProvider | object | Location information about custom Terraform providers for a stack. For more information, see [Using Custom Providers with a Stack](/iaas/Content/ResourceManager/Tasks/update-stack-custom-providers.htm). Note: Older stacks must be explicitly updated to use Terraform Registry (isThirdPartyProviderExperienceEnabled=true). See [UpdateStack](#/en/resourcemanager/latest/Stack/UpdateStack). For more information, see [Using Terraform Registry with an Older Stack](/iaas/Content/ResourceManager/Tasks/update-stack-tf-reg.htm). (x-example: {<br /> "region": "us-phoenix-1",<br /> "namespace": "<var><bucket_namespace></var>",<br /> "bucketName": "<var><bucket_name></var>"<br />}<br />) |
definedTags | object | Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags](/iaas/Content/General/Concepts/resourcetags.htm). Example: {"Operations": {"CostCenter": "42"}} |
description | string | Description of the stack. |
displayName | string | A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information. |
freeformTags | object | 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](/iaas/Content/General/Concepts/resourcetags.htm). Example: {"Department": "Finance"} |
isThirdPartyProviderExperienceEnabled | boolean | When true, the stack sources third-party Terraform providers from [Terraform Registry](https:​//registry.terraform.io/browse/providers) and allows [custom providers](#/en/resourcemanager/latest/datatypes/CustomTerraformProvider). For more information about stack sourcing of third-party Terraform providers, see [Third-party Provider Configuration](/iaas/Content/ResourceManager/Concepts/terraformconfigresourcemanager.htm#third-party-providers). |
lifecycleState | string | The current lifecycle state of the stack. For more information about stack lifecycle states in Resource Manager, see [Key Concepts](/iaas/Content/ResourceManager/Concepts/resourcemanager.htm#concepts__StackStates). (CREATING, ACTIVE, DELETING, DELETED, FAILED) |
stackDriftStatus | string | 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. (NOT_CHECKED, IN_SYNC, DRIFTED) |
systemTags | object | The system tags associated with this resource, if any. The system tags are set by Oracle cloud infrastructure services. Each key is predefined and scoped to namespaces. For more information, see [Resource Tags](https:​//docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: {orcl-cloud: {free-tier-retain: true}} |
terraformVersion | string | The version of Terraform specified for the stack. Example: 1.5.x |
timeCreated | string (date-time) | The date and time at which the stack was created. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z |
timeDriftLastChecked | string (date-time) | The date and time when the drift detection was last executed. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z |
variables | object | 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"} |
Summary information for a stack.<br />
| Name | Datatype | Description |
|---|---|---|
id | string | Unique identifier of the specified stack. |
compartmentId | string | Unique identifier of the compartment in which the stack resides. |
definedTags | object | Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see [Resource Tags](/iaas/Content/General/Concepts/resourcetags.htm). Example: {"Operations": {"CostCenter": "42"}} |
description | string | General description of the stack. |
displayName | string | A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information. |
freeformTags | object | 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](/iaas/Content/General/Concepts/resourcetags.htm). Example: {"Department": "Finance"} |
lifecycleState | string | The current lifecycle state of the stack. For more information about stack lifecycle states in Resource Manager, see [Key Concepts](/iaas/Content/ResourceManager/Concepts/resourcemanager.htm#concepts__StackStates). (x-obmcs-enumref: #/definitions/Stack/lifecycleState) |
systemTags | object | The system tags associated with this resource, if any. The system tags are set by Oracle cloud infrastructure services. Each key is predefined and scoped to namespaces. For more information, see [Resource Tags](https:​//docs.cloud.oracle.com/iaas/Content/General/Concepts/resourcetags.htm). Example: {orcl-cloud: {free-tier-retain: true}} |
terraformVersion | string | The version of Terraform specified for the stack. Example: 1.5.x |
timeCreated | string (date-time) | The date and time when the stack was created. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z |
Methods​
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | stackId, region | opc-request-id | Gets the specified stack.<br />For more information, see<br />[Getting a Stack's Details](/iaas/Content/ResourceManager/Tasks/get-stack.htm).<br /> |
list | select | region | opc-request-id, compartmentId, id, lifecycleState, displayName, sortBy, sortOrder, limit, page | Lists stacks according to the specified filter.<br />For more information, see<br />[Listing Stacks](/iaas/Content/ResourceManager/Tasks/list-stacks.htm).<br />- If called using the compartment ID, returns all stacks in the specified compartment.<br />- If called using the stack ID, returns the specified stack. (See also [GetStack](#/en/resourcemanager/latest/Stack/GetStack).)<br /> |
create | insert | region, compartmentId, configSource | opc-request-id, opc-retry-token | Creates a stack in the specified compartment.<br />You can create a stack from a Terraform configuration.<br />The Terraform configuration can be directly uploaded or referenced from a source code control system.<br />You can also create a stack from an existing compartment, which generates a Terraform configuration.<br />You can also upload the Terraform configuration from an Object Storage bucket.<br />For more information, see<br />[Creating a Stack](/iaas/Content/ResourceManager/Tasks/create-stack.htm).<br /> |
update | update | stackId, region | opc-request-id, if-match | Updates the specified stack.<br />Use UpdateStack when you update your Terraform configuration<br />and want your changes to be reflected in the execution plan.<br />For more information, see<br />[Updating a Stack](/iaas/Content/ResourceManager/Tasks/update-stack.htm).<br /> |
delete | delete | stackId, region | opc-request-id, if-match | Deletes the specified stack.<br />For more information, see<br />[Deleting a Stack](/iaas/Content/ResourceManager/Tasks/delete-stack.htm).<br /> |
change_compartment | exec | stackId, region, compartmentId | if-match, opc-request-id, opc-retry-token | Moves a stack (and its associated jobs) into a different compartment within the same tenancy.<br />For more information, see<br />[Moving a Stack](/iaas/Content/ResourceManager/Tasks/change-compartment-stack.htm).<br /> |
detect_stack_drift | exec | stackId, region | if-match, opc-request-id, opc-retry-token | Checks drift status for the specified stack.<br />For more information, see<br />[Detecting Drift](/iaas/Content/ResourceManager/Tasks/detect-drift.htm).<br /> |
list_stack_resource_drift_details | exec | stackId, region | opc-request-id, workRequestId, resourceDriftStatus, limit, page | Lists drift status details for each resource defined in the specified stack.<br />The drift status details for a given resource indicate differences, if any, between the actual state<br />and the expected (defined) state for that resource.<br />The drift status details correspond to the specified work request (workRequestId).<br />If no work request is specified, then the drift status details correspond to the latest completed work request for the stack.<br />For more information, see<br />[Listing Drift Status](/iaas/Content/ResourceManager/Tasks/list-drift.htm).<br /> |
Parameters​
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
region | string | OCI region identifier (e.g. us-ashburn-1, ap-sydney-1); resolves from OCI_REGION when not supplied in the query. (default: us-ashburn-1, x-stackQL-envVar: OCI_REGION) |
stackId | string | The [OCID](/iaas/Content/General/Concepts/identifiers.htm) of the stack. |
compartmentId | string | A filter to return only resources that exist in the compartment, identified by [OCID](/iaas/Content/General/Concepts/identifiers.htm). |
displayName | string | A filter to return only resources that match the given display name exactly. Use this filter to list a resource by name. Requires sortBy set to DISPLAYNAME. Alternatively, when you know the resource OCID, use the related Get operation. |
id | string | The [OCID](/iaas/Content/General/Concepts/identifiers.htm) on which to query for a stack. |
if-match | string | For optimistic concurrency control. In the PUT or DELETE call for a resource, set the if-match parameter to the value of the etag from a previous GET or POST response for that resource. The resource will be updated or deleted only if the etag you provide matches the resource's current etag value. |
lifecycleState | string | A filter that returns only those resources that match the specified lifecycle state. The state value is case-insensitive. For more information about stack lifecycle states, see [Key Concepts](/iaas/Content/ResourceManager/Concepts/resourcemanager.htm#concepts__StackStates). |
limit | integer | The number of items returned in a paginated List call. For information about pagination, see [List Pagination](/iaas/Content/API/Concepts/usingapi.htm#nine). |
opc-request-id | string | Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID. |
opc-retry-token | string | A token that uniquely identifies a request so it can be retried in case of a timeout or server error without risk of retrying the same action. Retry tokens expire after 24 hours, but can be invalidated before then due to conflicting operations. For example, if a resource has been deleted and purged from the system, then a retry of the original creation request may be rejected. |
page | string | The value of the opc-next-page response header from the preceding List call. For information about pagination, see [List Pagination](/iaas/Content/API/Concepts/usingapi.htm#nine). |
resourceDriftStatus | array | A filter that returns only resources that match the given drift status. The value is case-insensitive. |
sortBy | string | The field to use when sorting returned resources. By default, TIMECREATED is ordered descending. By default, DISPLAYNAME is ordered ascending. Note that you can sort only on one field. |
sortOrder | string | The sort order to use when sorting returned resources. Ascending (ASC) or descending (DESC). |
workRequestId | string | The [OCID](/iaas/Content/General/Concepts/identifiers.htm) of the work request. |
SELECT examples​
- get
- list
Gets the specified stack.<br />For more information, see<br />[Getting a Stack's Details](/iaas/Content/ResourceManager/Tasks/get-stack.htm).<br />
SELECT
id,
compartmentId,
configSource,
customTerraformProvider,
definedTags,
description,
displayName,
freeformTags,
isThirdPartyProviderExperienceEnabled,
lifecycleState,
stackDriftStatus,
systemTags,
terraformVersion,
timeCreated,
timeDriftLastChecked,
variables
FROM oci.resource_manager.stacks
WHERE stackId = '{{ stackId }}' -- required
AND region = '{{ region }}' -- required
AND opc-request-id = '{{ opc-request-id }}'
;
Lists stacks according to the specified filter.<br />For more information, see<br />[Listing Stacks](/iaas/Content/ResourceManager/Tasks/list-stacks.htm).<br />- If called using the compartment ID, returns all stacks in the specified compartment.<br />- If called using the stack ID, returns the specified stack. (See also [GetStack](#/en/resourcemanager/latest/Stack/GetStack).)<br />
SELECT
id,
compartmentId,
definedTags,
description,
displayName,
freeformTags,
lifecycleState,
systemTags,
terraformVersion,
timeCreated
FROM oci.resource_manager.stacks
WHERE region = '{{ region }}' -- required
AND opc-request-id = '{{ opc-request-id }}'
AND compartmentId = '{{ compartmentId }}'
AND id = '{{ id }}'
AND lifecycleState = '{{ lifecycleState }}'
AND displayName = '{{ displayName }}'
AND sortBy = '{{ sortBy }}'
AND sortOrder = '{{ sortOrder }}'
AND limit = '{{ limit }}'
AND page = '{{ page }}'
;
INSERT examples​
- create
- Manifest
Creates a stack in the specified compartment.<br />You can create a stack from a Terraform configuration.<br />The Terraform configuration can be directly uploaded or referenced from a source code control system.<br />You can also create a stack from an existing compartment, which generates a Terraform configuration.<br />You can also upload the Terraform configuration from an Object Storage bucket.<br />For more information, see<br />[Creating a Stack](/iaas/Content/ResourceManager/Tasks/create-stack.htm).<br />
INSERT INTO oci.resource_manager.stacks (
compartmentId,
configSource,
customTerraformProvider,
definedTags,
description,
displayName,
freeformTags,
terraformVersion,
variables,
region,
opc-request-id,
opc-retry-token
)
SELECT
'{{ compartmentId }}' /* required */,
'{{ configSource }}' /* required */,
'{{ customTerraformProvider }}',
'{{ definedTags }}',
'{{ description }}',
'{{ displayName }}',
'{{ freeformTags }}',
'{{ terraformVersion }}',
'{{ variables }}',
'{{ region }}',
'{{ opc-request-id }}',
'{{ opc-retry-token }}'
RETURNING
id,
compartmentId,
configSource,
customTerraformProvider,
definedTags,
description,
displayName,
freeformTags,
isThirdPartyProviderExperienceEnabled,
lifecycleState,
stackDriftStatus,
systemTags,
terraformVersion,
timeCreated,
timeDriftLastChecked,
variables
;
# Description fields are for documentation purposes
- name: stacks
props:
- name: region
value: "{{ region }}"
description: Required parameter for the stacks resource.
- name: compartmentId
value: "{{ compartmentId }}"
description: |
Unique identifier ([OCID](/iaas/Content/General/Concepts/identifiers.htm)) of the compartment in which the stack resides.
- name: configSource
description: |
Creation details for a configuration source used with the stack.
value:
configSourceType: "{{ configSourceType }}"
workingDirectory: "{{ workingDirectory }}"
- name: customTerraformProvider
description: |
Location information about custom Terraform providers for a stack.
For more information, see [Using Custom Providers with a Stack](/iaas/Content/ResourceManager/Tasks/update-stack-custom-providers.htm).
Note: Older stacks must be explicitly updated to use Terraform Registry (`isThirdPartyProviderExperienceEnabled=true`).
See [UpdateStack](#/en/resourcemanager/latest/Stack/UpdateStack). For more information, see
[Using Terraform Registry with an Older Stack](/iaas/Content/ResourceManager/Tasks/update-stack-tf-reg.htm).
value:
bucketName: "{{ bucketName }}"
namespace: "{{ namespace }}"
region: "{{ region }}"
- name: definedTags
value: "{{ definedTags }}"
description: |
Defined tags associated with this resource. Each key is predefined and scoped to a namespace.
For more information, see [Resource Tags](/iaas/Content/General/Concepts/resourcetags.htm).
Example: `{"Operations": {"CostCenter": "42"}}`
- name: description
value: "{{ description }}"
description: |
Description of the stack.
- name: displayName
value: "{{ displayName }}"
description: |
A user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
- name: freeformTags
value: "{{ freeformTags }}"
description: |
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](/iaas/Content/General/Concepts/resourcetags.htm).
Example: `{"Department": "Finance"}`
- name: terraformVersion
value: "{{ terraformVersion }}"
description: |
The version of Terraform to use with the stack. Example: `1.5.x`
- name: variables
value: "{{ variables }}"
description: |
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"}`
- name: opc-request-id
value: "{{ opc-request-id }}"
description: Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.
description: Unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.
- name: opc-retry-token
value: "{{ opc-retry-token }}"
description: A token that uniquely identifies a request so it can be retried in case of a timeout or server error without risk of retrying the same action. Retry tokens expire after 24 hours, but can be invalidated before then due to conflicting operations. For example, if a resource has been deleted and purged from the system, then a retry of the original creation request may be rejected.
description: A token that uniquely identifies a request so it can be retried in case of a timeout or server error without risk of retrying the same action. Retry tokens expire after 24 hours, but can be invalidated before then due to conflicting operations. For example, if a resource has been deleted and purged from the system, then a retry of the original creation request may be rejected.
UPDATE examples​
- update
Updates the specified stack.<br />Use UpdateStack when you update your Terraform configuration<br />and want your changes to be reflected in the execution plan.<br />For more information, see<br />[Updating a Stack](/iaas/Content/ResourceManager/Tasks/update-stack.htm).<br />
UPDATE oci.resource_manager.stacks
SET
configSource = '{{ configSource }}',
customTerraformProvider = '{{ customTerraformProvider }}',
definedTags = '{{ definedTags }}',
description = '{{ description }}',
displayName = '{{ displayName }}',
freeformTags = '{{ freeformTags }}',
isThirdPartyProviderExperienceEnabled = {{ isThirdPartyProviderExperienceEnabled }},
terraformVersion = '{{ terraformVersion }}',
variables = '{{ variables }}'
WHERE
stackId = '{{ stackId }}' --required
AND region = '{{ region }}' --required
AND opc-request-id = '{{ opc-request-id}}'
AND if-match = '{{ if-match}}'
RETURNING
id,
compartmentId,
configSource,
customTerraformProvider,
definedTags,
description,
displayName,
freeformTags,
isThirdPartyProviderExperienceEnabled,
lifecycleState,
stackDriftStatus,
systemTags,
terraformVersion,
timeCreated,
timeDriftLastChecked,
variables;
DELETE examples​
- delete
Deletes the specified stack.<br />For more information, see<br />[Deleting a Stack](/iaas/Content/ResourceManager/Tasks/delete-stack.htm).<br />
DELETE FROM oci.resource_manager.stacks
WHERE stackId = '{{ stackId }}' --required
AND region = '{{ region }}' --required
AND opc-request-id = '{{ opc-request-id }}'
AND if-match = '{{ if-match }}'
;
Lifecycle Methods​
- change_compartment
- detect_stack_drift
- list_stack_resource_drift_details
Moves a stack (and its associated jobs) into a different compartment within the same tenancy.<br />For more information, see<br />[Moving a Stack](/iaas/Content/ResourceManager/Tasks/change-compartment-stack.htm).<br />
EXEC oci.resource_manager.stacks.change_compartment
@stackId='{{ stackId }}' --required,
@region='{{ region }}' --required,
@if-match='{{ if-match }}',
@opc-request-id='{{ opc-request-id }}',
@opc-retry-token='{{ opc-retry-token }}'
@@json=
'{
"compartmentId": "{{ compartmentId }}"
}'
;
Checks drift status for the specified stack.<br />For more information, see<br />[Detecting Drift](/iaas/Content/ResourceManager/Tasks/detect-drift.htm).<br />
EXEC oci.resource_manager.stacks.detect_stack_drift
@stackId='{{ stackId }}' --required,
@region='{{ region }}' --required,
@if-match='{{ if-match }}',
@opc-request-id='{{ opc-request-id }}',
@opc-retry-token='{{ opc-retry-token }}'
@@json=
'{
"isProviderUpgradeRequired": {{ isProviderUpgradeRequired }},
"resourceAddresses": "{{ resourceAddresses }}"
}'
;
Lists drift status details for each resource defined in the specified stack.<br />The drift status details for a given resource indicate differences, if any, between the actual state<br />and the expected (defined) state for that resource.<br />The drift status details correspond to the specified work request (workRequestId).<br />If no work request is specified, then the drift status details correspond to the latest completed work request for the stack.<br />For more information, see<br />[Listing Drift Status](/iaas/Content/ResourceManager/Tasks/list-drift.htm).<br />
EXEC oci.resource_manager.stacks.list_stack_resource_drift_details
@stackId='{{ stackId }}' --required,
@region='{{ region }}' --required,
@opc-request-id='{{ opc-request-id }}',
@workRequestId='{{ workRequestId }}',
@resourceDriftStatus='{{ resourceDriftStatus }}',
@limit='{{ limit }}',
@page='{{ page }}'
;