Create stack

Method URI Description
POST /v1/{tenant_id}/stacks Creates a stack.

Normal response codes: 201

Error response codes: badRequest (400), unauthorized (401), conflict (409), internalServerError (500)

Request

CAUTION:

It is necessary to set full permission ".r:*" for the read ACL of the container in which the template file specified in template_url is stored.

This table shows the parameters for the create stack request:

Parameter Style Type Required Description
tenant_id URI String Yes Project ID
stack_name plain String Yes The name of a stack to be created. Specify a string of halfwidth alphanumeric characters, underscores (_), hyphens (-), and periods (.), and that starts with a letter. The maximum length is 255 characters. Subsequent characters are ignored.
template_url plain String No The URL for a template. This parameter is ignored if the template parameter is specified.

Specify either the template_url or template parameter.

template plain String No The string for a template. Use escape characters in the template if necessary so that the correct JSON format is used in the request body. For example, replace double quotation marks (") with (\"), and line feeds with (\n). This parameter has priority if it is specified with templete_url.

Specify either the template_url or template parameter.

environment plain JSON No Replace the resource type defined in the template with another resource type.
files plain JSON No Mapping of file name and file contents. Specify this parameter when the embedded function get_file is used in the template. Use escape characters in the file contents if necessary so that the correct JSON format is used in the request body. For example, replace double quotation marks (") with (\"), and line feeds with (\n).
parameters plain object No The pair of the name and value of an input parameter to be passed to the template.
timeout_mins plain Number No The timeout value. The unit is minutes. If omitted, 60 will be used.
disable_rollback plain Boolean No Specify "false" to delete the resources already created in a stack when creation of the stack failed. If omitted, "true" will be used.

If creation of resources fails after performing stack creation using the parameter value "true", resources already created before the stack creation process fails will not be deleted. In this case, the actual resources may have been created even if the resource status for the stack is CREATE_FAILED. To reference information on the created resources, use an API for the service that corresponds to the resource.

Example. Create stack: JSON request


{
	"stack_name": "{stack_name}",
	"template_url": "{template_url}",
	"parameters": {
		"param_name-1": "param_value-1", "param_name-2": "param_value-2"
	},
	"timeout_mins":  "{timeout_mins}"
}       
     

Response

Example. Create stack: JSON response


{
	"stack": {
		"id":     "3095aefc-09fb-4bc7-b1f0-f21a304e864c", 
		"links": [
			{
				"href": "http://192.168.123.200:8004/v1/ eb1c63a4f77141548385f113a28f0f52/stacks/simple_stack/3095aefc-09fb-4bc7-b1f0- f21a304e864c",
				"rel":  "self"
			}
		]
	}
}       
     

CAUTION:

  • If you create a stack for a template that contains security group rules, and the security group rule limit has been reached, the stack that contains a security group for which security group rules are not set is still created.

    To add a security group rule while in this state, reduce the number of security group rules below the limit, and perform the steps ( "API reference (Network)" - "Network" - "Network adapter" - "API details" - "Create security group" ).

  • When creating a router that will be connected to an external network, create a stack for which the router is created, modify the properties so that it will be connected to the external network, and update the stack using "update stack".