SCP::InfrastructureBuilder::Stack

SCP::InfrastructureBuilder::Stack

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

{
  "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

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.

AttributeValue
RequiredNo
TypeString
Update requiresNo interruption

TemplateBody

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

AttributeValue
RequiredNo
TypeString
Update requiresNo interruption

Description

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

AttributeValue
RequiredNo
TypeString
Update requiresNo 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.

AttributeValue
RequiredNo
TypeBoolean
Update requiresNo 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.

AttributeValue
RequiredNo
TypeBoolean
Update requiresNo interruption

ParentId

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

AttributeValue
RequiredNo
TypeString
Update requiresNo interruption

RootId

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

AttributeValue
RequiredNo
TypeString
Update requiresNo 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.

AttributeValue
RequiredNo
TypeArray of String
Update requiresNo interruption

ResourceTypes

The list of resource types to include in the stack.

AttributeValue
RequiredNo
TypeArray of String
Update requiresNo interruption

RoleSrn

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

AttributeValue
RequiredNo
TypeString
Update requiresNo interruption

DisableRollback

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

AttributeValue
RequiredNo
TypeBoolean
Update requiresNo 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.

AttributeValue
RequiredNo
TypeString
Update requiresNo 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.

AttributeValue
RequiredNo
TypeString
Update requiresNo interruption

StackPolicyUrl

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

AttributeValue
RequiredNo
TypeString
Update requiresNo 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.

AttributeValue
RequiredNo
TypeString
Update requiresNo interruption

StackPolicyDuringUpdateUrl

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

AttributeValue
RequiredNo
TypeString
Update requiresNo interruption

ChangeSetId

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

AttributeValue
RequiredNo
TypeString
Update requiresNo interruption

RollbackConfiguration

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

AttributeValue
RequiredNo
TypeRollbackConfiguration
Update requiresNo interruption

For more information, see RollbackConfiguration.

Parameters

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

AttributeValue
RequiredNo
TypeMap
Update requiresNo interruption

TimeoutInMinutes

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

AttributeValue
RequiredNo
TypeInteger
Update requiresNo 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.

AttributeValue
RequiredNo
TypeString
Update requiresNo interruption

ClientRequestToken

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

AttributeValue
RequiredNo
TypeString
Update requiresNo 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

AttributeDescription
NameThe name of the stack. It identifies the stack and cannot be changed after creation.
TemplateBodyThe template body of the stack sent to the internal API. Nested stack resources only support TemplateURL.
DescriptionA brief explanation or note about the stack. This helps identify the purpose or usage of the stack.
EnableTerminationProtectionWhether to enable deletion protection to prevent the stack from being accidentally deleted. If set to true, delete attempts fail and the stack remains unchanged.
RetainExceptOnCreateWhether 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.
ParentIdThe parent stack ID. Specifies the identifier of the parent stack when this is a nested stack.
RootIdThe root stack ID. The identifier of the top-level stack when this is a nested stack.
CapabilitiesThe 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.
ResourceTypesThe list of resource types to include in the stack.
RoleSrnThe SRN of the role used for stack operations. If not specified, the default role is used.
DisableRollbackWhether to disable rollback when creation or update fails. If set to true, changes are not rolled back on failure.
OnFailureThe action to take when stack creation fails. If creation fails, the specified action (e.g., rollback or keep the stack) is performed.
StackPolicyBodyThe stack policy body for resource protection during stack updates. Either the stack policy body or the stack policy URL can be specified.
StackPolicyUrlThe URL where the stack policy is defined. Provides resource protection rules during stack updates.
StackPolicyDuringUpdateBodyThe stack policy body to temporarily apply during stack updates. Applies only during the update and is restored to the original policy afterwards.
StackPolicyDuringUpdateUrlThe URL where the stack policy to temporarily apply during stack updates is defined.
ChangeSetIdThe ChangeSet ID (the child ChangeSet ID when executing a nested ChangeSet).
TimeoutInMinutesThe stack creation timeout, in minutes. Creation fails if it does not complete within the specified time.
TemplateURLThe Object Storage URL where the child stack template is located. Used to provide the template as a URL instead of the template body.
AccountIdThe identifier of the account that owns the stack.
StatusThe current status of the stack.
DeletedAtThe timestamp when the stack was deleted, in ISO 8601 format.
DeletedByThe user ID that deleted the stack.
DetailedStatusThe detailed status of the stack.
LastOperationsThe list of operations most recently performed on the stack.
OutputsThe list of values output after the stack is created.
StatusReasonThe reason related to the stack status.
TemplateDescriptionThe description of the template used to create the stack.
OperationIdThe unique identifier of the operation performed on the stack.
ClientRequestTokenThe 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.

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.

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