Using Resources
Edit your Oracle Cloud Stack template and configure resource parameters and dependencies.
For an introduction, see What are Resources.
Basic Syntax
Define resources within the resources
node of your template file. For each node, specify itstype
. For example:
resources:
HRJavaApp:
type: jaas
Add a parameters
node within your resource node. Refer to the REST API documentation for this type of cloud resource to identify the available parameters. See List of Resource Types. For example, this endpoint is used to create a service instance in Oracle Java Cloud
Service.
resources:
HRJavaApp:
type: jaas
parameters:
adminUserName: myuser
clusterSize: 3
If the request payload for this resource’s REST endpoint supports a hierarchy of parameters, model this same hierarchy in your template file. For example:
parameters:
adminUserName: myuser
virtualMachine:
shape: oc3
volumeSize: 10G
Similarly, if the request payload supports arrays, model these arrays in your template file as sequences. For example:
parameters:
adminUserName: myuser
virtualMachines:
-
shape: oc3
volumeSize: 10G
-
shape: oc3
volumeSize: 20G
Get Template Parameters
Use the GetParam
function to assign the value of a template parameter to a resource’s parameter. For example:
adminUserName: { "Fn::GetParam": userName }
For more information, see Using Template Parameters.
Get Resource Attributes
Use the GetAtt
function to assign the value of another resource’s runtime attribute to this resource’s parameter. Enter the resource name and the attribute name as a sequence. For example:
adminUserName: { "Fn::GetAtt": [HRDatabase, userName] }
Refer to the REST API documentation for this type of cloud resource in order to identity its attributes. See List of Resource Types. For example, this endpoint is used to view a service instance in Oracle Java Cloud Service.
For more information, see Using Attributes.
Dependencies
Optionally add a depends_on
attribute to your resource node. Place it after the parameters
node. Use this attribute to identify one or more resources in this template on which this resource depends. Enter the value as a sequence:
resources:
HRJavaApp:
type: jaas
parameters:
resource parameters here
depends_on:
- HRStorage
- HRDatabase
Tip:
YAML sequences can also be expressed as arrays, such as[HRStorage,HRDatabase]
.