From the blueprint designer, you can set component environment properties and component
resource properties in blueprint source code.
About this task
You can pass the following properties from a blueprint to the resource tree:
- Component resource properties
- Component environment properties
- Secure component resource properties
- Secure environment resource properties
- Environment properties
Blueprints can create environment properties, but component resource properties and component
environment properties must exist on a component before you can pass values to them. If you do not
provide values for these properties from the blueprint designer, the properties use the default
values that were set in the
IBM® UrbanCode™ Deploy.
Procedure
- In the blueprint designer, open a blueprint.
- Add one or more virtual images to the blueprint.
- To pass component environment properties, follow these steps:
- On the server, on the Configuration tab for a component,
create one or more component environment properties. For example, the following figure shows a component with two component
environment properties:
- In the blueprint designer, from the Components drawer, add the component
to a virtual image. On the IBM::UrbanCode::SoftwareConfig::UCD resource, in the
inputs section, the component environment properties appear as name-value pairs.
The properties also appear on the Properties tab of the editor. The following
example code shows two component environment
properties:
component1_sw_config:
type: IBM::UrbanCode::SoftwareConfig::UCD
properties:
name: "component1"
component_process: "Deploy component1"
component_process_timeout: "300"
ucd_server_url: { get_param: ucd_server_url }
ucd_username: { get_param: ucd_user }
ucd_password: { get_param: ucd_password }
application: { get_attr: [resource_tree, application_name] }
environment_name: { get_attr: [resource_tree, environment_name] }
inputs:
CompEnvProp1 : "Default value for CompEnvProp1"
CompEnvProp2 : "Default value for CompEnvProp2"
- Specify values for the component environment properties in the blueprint. You can specify literal values, or you can use the
get_attr and get_param functions to retrieve
attribute and parameter values.
- To pass component resource properties, follow these steps:
- On the server, on the Configuration tab for a component,
create one or more component resource properties.
- In the blueprint editor, from the Components drawer, add the
component to a virtual image. On the IBM::UrbanCode::SoftwareDeploy::UCD resource, in the
inputs section, the component resource properties appear as
name-value pairs. The properties also appear on the Properties
tab of the editor. The following example code shows a component resource
property:
component1:
type: IBM::UrbanCode::SoftwareDeploy::UCD
properties:
apply_config: { get_resource: component1_sw_config }
server: my_server
version: LATEST
agent_timeout: "360"
inputs:
CompResourceProp1 : "Default value for CompResourceProp1"
- Specify values for the component resource properties in the blueprint. You can specify literal values, or you can use the
get_attr and get_param functions to retrieve
attribute and parameter values.
- To pass environment properties, follow these steps:
- In the blueprint editor, from the Components drawer, add at least one
component to a virtual image. This step is necessary to create and populate the resource_tree resource in
the blueprint code.
- On the resource_tree resource, in the properties section, add
environment properties and specify values for them. For example, the following code shows an environment property that is named
tomcat_port:
resource_tree:
properties:
inputs:
tomcat_port : "8443"
- To modify the value of a secure component resource or component environment properties, follow
these steps:
Restriction: You cannot modify the value of these secure properties in the blueprint
source code.
- On the server, on the Configuration tab for a component, create one or
more component resource properties.
- In the blueprint editor, from the Components drawer, add the component
to a virtual image. On the IBM::UrbanCode::SoftwareDeploy::UCD resource, in the
inputs section, the secure properties appear as name and
get_param function pairs. Because the value of the property is secure, it is not
displayed in the blueprint. The properties also appear on the Properties tab
of the editor. The secure property names are appended with -SECURE-PROPERTY, as
shown in the following
example:
component1:
type: IBM::UrbanCode::SoftwareDeploy::UCD
properties:
apply_config: { get_resource: component1_sw_config }
server: my_server
version: LATEST
agent_timeout: "360"
inputs:
SecurePropertyName-SECURE-PROPERTY : {get_param: SecurePropertyName_secure_property}
In
the parameters section of the blueprint, the definition of each secure property is
displayed. The secure property names are appended with _secure_property, and the
description of each secure property and a placeholder string for the password are displayed, as
shown in the following
example:SecurePropertyName_secure_property
type: string
description: 'Secure property definition'
default: 'DefaultComponentPasswordValue'
hidden: true
- When you provision the blueprint, specify values for the secure properties. See Provisioning environments from the blueprint designer (through OpenStack Heat).
- Save the blueprint.
What to do next
After you provision the environment, the blueprint designer passes the property values in
the blueprint source code to the properties on the server. In processes, you can refer to the
properties in the same format as referring to any other property. For example, you can refer
to environment properties in this format:
${p:environment/property_name}.