# SCP::InfrastructureBuilder::Stack

LLMS index: [llms.txt](https://docs.e.samsungsdscloud.com/en/templatereference/management/infrastructure-builder/llms.txt)

---

```
SCP::InfrastructureBuilder::Stack
```





## Description
Creates a stack from a template as a nested stack within the parent stack. The nested stack's resources are created, updated, and deleted together with the parent stack.

## Version
`1.0.0`

## Syntax

To declare this entity in your Infrastructure Builder template, use the following syntax:

**JSON**
```json
{
  "Type" : "SCP::InfrastructureBuilder::Stack",
  "Properties" : {
    "Name" : "String",
    "TemplateBody" : "String",
    "Description" : "String",
    "EnableTerminationProtection" : "Boolean",
    "RetainExceptOnCreate" : "Boolean",
    "ParentId" : "String",
    "RootId" : "String",
    "Capabilities" : [String],
    "ResourceTypes" : [String],
    "RoleSrn" : "String",
    "DisableRollback" : "Boolean",
    "OnFailure" : "String",
    "StackPolicyBody" : "String",
    "StackPolicyUrl" : "String",
    "StackPolicyDuringUpdateBody" : "String",
    "StackPolicyDuringUpdateUrl" : "String",
    "ChangeSetId" : "String",
    "RollbackConfiguration" : "RollbackConfiguration",
    "Parameters" : "Json",
    "TimeoutInMinutes" : "Integer",
    "TemplateURL" : "String",
    "ClientRequestToken" : "String"
  }
}

```

**YAML**
```yaml
Type: SCP::InfrastructureBuilder::Stack
Properties:
  Name: String
  TemplateBody: String
  Description: String
  EnableTerminationProtection: Boolean
  RetainExceptOnCreate: Boolean
  ParentId: String
  RootId: String
  Capabilities: [String]
  ResourceTypes: [String]
  RoleSrn: String
  DisableRollback: Boolean
  OnFailure: String
  StackPolicyBody: String
  StackPolicyUrl: String
  StackPolicyDuringUpdateBody: String
  StackPolicyDuringUpdateUrl: String
  ChangeSetId: String
  RollbackConfiguration: RollbackConfiguration
  Parameters: 
    Json
  TimeoutInMinutes: Integer
  TemplateURL: String
  ClientRequestToken: String

```

## Properties


### Name

The name of the stack. It identifies the stack and cannot be changed after creation.

| Attribute | Value |
|-----------|-------|
| **Required** | No |
| **Type** | String |
| **Update requires** | No interruption |






### TemplateBody

The template body of the stack sent to the internal API. Nested stack resources only support TemplateURL.

| Attribute | Value |
|-----------|-------|
| **Required** | No |
| **Type** | String |
| **Update requires** | No interruption |






### Description

A brief explanation or note about the stack. This helps identify the purpose or usage of the stack.

| Attribute | Value |
|-----------|-------|
| **Required** | No |
| **Type** | String |
| **Update requires** | No interruption |






### EnableTerminationProtection

Whether to enable deletion protection to prevent the stack from being accidentally deleted. If set to true, delete attempts fail and the stack remains unchanged.

| Attribute | Value |
|-----------|-------|
| **Required** | No |
| **Type** | Boolean |
| **Update requires** | No interruption |






### RetainExceptOnCreate

Whether to retain an existing stack instead of creating a new one when an identical stack already exists at creation time. If set to true, creation is skipped and the existing stack is kept when a conflict occurs during creation.

| Attribute | Value |
|-----------|-------|
| **Required** | No |
| **Type** | Boolean |
| **Update requires** | No interruption |






### ParentId

The parent stack ID. Specifies the identifier of the parent stack when this is a nested stack.

| Attribute | Value |
|-----------|-------|
| **Required** | No |
| **Type** | String |
| **Update requires** | No interruption |






### RootId

The root stack ID. The identifier of the top-level stack when this is a nested stack.

| Attribute | Value |
|-----------|-------|
| **Required** | No |
| **Type** | String |
| **Update requires** | No interruption |






### Capabilities

The list of additional capabilities required to create the stack. Required when the stack uses specific features (e.g., custom resource creation), and creation may fail without them.

| Attribute | Value |
|-----------|-------|
| **Required** | No |
| **Type** | Array of String |
| **Update requires** | No interruption |






### ResourceTypes

The list of resource types to include in the stack.

| Attribute | Value |
|-----------|-------|
| **Required** | No |
| **Type** | Array of String |
| **Update requires** | No interruption |






### RoleSrn

The SRN of the role used for stack operations. If not specified, the default role is used.

| Attribute | Value |
|-----------|-------|
| **Required** | No |
| **Type** | String |
| **Update requires** | No interruption |






### DisableRollback

Whether to disable rollback when creation or update fails. If set to true, changes are not rolled back on failure.

| Attribute | Value |
|-----------|-------|
| **Required** | No |
| **Type** | Boolean |
| **Update requires** | No interruption |






### OnFailure

The action to take when stack creation fails. If creation fails, the specified action (e.g., rollback or keep the stack) is performed.

| Attribute | Value |
|-----------|-------|
| **Required** | No |
| **Type** | String |
| **Update requires** | No interruption |






### StackPolicyBody

The stack policy body for resource protection during stack updates. Either the stack policy body or the stack policy URL can be specified.

| Attribute | Value |
|-----------|-------|
| **Required** | No |
| **Type** | String |
| **Update requires** | No interruption |






### StackPolicyUrl

The URL where the stack policy is defined. Provides resource protection rules during stack updates.

| Attribute | Value |
|-----------|-------|
| **Required** | No |
| **Type** | String |
| **Update requires** | No interruption |






### StackPolicyDuringUpdateBody

The stack policy body to temporarily apply during stack updates. Applies only during the update and is restored to the original policy afterwards.

| Attribute | Value |
|-----------|-------|
| **Required** | No |
| **Type** | String |
| **Update requires** | No interruption |






### StackPolicyDuringUpdateUrl

The URL where the stack policy to temporarily apply during stack updates is defined.

| Attribute | Value |
|-----------|-------|
| **Required** | No |
| **Type** | String |
| **Update requires** | No interruption |






### ChangeSetId

The ChangeSet ID (the child ChangeSet ID when executing a nested ChangeSet).

| Attribute | Value |
|-----------|-------|
| **Required** | No |
| **Type** | String |
| **Update requires** | No interruption |






### RollbackConfiguration

Defines the rollback configuration. Sets the monitoring time and rollback triggers to automatically roll back on update failure.

| Attribute | Value |
|-----------|-------|
| **Required** | No |
| **Type** | RollbackConfiguration |
| **Update requires** | No interruption |




> For more information, see [RollbackConfiguration](/en/templatereference/management/infrastructure-builder/scp_infrastructurebuilder_stack/rollbackconfiguration/).



### Parameters

Parameters to pass to the child stack, as a map of parameter names to values (same as Infrastructure Builder Stack).

| Attribute | Value |
|-----------|-------|
| **Required** | No |
| **Type** | Map |
| **Update requires** | No interruption |






### TimeoutInMinutes

The stack creation timeout, in minutes. Creation fails if it does not complete within the specified time.

| Attribute | Value |
|-----------|-------|
| **Required** | No |
| **Type** | Integer |
| **Update requires** | No interruption |






### TemplateURL

The Object Storage URL where the child stack template is located. Used to provide the template as a URL instead of the template body.

| Attribute | Value |
|-----------|-------|
| **Required** | No |
| **Type** | String |
| **Update requires** | No interruption |






### ClientRequestToken

The client request token. Sending duplicate requests with the same token returns the result of the previous request.

| Attribute | Value |
|-----------|-------|
| **Required** | No |
| **Type** | String |
| **Update requires** | No interruption |







## Return Values

### Ref

When you pass the logical ID of this resource to the `Ref` function, Ref returns the value of the **Id**.


### Fn::GetAtt

| Attribute | Description |
|-----------|-------------|
| **Name** | The name of the stack. It identifies the stack and cannot be changed after creation. |
| **TemplateBody** | The template body of the stack sent to the internal API. Nested stack resources only support TemplateURL. |
| **Description** | A brief explanation or note about the stack. This helps identify the purpose or usage of the stack. |
| **EnableTerminationProtection** | Whether to enable deletion protection to prevent the stack from being accidentally deleted. If set to true, delete attempts fail and the stack remains unchanged. |
| **RetainExceptOnCreate** | Whether to retain an existing stack instead of creating a new one when an identical stack already exists at creation time. If set to true, creation is skipped and the existing stack is kept when a conflict occurs during creation. |
| **ParentId** | The parent stack ID. Specifies the identifier of the parent stack when this is a nested stack. |
| **RootId** | The root stack ID. The identifier of the top-level stack when this is a nested stack. |
| **Capabilities** | The list of additional capabilities required to create the stack. Required when the stack uses specific features (e.g., custom resource creation), and creation may fail without them. |
| **ResourceTypes** | The list of resource types to include in the stack. |
| **RoleSrn** | The SRN of the role used for stack operations. If not specified, the default role is used. |
| **DisableRollback** | Whether to disable rollback when creation or update fails. If set to true, changes are not rolled back on failure. |
| **OnFailure** | The action to take when stack creation fails. If creation fails, the specified action (e.g., rollback or keep the stack) is performed. |
| **StackPolicyBody** | The stack policy body for resource protection during stack updates. Either the stack policy body or the stack policy URL can be specified. |
| **StackPolicyUrl** | The URL where the stack policy is defined. Provides resource protection rules during stack updates. |
| **StackPolicyDuringUpdateBody** | The stack policy body to temporarily apply during stack updates. Applies only during the update and is restored to the original policy afterwards. |
| **StackPolicyDuringUpdateUrl** | The URL where the stack policy to temporarily apply during stack updates is defined. |
| **ChangeSetId** | The ChangeSet ID (the child ChangeSet ID when executing a nested ChangeSet). |
| **TimeoutInMinutes** | The stack creation timeout, in minutes. Creation fails if it does not complete within the specified time. |
| **TemplateURL** | The Object Storage URL where the child stack template is located. Used to provide the template as a URL instead of the template body. |
| **AccountId** | The identifier of the account that owns the stack. |
| **Status** | The current status of the stack. |
| **DeletedAt** | The timestamp when the stack was deleted, in ISO 8601 format. |
| **DeletedBy** | The user ID that deleted the stack. |
| **DetailedStatus** | The detailed status of the stack. |
| **LastOperations** | The list of operations most recently performed on the stack. |
| **Outputs** | The list of values output after the stack is created. |
| **StatusReason** | The reason related to the stack status. |
| **TemplateDescription** | The description of the template used to create the stack. |
| **OperationId** | The unique identifier of the operation performed on the stack. |
| **ClientRequestToken** | The client request token. Sending duplicate requests with the same token returns the result of the previous request. |


## Sample Template

### Deploy multiple instances with a nested stack
Deploys N identical virtual servers using nested stacks. Used together with the [Nested stack virtual server template] template.

```yaml
SCPTemplateFormatVersion: '2026-01-01'
Description: '동일 가상 서버를 여러 대 중첩 스택으로 배포하는 템플릿'
Parameters:
  VpcName:
    Type: String
    Default: 'sample-vpc'
    MinLength: 3
    MaxLength: 20
    AllowedPattern: '^[a-zA-Z0-9-]*$'
    Description: 'VPC 이름을 입력하세요. (3~20자, 영문/숫자/하이픈만 허용)'
  VpcCidr:
    Type: CommaDelimitedList
    Default: '10.0.0.0/16'
    Description: 'VPC의 CIDR 블록을 입력하세요. (/16 ~ /24)'
  SubnetName:
    Type: String
    Default: 'sample-subnet'
    MinLength: 3
    MaxLength: 20
    AllowedPattern: '^[a-zA-Z0-9-]*$'
    Description: 'Subnet 이름을 입력하세요. (3~20자, 영문/숫자/하이픈만 허용)'
  SubnetCidr:
    Type: String
    Default: '10.0.1.0/24'
    Description: 'Subnet의 CIDR 블록을 입력하세요. (VPC CIDR 범위 내)'
  ImageId:
    Type: String
    MinLength: 1
    Description: '가상 서버에 사용할 표준(공용) 이미지 ID를 입력하세요. (필수)'
  KeypairName:
    Type: String
    MinLength: 1
    Description: 'SSH 접속에 사용할 키페어 이름을 입력하세요. (필수)'
  ServerTypeId:
    Type: String
    Default: 's1v1m2'
    Description: '가상 서버 타입 ID를 입력하세요. (예: s1v1m2. ※ 예시 값 - 리전/이미지에 맞게 수정)'
  Zone:
    Type: String
    Default: 'kr-west1-a'
    Description: '가상 서버가 생성될 존을 입력하세요. (예: kr-west1-a. ※ 예시 값 - 리전에 맞게 수정)'

Resources:
  MyVpc:
    Type: SCP::VPC::Vpc
    Properties:
      Name: !Ref VpcName
      Cidrs: !Ref VpcCidr
  MySubnet:
    Type: SCP::VPC::Subnet
    Properties:
      Name: !Ref SubnetName
      VpcId: !Ref MyVpc
      Cidr: !Ref SubnetCidr
      Type: PRIVATE
      Category: PRIMARY
  Server1:
    Type: SCP::InfrastructureBuilder::Stack
    Properties:
      TemplateURL: 'https://<자식 템플릿 배포 URL>/nested-server-template.yaml'
      Parameters:
        SubnetId: !Ref MySubnet
        ServerName: 'sample-server-1'
        ImageId: !Ref ImageId
        KeypairName: !Ref KeypairName
        ServerTypeId: !Ref ServerTypeId
        Zone: !Ref Zone
  Server2:
    Type: SCP::InfrastructureBuilder::Stack
    Properties:
      TemplateURL: 'https://<자식 템플릿 배포 URL>/nested-server-template.yaml'
      Parameters:
        SubnetId: !Ref MySubnet
        ServerName: 'sample-server-2'
        ImageId: !Ref ImageId
        KeypairName: !Ref KeypairName
        ServerTypeId: !Ref ServerTypeId
        Zone: !Ref Zone

Outputs:
  VpcId:
    Description: "생성된 VPC의 ID입니다."
    Value: !Ref MyVpc
  SubnetId:
    Description: "생성된 Subnet의 ID입니다."
    Value: !Ref MySubnet
  Server1Id:
    Description: "첫 번째 가상 서버의 ID입니다."
    Value: !GetAtt Server1.Outputs.ServerId
  Server2Id:
    Description: "두 번째 가상 서버의 ID입니다."
    Value: !GetAtt Server2.Outputs.ServerId

```

### Nested stack virtual server template
Defines a single virtual server invoked as a nested stack by the [Deploy multiple instances with a nested stack] template.

```yaml
SCPTemplateFormatVersion: '2026-01-01'
Description: '중첩 스택으로 배포되는 가상 서버 1대 (다중 인스턴스 샘플 자식 템플릿)'
Parameters:
  SubnetId:
    Type: String
    Description: 서버를 생성할 Subnet의 ID
  ServerName:
    Type: String
    Default: 'sample-server'
    MinLength: 1
    MaxLength: 63
    Description: '가상 서버 이름 (1~63자)'
  ImageId:
    Type: String
    MinLength: 1
    Description: '가상 서버 이미지 ID (필수)'
  KeypairName:
    Type: String
    MinLength: 1
    Description: '키페어 이름 (필수)'
  ServerTypeId:
    Type: String
    Default: 's1v1m2'
    Description: '가상 서버 타입 ID (예: s1v1m2)'
  Zone:
    Type: String
    Default: 'kr-west1-a'
    Description: '가용존 (예: kr-west1-a)'

Resources:
  MyServer:
    Type: SCP::VirtualServer::VirtualServer
    Properties:
      Name: !Ref ServerName
      ImageId: !Ref ImageId
      KeypairName: !Ref KeypairName
      ServerTypeId: !Ref ServerTypeId
      Zone: !Ref Zone
      Networks:
        - SubnetId: !Ref SubnetId
      BootVolume:
        Size: 40
        Type: SSD

Outputs:
  ServerId:
    Description: "생성된 가상 서버의 ID입니다."
    Value: !Ref MyServer

```

---

Section pages:

- [RollbackConfiguration](/en/templatereference/management/infrastructure-builder/scp_infrastructurebuilder_stack/rollbackconfiguration/index.md)
