Terraform Configurations for Resource Manager
This topic describes requirements and recommendations for Terraform configurations used with Resource Manager. For basic information about Terraform configurations, see Authoring Configurations. For instructions on using configurations with stacks and jobs, see Managing Stacks and Jobs.
You can store your Terraform configuration file locally or remotely, using a source code control system. With remote storage, any job running on the associated stack automatically uses the latest version of your configuration. For more information about remotely storing your file, see Managing Configuration Source Providers.
In addition to writing your own Terraform configuration file, you also have the option to generate a Terraform configuration from either an existing compartment using resource discovery or a sample solution.
Do not provide user credentials or other confidential information in your Terraform configurations.
Requirements
Terraform configuration files used with Resource Manager must meet the following requirements.
Terraform Provider
When using Resource Manager, the region
field in the provider "oci"
block is the only required field.
For more information about defining providers, see Configuration File Requirements.
File Structure
Resource Manager requires the following file structure for the Terraform configuration:
-
The working directory must contain at least one
.tf
file. The working directory cannot contain a.terraform
directory.The working directory is the path from which to run Terraform. By default, the working directory is the root directory of your configuration (for an uploaded configuration, the root of your
.zip
file). When using the API, you can specify a different location for the working directory by setting theworkingDirectory
parameter. - The configuration must follow guidelines specified in Authoring Configurations.
- No Terraform state files (
.tfstate
) can exist in the configuration. - If you plan to upload the configuration locally, then bundle all files into a
.zip
file.
Modules
Variables
We recommend using a schema document with your Terraform configuration to facilitate user entry in the Oracle Cloud Infrastructure Console.
Resource Manager does not have requirements for variables in Terraform configurations. Resource Manager supports the native Terraform behavior for handling variables. Terraform sets variables from your variable definitions that use supported type constraints.
Example Terraform Configuration for Resource Manager
The following example shows a Terraform configuration that is contained in a single file. This basic sample defines just one Terraform provider, one Oracle Cloud Infrastructure resource, and a set of variables.
variable "compartment_ocid" {}
variable "region" {}
provider "oci" {
region = "${var.region}"
}
resource "oci_core_virtual_network" "vcn1" {
cidr_block = "10.0.0.0/16"
dns_label = "vcn1"
compartment_id = "${var.compartment_ocid}"
display_name = "vcn1"
}
More often, Terraform configurations consist of two or more files bundled together (for an uploaded configuration, the files would be bundled in a .zip file). To see more complex, multi-file Terraform configurations, explore the examples at the Oracle Cloud Infrastructure GitHub: terraform-provider-oci/docs/examples.
Schema Documents
Schema documents are recommended for Terraform configurations when using Resource Manager. Including a schema document allows you to facilitate variable entry in the Oracle Cloud Infrastructure Console by surfacing SSH key controls and by naming, grouping, dynamically prepopulating values, and more, including defining text in the Application Information tab displayed for a created stack.
Requirements for Schema Documents
Schema documents for Resource Manager have the following requirements:
- YAML format.
- Placement under the root folder of the Resource Manager Terraform configuration. (By default, the schema document assumes that the root folder is the working directory.)
Supported Types (Dynamic Prepopulation and Controls)
This section lists the types supported by Resource Manager for dynamic prepopulation and controls.
Type (rendered as a dynamically prepopulated dropdown field unless otherwise noted) | Resource identifier | Comments |
---|---|---|
oci:core:image:id |
Image OCID | Mandatory dependsOn field:
compartmentId |
oci:core:instanceshape:name |
Instance shape name | |
oci:core:ssh:publickey |
-- | Surfaces a control for adding one or more public SSH keys by dropping files or pasting key values. For more information, see SSH key control. |
oci:core:subnet:id |
Subnet OCID | |
oci:core:vcn:id |
VCN OCID | |
oci:database:autonomouscontainerdatabase:id |
Autonomous container database OCID | |
oci:database:autonomousdatabase:id |
Autonomous database OCID | |
oci:database:database:id |
Database OCID | |
oci:database:dbhome:id |
DB home OCID | |
oci:database:dbsystem:id |
DB system OCID | |
oci:identity:availabilitydomain:name |
Availability domain name | |
oci:identity:compartment:id |
Compartment OCID | |
oci:identity:faultdomain:name |
Fault domain name | |
oci:identity:region:name |
Region name | |
oci:kms:vault:id |
Vault OCID |
Meta Schema for Validation
Use the following meta schema file to confirm that your schema document is using supported variable types.
# Meta JSON Schema.
#
# This is used to validate the Schema file when the package is uploaded/loaded into Resource Manager.
# For marketplace, it is also used to validate the package when the package artifact is created in Partner Portal.
#
# NOTE: additionalProperties are set to true explicitly even though this is the default. It must be set to true in
# cases where we use the allOf. This is a quirk of JSON Schema. During validation, allOf means it has to match all of
# the individual definitions separately. It doesn't mean it has to match a Union of the individual definitions. This
# is a known issue with JSON Schema.
title: Schema
type: object
required:
- variables
- schemaVersion
additionalProperties: true
properties:
title:
type: string
description:
type: string
stackDescription:
type: string
packageVersion:
type: string
version:
type: string
schemaVersion:
type: string
enum:
- 1.0.0
- 1.1.0
locale:
$ref: '#/definitions/locale'
logoUrl:
$ref: '#/definitions/url'
source:
$ref: '#/definitions/source'
informationalText:
type: string
instructions:
type: string
troubleshooting:
type: string
allowViewState:
type: boolean
variables:
$ref: '#/definitions/variables'
# Deprecated - use variableGroups instead
groupings:
$ref: '#/definitions/variableGroups'
variableGroups:
$ref: '#/definitions/variableGroups'
outputs:
$ref: '#/definitions/outputs'
outputGroups:
$ref: '#/definitions/outputGroups'
primaryOutputButton:
type: string
format: variablereference
definitions:
source:
type: object
properties:
type:
enum:
- marketplace
- quickstart
- web
reference:
type:
- string
- number
additionalProperties: false
variableGroups:
type: array
items:
$ref: '#/definitions/variableGroup'
variableGroup:
type: object
required:
- title
- variables
properties:
title:
type: string
variables:
type: array
items:
type: string
format: variablereference
visible:
$ref: '#/definitions/booleanStatement'
additionalProperties: true
locale:
enum:
- en
default: en
url:
type: string
pattern: ^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)$
ocid:
type: string
pattern: ^ocid1\.([a-z0-9_-]{1,32})\.([a-z0-9_-]{1,15})\.([a-z0-9]{0,24})\.([a-z0-9]{60})$
variables:
type: object
additionalProperties:
$ref: '#/definitions/variable'
variable:
oneOf:
- $ref: '#/definitions/staticVariable'
- $ref: '#/definitions/dynamicVariable'
baseVariable:
type: object
properties:
title:
type: string
minLength: 1
description:
type: string
required:
type: boolean
default: false
visible:
$ref: '#/definitions/booleanStatement'
booleanStatement:
oneOf:
- type: boolean
- type: string
- $ref: '#/definitions/equality'
- $ref: '#/definitions/booleanOr'
- $ref: '#/definitions/booleanAnd'
- $ref: '#/definitions/booleanNot'
equality:
type: object
properties:
eq:
type: array
items:
- type: [string, number]
- type: [string, number]
additionalItems: false
additionalProperties: false
booleanOr:
type: object
properties:
or:
type: array
items:
- $ref: '#/definitions/booleanStatement'
- $ref: '#/definitions/booleanStatement'
additionalItems: false
additionalProperties: false
booleanAnd:
type: object
properties:
and:
type: array
items:
- $ref: '#/definitions/booleanStatement'
- $ref: '#/definitions/booleanStatement'
additionalItems: false
additionalProperties: false
booleanNot:
type: object
properties:
not:
type: array
items:
- $ref: '#/definitions/booleanStatement'
additionalItems: false
additionalProperties: false
dependsOnCompartment:
allOf:
- $ref: '#/definitions/baseVariable'
- required:
- dependsOn
properties:
dependsOn:
type: object
required:
- compartmentId
properties:
compartmentId:
type: string
format: variablereference
additionalProperties: false
additionalProperties: true
staticVariable:
oneOf:
- $ref: '#/definitions/arrayVariable'
- $ref: '#/definitions/booleanVariable'
- $ref: '#/definitions/enumVariable'
- $ref: '#/definitions/integerVariable'
- $ref: '#/definitions/numberVariable'
- $ref: '#/definitions/stringVariable'
- $ref: '#/definitions/passwordVariable'
- $ref: '#/definitions/datetimeVariable'
dynamicVariable:
oneOf:
- $ref: '#/definitions/imageVariable'
- $ref: '#/definitions/instanceShapeVariable'
- $ref: '#/definitions/subnetVariable'
- $ref: '#/definitions/vcnVariable'
- $ref: '#/definitions/availabilityDomainVariable'
- $ref: '#/definitions/compartmentVariable'
- $ref: '#/definitions/faultDomainVariable'
- $ref: '#/definitions/regionVariable'
- $ref: '#/definitions/dbSystemVariable'
- $ref: '#/definitions/dbHomeVariable'
- $ref: '#/definitions/dbHomeVersionVariable'
- $ref: '#/definitions/databaseVariable'
- $ref: '#/definitions/autonomousDatabaseVariable'
- $ref: '#/definitions/autonomousContainerDBVariable'
- $ref: '#/definitions/kmsVaultVariable'
nonNegativeInteger:
type: integer
minimum: 0
nonNegativeIntegerDefault0:
allOf:
- $ref: '#/definitions/nonNegativeInteger'
- default: 0
arrayVariable:
allOf:
- $ref: '#/definitions/baseVariable'
- required: [type]
properties:
type:
enum: [array]
items:
$ref: '#/definitions/variable'
maxItems:
$ref: '#/definitions/nonNegativeInteger'
minItems:
$ref: '#/definitions/nonNegativeIntegerDefault0'
uniqueItems:
type: boolean
default: false
contains:
$ref: '#/definitions/variable'
additionalProperties: true
booleanVariable:
allOf:
- $ref: '#/definitions/baseVariable'
- required: [type]
properties:
type:
enum: [boolean]
default:
$ref: '#/definitions/booleanStatement'
default: false
additionalProperties: true
enumVariable:
allOf:
- $ref: '#/definitions/baseVariable'
- required: [type]
properties:
type:
enum: [enum]
enum:
type: array
items:
type: string
default:
$ref: '#/definitions/booleanStatement'
additionalProperties: true
integerVariable:
allOf:
- $ref: '#/definitions/baseVariable'
- required: [type]
properties:
type:
enum: [integer]
default:
type: integer
multipleOf:
type: number
exclusiveMinimum: 0
minimum:
type: number
maximum:
type: number
exclusiveMinimum:
type: number
exclusiveMaximum:
type: number
additionalProperties: true
numberVariable:
allOf:
- $ref: '#/definitions/baseVariable'
- required: [type]
properties:
type:
enum: [number]
default:
type: number
multipleOf:
type: number
exclusiveMinimum: 0
minimum:
type: number
maximum:
type: number
exclusiveMinimum:
type: number
exclusiveMaximum:
type: number
additionalProperties: true
stringVariable:
allOf:
- $ref: '#/definitions/baseVariable'
- required: [type]
properties:
type:
enum: [string]
default:
$ref: '#/definitions/booleanStatement'
pattern:
type: string
maxLength:
$ref: '#/definitions/nonNegativeInteger'
minLength:
$ref: '#/definitions/nonNegativeIntegerDefault0'
additionalProperties: true
passwordVariable:
allOf:
- $ref: '#/definitions/baseVariable'
- required: [type]
properties:
type:
enum: [password]
default:
$ref: '#/definitions/booleanStatement'
confirmation:
$ref: '#/definitions/booleanStatement'
additionalProperties: true
datetimeVariable:
allOf:
- $ref: '#/definitions/baseVariable'
- required: [type]
properties:
type:
enum: [datetime]
default:
$ref: '#/definitions/booleanStatement'
additionalProperties: true
imageVariable:
allOf:
- $ref: '#/definitions/baseVariable'
- required:
- type
- dependsOn
properties:
type:
enum: [oci:core:image:id]
pattern:
type: string
dependsOn:
type: object
required:
- compartmentId
properties:
compartmentId:
type: string
format: variablereference
shape:
type: string
format: variablereference
operatingSystem:
type: string
format: variablereference
operatingSystemVersion:
type: string
format: variablereference
additionalProperties: false
additionalProperties: true
instanceShapeVariable:
allOf:
- $ref: '#/definitions/baseVariable'
- required:
- type
- dependsOn
properties:
type:
enum: [oci:core:instanceshape:name]
pattern:
type: string
dependsOn:
type: object
required:
- compartmentId
properties:
imageId:
type: string
format: variablereference
compartmentId:
type: string
format: variablereference
additionalProperties: false
additionalProperties: true
subnetVariable:
allOf:
- $ref: '#/definitions/baseVariable'
- required:
- type
- dependsOn
properties:
type:
enum: [oci:core:subnet:id]
dependsOn:
type: object
required:
- vcnId
- compartmentId
properties:
vcnId:
type: string
format: variablereference
compartmentId:
type: string
format: variablereference
hidePublicSubnet:
$ref: '#/definitions/booleanStatement'
hidePrivateSubnet:
$ref: '#/definitions/booleanStatement'
hideRegionalSubnet:
$ref: '#/definitions/booleanStatement'
hideAdSubnet:
$ref: '#/definitions/booleanStatement'
additionalProperties: false
additionalProperties: true
vcnVariable:
allOf:
- $ref: '#/definitions/dependsOnCompartment'
- required: [type]
properties:
type:
enum: [oci:core:vcn:id]
additionalProperties: true
availabilityDomainVariable:
allOf:
- $ref: '#/definitions/dependsOnCompartment'
- required: [type]
properties:
type:
enum: [oci:identity:availabilitydomain:name]
additionalProperties: true
compartmentVariable:
allOf:
- $ref: '#/definitions/baseVariable'
- required: [type]
properties:
type:
enum: [oci:identity:compartment:id]
default:
$ref: '#/definitions/booleanStatement'
additionalProperties: true
faultDomainVariable:
allOf:
- $ref: '#/definitions/baseVariable'
- required:
- type
- dependsOn
properties:
type:
enum: [oci:identity:faultdomain:name]
dependsOn:
type: object
required:
- compartmentId
- availabilityDomainName
properties:
compartmentId:
type: string
format: variablereference
availabilityDomainName:
type: string
format: variablereference
additionalProperties: false
additionalProperties: true
regionVariable:
allOf:
- $ref: '#/definitions/baseVariable'
- required: [type]
properties:
type:
enum: [oci:identity:region:name]
default:
$ref: '#/definitions/booleanStatement'
default: ${session.region}
additionalProperties: true
dbSystemVariable:
allOf:
- $ref: '#/definitions/dependsOnCompartment'
- required: [type]
properties:
type:
enum: [oci:database:dbsystem:id]
additionalProperties: true
dbHomeVariable:
allOf:
- $ref: '#/definitions/baseVariable'
- required:
- type
- dependsOn
properties:
type:
enum: [oci:database:dbhome:id]
dependsOn:
type: object
required:
- dbSystemId
- compartmentId
properties:
dbSystemId:
type: string
format: variablereference
compartmentId:
type: string
format: variablereference
additionalProperties: false
additionalProperties: true
dbHomeVersionVariable:
allOf:
- $ref: '#/definitions/baseVariable'
- required:
- type
- dependsOn
properties:
type:
enum: [oci:database:dbhome:dbversion]
dependsOn:
type: object
required:
- dbHomeId
properties:
dbHomeId:
type: string
format: variablereference
additionalProperties: false
additionalProperties: true
databaseVariable:
allOf:
- $ref: '#/definitions/baseVariable'
- required:
- type
- dependsOn
properties:
type:
enum: [oci:database:database:id]
dependsOn:
type: object
required:
- dbHomeId
- compartmentId
properties:
dbHomeId:
type: string
format: variablereference
compartmentId:
type: string
format: variablereference
additionalProperties: false
additionalProperties: true
autonomousDatabaseVariable:
allOf:
- $ref: '#/definitions/dependsOnCompartment'
- required: [type]
properties:
type:
enum: [oci:database:autonomousdatabase:id]
additionalProperties: true
autonomousContainerDBVariable:
allOf:
- $ref: '#/definitions/dependsOnCompartment'
- required: [type]
properties:
type:
enum: [oci:database:autonomouscontainerdatabase:id]
additionalProperties: true
kmsVaultVariable:
allOf:
- $ref: '#/definitions/dependsOnCompartment'
- required: [type]
properties:
type:
enum: [oci:kms:vault:id]
additionalProperties: true
sshPublicKeyVariable:
allOf:
- $ref: "#/definitions/baseVariable"
- required: [type]
properties:
type:
enum: [oci:core:ssh:publickey]
additionalProperties: true
outputs:
type: object
additionalProperties:
$ref: '#/definitions/output'
output:
oneOf:
- $ref: '#/definitions/booleanOutput'
- $ref: '#/definitions/numberOutput'
- $ref: '#/definitions/stringOutput'
- $ref: '#/definitions/copyableStringOutput'
- $ref: '#/definitions/linkOutput'
- $ref: '#/definitions/ocidOutput'
- $ref: '#/definitions/mapOutput'
- $ref: '#/definitions/jsonOutput'
- $ref: '#/definitions/listOutput'
- $ref: '#/definitions/csvOutput'
outputGroups:
type: array
items:
$ref: '#/definitions/outputGroup'
outputGroup:
type: object
required:
- title
- outputs
properties:
title:
type: string
outputs:
type: array
items:
type: string
additionalProperties: true
baseOutput:
type: object
properties:
title:
type: string
description:
type: string
sensitive:
type: boolean
default: false
format:
type: string
visible:
type: boolean
default: true
additionalProperties: true
booleanOutput:
allOf:
- $ref: '#/definitions/baseOutput'
- required: [type]
properties:
type:
enum: [boolean]
value:
type: boolean
additionalProperties: true
numberOutput:
allOf:
- $ref: '#/definitions/baseOutput'
- required: [type]
properties:
type:
enum: [number]
value:
type: number
additionalProperties: true
stringOutput:
allOf:
- $ref: '#/definitions/baseOutput'
- required: [type]
properties:
type:
enum: [string]
value:
type: string
additionalProperties: true
copyableStringOutput:
allOf:
- $ref: '#/definitions/baseOutput'
- required: [type]
properties:
type:
enum: [copyableString]
value:
type: string
additionalProperties: true
mapOutput:
allOf:
- $ref: '#/definitions/baseOutput'
- required: [type]
properties:
type:
enum: [map]
value:
type: object
additionalProperties: true
jsonOutput:
allOf:
- $ref: '#/definitions/baseOutput'
- required: [type]
properties:
type:
enum: [json]
value:
type: object
additionalProperties: true
listOutput:
allOf:
- $ref: '#/definitions/baseOutput'
- required: [type]
properties:
type:
enum: [list]
value:
type: array
additionalProperties: true
csvOutput:
allOf:
- $ref: '#/definitions/baseOutput'
- required: [type]
properties:
type:
enum: [csv]
value:
type: array
additionalProperties: true
linkOutput:
allOf:
- $ref: '#/definitions/baseOutput'
- required: [type]
properties:
type:
enum: [link]
displayText:
type: string
minLength: 3
maxLength: 45
value:
$ref: '#/definitions/url'
additionalProperties: true
ocidOutput:
allOf:
- $ref: '#/definitions/baseOutput'
- required: [type]
properties:
type:
enum: [ocid]
value:
$ref: '#/definitions/ocid'
additionalProperties: true
Example Schema Document
Following is an example schema document.
# Title shown in Application Information tab.
title: Sample input variable schema
# Sub Title shown in Application Information tab.
description: Sample description...
informationalText: Sample informational text to display in tab...
schemaVersion: 1.1.0
version: "20190304"
# URL of Logo Icon used on Application Information tab. Logo must be 130x130 pixels.
# (Optional)
logoUrl: https://cloudmarketplace.oracle.com/marketplace/content?contentId=53066708
# Used in Application Information tab to Hyperlink Title and Logo to the Marketplace
# Listing.
# Also used to link to Listing Usage section for "View Instructions".
# (Optional) If it is missing, Application Information uses the
# "marketplace-listing-id" tag for the same purpose.
source:
type: marketplace
reference: 16132843
locale: "en"
variableGroups:
- title: "Node Configuration"
variables:
- targetCompartment
- ${nodeCount}
- ${nodeShapes}
- ${availability}
- title: "Application Details"
variables:
- ${username}
- ${password}
- ${dnsServers}
- title: "Subnet"
variables:
- ${vcnCompartment}
- ${myVcn}
- ${subnetCompartment}
- ${mySubnet}
- ${mySubnetWithFilter}
- ${hide_public_subnet}
- ${hide_private_subnet}
- ${hide_regional_subnet}
- ${hide_ad_subnet}
- title: "Database"
variables:
- ${dbCompartment}
- ${myDbSystem}
- ${myDbHome}
- ${myDb}
- ${myAutonomousDB}
- title: "Advanced"
variables:
- ${myImageId}
- ${myShape}
- ${myCompatibleShape}
visible: true
- title: "Hidden"
variables:
- ${myRegion}
visible: false
- title: "Existing Vcn"
variables:
- ${myVcn}
visible:
or:
- ${useExistingVcn}
- and:
- and:
- true
- true
- not:
- false
- title: "Password can't be 'password'!"
variables:
- ${password}
- title: "Complex Conditional Section"
variables:
- ${myVcn}
visible:
or:
- ${useExistingVcn}
- and:
- and:
- true
- true
- not:
- false
- title: "Equality Conditional Section"
variables:
- ${myVcn}
visible:
eq:
- ${objectStorageTier}
- standard
variables:
# string field
username:
type: string
minLength: 1
maxLength: 255
pattern: "^[a-z][a-zA-Z0-9]+$"
# title is used as the label if present
title: Username
# description used as the tooltip if present
description: Enter your username
default: admin
required: true
# password field
password:
description: Really Bad Password Field
type: password
pattern: "^[a-zA-z]{1,8}$"
required: true
# integer field
nodeCount:
type: integer
description: Number of Nodes
minimum: 3
maximum: 12
multipleOf: 3
# non-integer number field
availability:
type: number
default: 99.7
maximum: 100
minimum: 0
# string enum
objectStorageTier:
type: enum
enum:
- archive
- standard
# input a list, each element must be an ip addresses
dnsServers:
type: array
items:
type: string
pattern: "^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$"
minItems: 1
uniqueItems: true
default: [ 8.8.8.8, 8.8.4.4 ]
# datetime picker
expireDate:
type: datetime
# compartmentId dynamic dropdown, targetCompartment present in input variables
targetCompartment:
type: oci:identity:compartment:id
# ---- subnet picker ---- #
useExistingVcn:
type: boolean
vcnCompartment:
type: oci:identity:compartment:id
visible: ${useExistingVcn}
myVcn:
type: oci:core:vcn:id
dependsOn:
compartmentId: ${vcnCompartment}
visible:
or:
- ${useExistingVcn}
- and:
- and:
- true
- true
- not:
- false
subnetCompartment:
type: oci:identity:compartment:id
visible: ${useExistingVcn}
mySubnet:
type: oci:core:subnet:id
dependsOn:
compartmentId: ${subnetCompartment}
vcnId: ${myVcn}
visible: ${useExistingVcn}
mySubnetWithFilter:
type: oci:core:subnet:id
dependsOn:
compartmentId: ${subnetCompartment}
vcnId: ${myVcn}
hidePublicSubnet: ${hide_public_subnet}
hidePrivateSubnet: ${hide_private_subnet}
hideRegionalSubnet: ${hide_regional_subnet}
hideAdSubnet: ${hide_ad_subnet}
visible: ${useExistingVcn}
hide_public_subnet:
type: boolean
default: false
hide_private_subnet:
type: boolean
default: false
hide_regional_subnet:
type: boolean
default: false
hide_ad_subnet:
type: boolean
default: false
myRegion:
type: oci:identity:region:name
visible: false
myImageId:
type: oci:core:image:id
dependsOn:
compartmentId: ${targetCompartment}
myShape:
type: oci:core:instanceshape:name
dependsOn:
compartmentId: ${targetCompartment}
myCompatibleShape:
type: oci:core:instanceshape:name
dependsOn:
compartmentId: ${targetCompartment}
imageId: ${myImageId}
visible:
or:
- ${useExistingVcn}
- and:
- and:
- true
- true
- not:
- false
myAvailabilityDomain:
type: oci:identity:availabilitydomain:name
dependsOn:
compartmentId: ${targetCompartment}
visible: complexExpression
myFaultdomain:
type: oci:identity:faultdomain:name
dependsOn:
compartmentId: ${targetCompartment}
availabilityDomainName: ${myAvailabilityDomain}
dbCompartment:
type: oci:identity:compartment:id
myDbSystem:
type: oci:database:dbsystem:id
dependsOn:
compartmentId: ${dbCompartment}
myDbHome:
type: oci:database:dbhome:id
dependsOn:
dbSystemId: ${myDbSystem}
compartmentId: ${dbCompartment}
myDbHomeVersion:
type: oci:database:dbhome:dbversion
dependsOn:
dbHomeId: ${myDbHome}
myDb:
type: oci:database:database:id
dependsOn:
dbHomeId: ${myDbHome}
compartmentId: ${dbCompartment}
myAutonomousDB:
type: oci:database:autonomousdatabase:id
dependsOn:
compartmentId: ${dbCompartment}
# Used to present outputs with more refinement on the Application Information tab.
# The Application Information tab is only shown if the schema has a "title",
# "description", and at least one output in this "outputs" section.
#
# type:
# - boolean
# - string
# - number
# - link - contains url that can be hyperlinked. If type is not specified and the
# value is a proper url, this type is assumed.
# - ocid - contains an OCID. An attempt is made to hyperlink it to the designated
# resource in the console.
# - csv - synonym for list. Array of values converted to a comma separated list.
# - json - synonym for map. Map of key / values converted to JSON.
# - list - array of values converted to a comma separated list.
# - map - map of key / values converted to JSON.
#
# displayText: used in links to give text displayed instead of value
# title: friendly label
# visible: if false, this ouptut is not shown in the outputs section of Application Information.
# It can still be used as the primaryOutputButton.
outputs:
controlCenterUrl:
type: link
title: Control Center
displayText: Control Center
visible: false
schemaRegistryUrl:
type: link
title: Schema Registry
displayText: Schema Registry
schemaRegistryPublicIps:
type: csv
title: Public IPs
schameRegistryLoadBalancer:
type: ocid
title: Load Balancer
brokerPublicIps:
type: csv
connectUrl:
type: link
title: Connect
displayText: Connect
connectPublicIps:
type: csv
title: Public IPs
restUrl:
type: link
title: Rest API
# primaryOutputButton is a reference to a link output that creates a primary button
# on the Application Information tab.
# (Optional) if not provided, no primary button is shown. Also if the output
# referenced is not a link output, no button is shown.
primaryOutputButton: ${controlCenterUrl}
# Used to group Outputs. Any outputs not included in these defined groups, are
# included in a default group labelled "Outputs".
# (Optional) if not groups are given, outputs are not grouped at all.
outputGroups:
- title: Schema Registry
outputs:
- ${schemaRegistryUrl}
- ${schemaRegistryPublicIps}
- ${schemaRegistryInstances}
- ${schemaRegistryLoadBalancer}
- title: Broker / Connect
outputs:
- ${brokerPublicIps}
- ${brokerInstances}
- ${connectUrl}
- ${connectPublicIps}
- ${restUrl}
How to Control Console Items
This section provides instructions and examples for controlling the display of stack variables and stack details page items in the Oracle Cloud Infrastructure Console for stacks created from your Terraform configuration file. Using a schema document, you can define how variables look and behave during stack creation and what text is displayed in the Application Information tab for a created stack.
Following are Console display items that are controlled by the schema document. To see relevant instructions and examples, expand a display item that you're interested in.
To render a field label and description for a variable:
- Add the lines
title: <field_label>
anddescription: <field_description>
.
Example image for a variable field label and description:
Example declaration for a variable field label and description:
functions_app_name:
type: string
# field label, displayed above field
title: "Application Name"
# field description, displayed below field
description: "Do not use spaces."
To render a variable with a default value:
- Add the line
default: <default-value>
.
Example image for a variable with a default value:
Example declaration for a check box variable:
functions_app_name:
type: string
title: "Application Name"
description: "Do not use spaces."
required: true
# provide a default value
default: "DataScienceApp"
To render a group (box) of variables, with the variables in a prescribed sequence:
- Add a
variableGroups
block. - Add a
title
line to this block. - Add a
variables
block tovariableGroups
. - Add variables to the
variables
block in the order you want.
Example image for a group of variables:
Example declaration for a group of variables with a prescribed order:
variableGroups:
- title: "Network Configuration"
variables:
- ods_vcn_use_existing
- ods_vcn_existing
- ods_vcn_name
- ods_vcn_cidr
- ods_subnet_public_existing
- ods_subnet_public_name
- ods_subnet_public_cidr
- ods_subnet_private_existing
- ods_subnet_private_name
- ods_subnet_private_cidr
- Add the line
type: oci:core:ssh:publickey
.
Example image for an SSH key control:
Example declaration for an SSH key control:
ssh_public_key:
title: SSH Public Key
description: The public SSH key for the key-pair that you want to use, if you wish to
login to the instances over SSH
# renders variable as an SSH key control
type: oci:core:ssh:publickey
required: true
pattern: "((^(ssh-rsa AAAAB3NzaC1yc2|ecdsa-sha2-nistp256
AAAAE2VjZHNhLXNoYTItbmlzdHAyNT|ecdsa-sha2-nistp384
AAAAE2VjZHNhLXNoYTItbmlzdHAzODQAAAAIbmlzdHAzOD|ecdsa-sha2-nistp521
AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1Mj|ssh-ed25519
AAAAC3NzaC1lZDI1NTE5|ssh-dss AAAAB3NzaC1kc3)[0-9A-Za-z+\/]+[=]{0,3})( [^,]*)?)
(,((ssh-rsa AAAAB3NzaC1yc2|ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNT|ecdsa-sha2-nistp384
AAAAE2VjZHNhLXNoYTItbmlzdHAzODQAAAAIbmlzdHAzOD|ecdsa-sha2-nistp521
AAAAE2VjZHNhLXNoYTItbmlzdHA1MjEAAAAIbmlzdHA1Mj|ssh-ed25519
AAAAC3NzaC1lZDI1NTE5|ssh-dss AAAAB3NzaC1kc3)[0-9A-Za-z+\/]+[=]{0,3})( [^,]*)?)*$"
To dynamically prepopulate variables with values based on dependencies:
- Add the lines
type: <supported-type>
anddependsOn: <other_variable>
.<supported-type> is a type listed at Supported Types (Dynamic Prepopulation and Controls).
Example image for a dynamically prepopulated variable:
Example declaration for a dynamically prepopulated variable:
ods_vcn_existing:
# prepopulates available values for VCN
type: oci:core:vcn:id
title: "Select VCN"
# determines values for prepopulation from selected compartment
dependsOn:
compartmentId: compartment_ocid
Example declarations for VCN depending on compartment, subnet depending on both compartment and VCN:
vcnCompartment:
# prepopulates available values for compartment
type: oci:identity:compartment:id
myVcn:
# prepopulates available values for VCN
type: oci:core:vcn:id
# determines values for VCN prepopulation from selected compartment
dependsOn:
compartmentId: ${vcnCompartment}
subnetCompartment:
# prepopulates available values for compartment
type: oci:identity:compartment:id
mySubnet:
# prepopulates available values for subnet
type: oci:core:subnet:id
# determines values for subnet prepopulation from selected compartment and VCN
dependsOn:
compartmentId: ${subnetCompartment}
vcnId: ${myVcn}
Image example declaration 1, where image depends on
compartment only (the one mandatory dependsOn
field):
instance_image:
title: Image
description: Image
type: oci:core:image:id
required: true
dependsOn:
compartmentId: ${compartment_ocid}
Image example declaration 2, where image depends on compartment, operating system, operating system version, and shape:
instance_image:
title: Image
description: Image
type: oci:core:image:id
required: true
dependsOn:
compartmentId: ${compartment_ocid}
operatingSystem: "Oracle Linux"
operatingSystemVersion: "7.8"
shape: "<shape name>"
To render enumerated values for a variable:
- Add the lines
type: enum
and add anenum
block.
Example image for a variable with enumerated values:
Example declaration for a variable with enumerated values:
ods_vault_type:
type: enum
title: "Vault Type"
default: "DEFAULT"
# enumerated values
enum:
- DEFAULT
- VIRTUAL_PRIVATE
Supported operations include "eq", "and", "or", and "not". Groups have higher priority than the groups' constituent variables. For example, if a variable is visible within a group that is not visible, then the entire group is not visible.
- Add the line
visible: <other_variable>
.
Example image for a set of variables, where visibility of the "Application Name" and "API Gateway Name" fields is dependent on the "Provision Functions and API Gateway?" check box:
Example declarations that show the "Application Name" and "API Gateway Name"
fields (functions_app_name
and
apigateway_name
) only when the "Provision Functions and API
Gateway?" check box (enable_functions_apigateway
) is
selected:
enable_functions_apigateway:
type: boolean
title: "Provision Functions and API Gateway?"
required: true
default: true
functions_app_name:
type: string
title: "Application Name"
description: "Do not use spaces."
required: true
default: "DataScienceApp"
pattern: "^[a-zA-Z0-9]+$"
# show only when enable_functions_apigateway variable is selected
visible: enable_functions_apigateway
apigateway_name:
type: string
title: "API Gateway Name"
required: true
default: "Data Science Gateway"
# show only when enable_functions_apigateway variable is selected
visible: enable_functions_apigateway
- Add the line
type: password
.
- Add the line
confirmation: true
.
Example image for a password variable that requires confirmation:
Example declaration for a password variable, requiring confirmation:
password:
title: Repository Password
description: Must match remote repository password
# renders variable as a password field
type: password
# renders a second field to re-enter the password for confirmation
confirmation: true
pattern: "^[a-zA-z]{1,8}$"
required: true
To require a value for a variable:
- Add the line
required: true
.
Example image for a required variable, with validation warning:
Example declaration for a required variable:
availability_domain:
type: oci:identity:availabilitydomain:name
dependsOn:
compartmentId: compartment_ocid
# displays validation warning if no value is selected or entered
required: true
title: "Available Domain"
description: "Available Domain"
default: "tabw:PHX-AD-1"
To mark a variable as optional:
- Add the line
required: false
.
Example image for an optional variable:
Example declaration for a variable with enumerated values:
volume_group_display_name:
type: string
# displays "Optional" marking to right of field label
required: false
title: "Block Volume Group Display Name"
description: "Display name of the Block Volume Group"
To validate the value entered for a variable against a regular expression pattern:
- Add the line
pattern: <regular-expression>
.<regular-expression> is the validation pattern specific to the value you want to validate.
Hyperlink pattern example:
^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)$
Example image for a validation error for an entered value:
Example declaration for a variable with a validation pattern:
functions_app_name:
type: string
title: "Application Name"
description: "Do not use spaces."
required: true
default: "DataScienceApp"
# validate entered value against alphanumeric regular expression
pattern: "^[a-zA-Z0-9]+$"
To display the Application Information tab for a stack created from your Terraform configuration:
- Add lines for the schema
title
anddescription
. - Add at least one output in the
outputs
section.
- Set the type: Add the line
type: copyableString
.
Example image for the Application Information tab:
Example declaration for a schema title, description, and outputs:
# heading under Application Information tab
title: "OCI Developer Tools"
# text under heading
description: "OCI Developer Tools like CLI, SDK, Terraform and Ansible are pre-installed on the compute instance."
stackDescription: "OCI Developer Tools are pre-installed on the compute instance."
# text in blue information box
informationalText: "The auto-generated SSH private key should not be used for production use, instead,
the user should generate the SSH key-pair and upload the public key for the compute instance. To connect
to the compute instance, copy the ssh private key pem content into a file on your machine. Run the following
command from the terminal [ssh -i <path to the pem file> opc@<Public IP>]."
…
# output variable field names and values
outputs:
compute_instance_public_ip:
title: "Compute Instance Public IP"
displayText: ${Messages.solutionsHub.solutions.ociDevTools.outputs.compute_instance_public_ip.displayText()}
type: copyableString
visible: true
compartment_id:
title: "Compartment Id"
displayText: ${Messages.solutionsHub.solutions.ociDevTools.outputs.compartment_id.displayText()}
type: string
visible: true
generated_instance_ssh_private_key:
title: "Generated Private Key for SSH Access"
displayText: ${Messages.solutionsHub.solutions.ociDevTools.outputs.generated_instance_ssh_private_key.displayText()}
type: string
visible: true