Template Best Practices

Follow these best practices to ensure that your Oracle Cloud Stack templates are flexible and maintainable, and work as expected.

Best Practice More Information

Describe your template

Use templateDescription to explain your template’s purpose and to describe the cloud resources that it creates. Also explain any limitations and/or conditional behavior in your template.

Create input parameters

If your template uses static values for a resource’s configuration, users who want to change this configuration must copy and edit your template. Instead, use parameters to make your template more flexible and reusable.

Provide a sensible default value for each template parameter. This minimizes the amount of time that a typical user spends creating stacks from your template.

Describe your parameters

Use the description attribute to explain the purpose of each template parameter. Describe the default behavior if the parameter is optional, and any dependencies between this parameter and other parameters. Users can view this help text when they use the web console to create a stack from your template.

Configure parameter constraints

Stacks can require significant time to provision. Avoid costly user errors by configuring appropriate constraints on your template parameters, such as a minimum value, a maximum number of characters, or a regular expression. See Creating Template Parameters.

Use parameters for passwords and keys

Oracle does not recommend the use of default values for passwords, SSH keys, and other secret information. Instead, use template parameters so that users can provide their own inputs for these values. Do not specify a default value for these parameters.

Configure template validations

Stacks can require significant time to provision. Avoid costly user errors by configuring validations in your template. For example, a validation can check the connectivity to an existing database prior to creating a stack. See Using Validations.

Validate your template syntax

Before publishing and testing your template, check its contents for common syntax errors. See Validating a Template.

Follow best practices when developing custom actions for a resource

See Best Practices.