• Resource Template Service

rts
  1. Help Center
  2. Resource Template Service
  3. User Guide
  4. Getting Started with CLIs
  5. Viewing a Random String

Viewing a Random String

This chapter describes how to view a created random string.

To view the random string, you must add the outputs field to the template used to create resources.

The following is the random_string1.yaml template that has the outputs field added:

heat_template_version: 2014-10-16

description: create random string

resources:
  my_instance:
    type: OS::Heat::RandomString

outputs:
  instance_value:
    description: The value of my_instance
    value: { get_attr: [my_instance, value]}

In the added outputs field, get_attr is an internal function that can be used to obtain the value of the required key.

The following command uses the stack random_string that is created in section Creating a Random String as an example to describe how to view details of a stack:

heat stack-show random_string

The following information is displayed:

{ 
  "stack": { 
    "parent": null, 
    "disable_rollback": true, 
    "description": "create random string", 
    "links": [ 
     { 
      "href": "https://orchestration.localdomain.com:8700/v1/b7df5f30e79c473e8ed7da366c7a1dee/stacks/random_string1/0390dc9b-9297-4a1a-b915-a7e8814dfef4", 
      "rel": "self" 
     } 
    ], 
    "stack_status_reason": "Stack CREATE completed successfully", 
    "stack_name": "random_string1", 
    "outputs": [ 
     { 
      "output_value": "Emyn8DHhYDJitAWw9Qw3r5f4ktpYR1IR", 
      "description": "The value of my_instance", 
      "output_key": "instance_value" 
     } 
    ], 
    "stack_owner": null, 
    "creation_time": "2016-09-26T00:38:57Z", 
    "capabilities": [ 
  
    ], 
    "notification_topics": [ 
  
    ], 
    "updated_time": null, 
    "timeout_mins": null, 
    "stack_status": "CREATE_COMPLETE", 
    "parameters": { 
      "OS::stack_id": "0390dc9b-9297-4a1a-b915-a7e8814dfef4", 
      "OS::stack_name": "random_string1" 
    }, 
    "id": "0390dc9b-9297-4a1a-b915-a7e8814dfef4", 
    "template_description": "create random string" 
  }   
}

In the preceding displayed information, the outputs field indicates the created random string.

Comparison Description

If a random string is created using the template file in section Creating a Random String, you can run the heat stack-show command to query the stack details, but the specific string information cannot be displayed.

If a random string is created using the template file in section Viewing a Random String, you can run the heat stack-show command to view details of the created stack, including the content in the outputs field in the template file.