Skip to main content

stacks

Creates, updates, deletes, gets or lists a stacks resource.

Overview​

Namestacks
TypeResource
Idoci.resource_manager.stacks

Fields​

The following fields are returned by SELECT queries:

Returns the Stack object.

NameDatatypeDescription
idstringUnique identifier ([OCID](/iaas/Content/General/Concepts/identifiers.htm)) for the stack.
compartmentIdstringUnique identifier ([OCID](/iaas/Content/General/Concepts/identifiers.htm)) for the compartment where the stack is located.
configSourceobjectInformation 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 />)
customTerraformProviderobjectLocation 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 />)
definedTagsobjectDefined 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: &#123;"Operations": &#123;"CostCenter": "42"&#125;&#125;
descriptionstringDescription of the stack.
displayNamestringA user-friendly name. Does not have to be unique, and it's changeable. Avoid entering confidential information.
freeformTagsobjectFree-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: &#123;"Department": "Finance"&#125;
isThirdPartyProviderExperienceEnabledbooleanWhen 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).
lifecycleStatestringThe 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)
stackDriftStatusstringDrift 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)
systemTagsobjectThe 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: &#123;orcl-cloud: &#123;free-tier-retain: true&#125;&#125;
terraformVersionstringThe version of Terraform specified for the stack. Example: 1.5.x
timeCreatedstring (date-time)The date and time at which the stack was created. Format is defined by RFC3339. Example: 2020-01-25T21:10:29.600Z
timeDriftLastCheckedstring (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
variablesobjectTerraform 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: &#123;"CompartmentId": "compartment-id-value"&#125;

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectstackId, regionopc-request-idGets the specified stack.<br />For more information, see<br />[Getting a Stack's Details](/iaas/Content/ResourceManager/Tasks/get-stack.htm).<br />
listselectregionopc-request-id, compartmentId, id, lifecycleState, displayName, sortBy, sortOrder, limit, pageLists 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 />
createinsertregion, compartmentId, configSourceopc-request-id, opc-retry-tokenCreates 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 />
updateupdatestackId, regionopc-request-id, if-matchUpdates 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 />
deletedeletestackId, regionopc-request-id, if-matchDeletes the specified stack.<br />For more information, see<br />[Deleting a Stack](/iaas/Content/ResourceManager/Tasks/delete-stack.htm).<br />
change_compartmentexecstackId, region, compartmentIdif-match, opc-request-id, opc-retry-tokenMoves 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_driftexecstackId, regionif-match, opc-request-id, opc-retry-tokenChecks 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_detailsexecstackId, regionopc-request-id, workRequestId, resourceDriftStatus, limit, pageLists 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.

NameDatatypeDescription
regionstringOCI 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)
stackIdstringThe [OCID](/iaas/Content/General/Concepts/identifiers.htm) of the stack.
compartmentIdstringA filter to return only resources that exist in the compartment, identified by [OCID](/iaas/Content/General/Concepts/identifiers.htm).
displayNamestringA 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.
idstringThe [OCID](/iaas/Content/General/Concepts/identifiers.htm) on which to query for a stack.
if-matchstringFor 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.
lifecycleStatestringA 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).
limitintegerThe 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-idstringUnique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular request, please provide the request ID.
opc-retry-tokenstringA 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.
pagestringThe 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).
resourceDriftStatusarrayA filter that returns only resources that match the given drift status. The value is case-insensitive.
sortBystringThe 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.
sortOrderstringThe sort order to use when sorting returned resources. Ascending (ASC) or descending (DESC).
workRequestIdstringThe [OCID](/iaas/Content/General/Concepts/identifiers.htm) of the work request.

SELECT examples​

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 }}'
;

INSERT examples​

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
;

UPDATE examples​

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​

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​

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 }}"
}'
;