Review requirements, supported types, and examples for schema documents used with Terraform configurations in Resource Manager.
Schema documents are recommended for Terraform configurations when using Resource Manager. Including a schema document allows you to extend pages in the Oracle Cloud Infrastructure
Console. Facilitate variable entry in the Create stack page by surfacing SSH key controls and by naming, grouping, dynamically prepopulating values, and more. Define text in the Application Information tab of the Stack details page that opens for a created stack.
Requirements for Schema Documents
Schema documents for Resource Manager have the following
requirements:
For example, let's say that you declare the type number for the availability variable in the schema. In this situation, availability must have the same declared type (number) in the associated Terraform configuration. (By default, variables with no declared type use string.)
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.
Most types require the compartment OCID (dependsOn: required: compartmentId). Some types have additional required or optional items. To determine required and optional items for a type, see Meta Schema for Validation.
Optionally filter dynamically prepopulated lists by other variables using dependsOn. For example, filter subnets by VCN. For more information, see Dynamic prepopulation.
Note
Descriptions in schema.yaml files are HTML encoded in the output.
When defined in the Terraform configuration, the following variables automatically prepopulate with values on the Console pages used to create and edit the stack. The stack's values are used when you select the Terraform actions Plan, Apply, and Destroy.
Surfaces a control for adding a single file by dropping or browsing. When this control is surfaced, a user can upload a file of any extension, such as a license key or certificate. For more information, see File control.
# 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: "Network Configuration"
variables:
- ${service_gateway}
- ${nat_gateway}
- ${load_balancer}
- ${myNsg}
- ${Kubernetes_version}
- ${backup_policies}
- ${mount_target}
- title: "Existing Groups"
variables:
- ${iam_groups_use_existing}
- title: "Identity"
variables:
- ${iam_groups}
- ${iam_dynamic_groups}
- ${iam_domains}
- title: "Database"
variables:
- ${dbCompartment}
- ${myDbSystem}
- ${myDbHome}
- ${myDb}
- ${myAutonomousDB}
- ${myAutonomousDBVersion}
- title: "Advanced"
variables:
- ${myImageId}
- ${myInstance}
- ${myShape}
- ${myCompatibleShape}
- ${myCompatibleShapeBasedOnAd}
- ${multilineText}
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
- title: "Less than Conditional Section"
variables:
- ${myVcn}
visible:
lt:
- ${availability}
- 5
- title: "Less than or Equal Conditional Section"
variables:
- ${myVcn}
visible:
le:
- ${availability}
- 4
- title: "Greater than Conditional Section"
variables:
- ${myVcn}
visible:
gt:
- ${availability}
- 5
- title: "Greater than or Equal Conditional Section"
variables:
- ${myVcn}
visible:
ge:
- ${availability}
- 4
- title: "Vault section"
variables:
- ${myVault}
- ${myVaultKey}
- ${mode}
- ${myCompatibleKey}
- ${algo}
- ${myCompatibleKeyBasedOnAlgo}
- ${mySecret}
- ${myVaultSecret}
- title: "DataScience"
variables:
- ${ods_project_ocid}
- title: "Generic File"
variables:
- ${generic_file}
- title: "Resource Tagging"
variables:
- ${tag}
- title: "Resource Manager Section"
variables:
- ${private_endpoint_ocid}
- title: "APM Domain Selection"
variables:
- ${apmDomain}
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
allowMultiple: false
# 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
load_balancer:
type: oci:loadbalancer:loadbalancer:id
pattern: ^(10)Mbps.*$
title: Existing LBaaS for "Application" Evaluation
required: true
dependsOn:
compartmentId: ${vcnCompartment}
Kubernetes_version:
type: oci:kubernetes:versions:id
title: Kubernetes version
description: The Oracle cloud kubernetes version for tenancy.
required: true
visible: true
dependsOn:
compartmentId: ${vcnCompartment}
clusterOptionId: "all"
backup_policies:
type: oci:blockstorage:policies:id
title: Backup Policy
description: The Oracle Cloud Backup Policy for tenancy.
required: true
mount_target:
type: oci:mount:target:id
title: Mount target
description: The Oracle Cloud mount target
dependsOn:
compartmentId: ${targetCompartment}
availabilityDomain: ${myAvailabilityDomain}
myNsg:
type: oci:core:nsg:id
title: "Network Security Group"
description: "Network Security Group description"
dependsOn:
compartmentId: ${vcnCompartment}
service_gateway:
type: oci:core:servicegateway:id
title: NAT Gateway
dependsOn:
compartmentId: ${vcnCompartment}
vcnId: ${myVcn}
nat_gateway:
type: oci:core:servicegateway:id
title: NAT Gateway
dependsOn:
compartmentId: ${vcnCompartment}
vcnId: ${myVcn}
iam_groups_use_existing:
type: boolean
title: Use existing Groups
required: true
default: false
iam_groups:
type: oci:identity:groups:id
title: Group Name
dependsOn:
compartmentId: ${targetCompartment}
visible:
or:
- ${iam_groups_use_existing}
- and:
- and:
- true
- true
- not:
- false
iam_dynamic_groups:
type: oci:identity:dynamicgroups:id
title: Dynamic Group Name
dependsOn:
compartmentId: ${targetCompartment}
visible:
or:
- ${iam_groups_use_existing}
- and:
- and:
- true
- true
- not:
- false
iam_domains:
type: oci:identity:domains:id
title: Domain Name
dependsOn:
compartmentId: ${targetCompartment}
visible:
or:
- ${iam_groups_use_existing}
- and:
- and:
- true
- true
- not:
- 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}
myInstance:
type: oci:core:instance:id
dependsOn:
compartmentId: ${targetCompartment}
myCompatibleShape:
type: oci:core:instanceshape:name
dependsOn:
compartmentId: ${targetCompartment}
imageId: ${myImageId}
visible:
or:
- ${useExistingVcn}
- and:
- and:
- true
- true
- not:
- false
myCompatibleShapeBasedOnAd:
type: oci:core:instanceshape:name
dependsOn:
compartmentId: ${targetCompartment}
availabilityDomain: ${myAvailabilityDomain}
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}
dbWorkload: "DW"
myAutonomousDBVersion:
type: oci:database:autonomousdatabaseversion:id
title: AutonomousDatabaseVersionTitle
description: AutonomousDatabaseVersionDescription
required: true
default: "19c"
dependsOn:
compartmentId: ${compartment_ocid}
dbWorkload: "AJD"
container_cluster_ocid:
type: oci:container:cluster:id
required: true
title: OKE Cluster
description: Kubernetes cluster managed by OCI Container Engine for Kubernetes
dependsOn:
compartmentId: ${compartment_ocid}
myVault:
type: oci:kms:vault:id
title: "vault"
description: "vault"
dependsOn:
compartmentId: ${targetCompartment}
myVaultKey:
type: oci:kms:key:id
title: "key"
description: "key"
dependsOn:
compartmentId: ${targetCompartment}
vaultId: ${myVault}
mode:
type: enum
enum:
- Hsm
- Software
allowMultiple: false
myCompatibleKey:
type: oci:kms:key:id
title: "key"
description: "key"
dependsOn:
compartmentId: ${targetCompartment}
vaultId: ${myVault}
protectionMode: ${mode}
algo:
type: enum
enum:
- AES
- RSA
- ECDSA
allowMultiple: true
myCompatibleKeyBasedOnAlgo:
type: oci:kms:key:id
title: "key"
description: "key"
dependsOn:
compartmentId: ${targetCompartment}
vaultId: ${myVault}
protectionMode: ${mode}
algorithm: ${algo}
mySecret:
type: "oci:kms:secret:id"
title: "secret"
description: "secret"
dependsOn:
compartmentId: ${targetCompartment}
myVaultSecret:
type: "oci:kms:secret:id"
title: "secret"
description: "secret"
dependsOn:
compartmentId: ${targetCompartment}
vaultId: ${myVault}
ods_project_ocid:
type: oci:ods:project:id
required: true
title: odsProject
description: "Select ods project from list"
dependsOn:
compartmentId: ${targetCompartment}
generic_file:
type: file
required: true
title: GenericFile
description: "Drop a raw file (stored as base64 string data)"
tag:
type: oci:identity:tag:value
required: true
title: Tagging
description: Tag value for resource created
dependsOn:
compartmentId: ${targetCompartment}
private_endpoint_ocid:
type: oci:resourcemanager:privateendpoint:id
required: true
title: privateEndpoint
description: "Resource Manager Private Endpoint for Private Access"
dependsOn:
compartmentId: ${targetCompartment}
vcnId: ${vcnId}
multilineText:
type: text
required: false
multiline: true
title: Multi-line value
description: Multi-line value
default: "First line\nSecond line\nThird line"
apmDomainVariable:
type: oci:apm:domain:id
title: "APM Domain"
description: "APM Domain"
dependsOn:
compartmentId: ${targetCompartment}
# 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
schemaRegistryLoadBalancer:
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 🔗
Use a schema document to control the display of stack variables and other items on stack details pages in the Console.
This display control is available for stacks created from a 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 the schema document controls. To see relevant instructions and examples, expand a display item that you're interested in.
ssh_public_key:
title: SSH public key
description: Public SSH key to be included in the ~/.ssh/authorized_keys file for the default user on the instance
# renders variable as an SSH key control
type: oci:core:ssh:publickey
additionalProps:
allowMultiple: true
required: false
default: [""]
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})( [^,]*)?)*$"
The uploaded file is stored in Base64 format. To use the file, decode the output. For example, add the following code to an outputs.tf file in the Terraform configuration.
output "generic_file_raw" {
value = base64decode(var.generic_file)
}
Example image for a file control:
Example declaration for a file control:
generic_file:
type: file
title: generic_file
description: Drop any file or browse
required: true
To prepopulate tag values in the Console, access the values from the Terraform configuration. For example, add the following code to a main.tf file in the Terraform configuration.
Example image for a dynamically prepopulated variable:
Example declaration for a dynamically prepopulated variable:
vcn_ocid:
"title": "Virtual cloud network (VCN)",
"description": "The virtual cloud network to use with the compute instance. You can use the subnets template to create a VCN."
# prepopulates available values for VCN
type: oci:core:vcn:id
# determines values for prepopulation from selected compartment
dependsOn:
compartmentId: compartment_ocid
required: true
default: ""
Example declarations for VCN depending on compartment, with 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):
ods_vcn_use_existing:
# renders variable as a check box
type: boolean
title: "Enable vault support?"
description: "Use a vault to store secrets and manage encrypted resources."
required: true
default: false
Groups have higher priority than the groups' constituent variables. For example, if a variable is visible within a group that isn't visible, then the entire group isn't visible.
Supported operations:
and
eq (equal)
ge (greater than or equal)
gt (greater than)
le (less than or equal)
lt (less than)
not
or
To hide or show variables or variable groups depending on other variables:
Add the line visible: <other_variable>.
Example of variable Use existing vault?, whose visibility depends on the user selection for the variable Enable vault support?:
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_vault:
type: boolean
title: "Enable vault support?"
description: "Use a vault to store secrets and manage encrypted resources."
required: true
default: false
ods_use_existing_vault:
type: boolean
title: "Use existing vault?"
description: "Use a pre-existing vault in the current compartment."
required: true
default: false
# show only when enable_vault variable is selected
visible: enable_vault
To require re-entry for confirmation of the entered password:
Add the line confirmation: true.
Example image for a password variable that requires confirmation:
Example declaration for a password variable, requiring confirmation:
wp_admin_password:
title: "WordPress administrator password"
description: "The password must be more than 8 characters and include at least one uppercase letter, one lowercase letter, one number, and one of the following special characters: !@#%^*_+-:?.,[]{}"
# renders variable as a password field
type: password
# renders a second field to re-enter the password for confirmation
confirmation: true
pattern: "^(?=.*[!@#%^*_+\\-:?.,\\[\\]\\{\\}])(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?!.*[$\\(\\)]).{8,32}$"
required: true
Example image for a required variable, with validation warning:
Example declaration for a required variable:
vcn_ocid:
"title": "Virtual cloud network (VCN)",
"description": "The virtual cloud network to use with the compute instance. You can use the subnets template to create a VCN."
type: oci:core:vcn:id
dependsOn:
compartmentId: compartment_ocid
# displays validation warning if no value is selected or entered
required: true
default: ""
private_ip:
title: "Private IP"
description: "Private IP address of your choice to assign to the VNICs."
type: string
# displays "Optional" marking to right of field label
required: false
default: ""
Example image for a validation error for an entered value:
Example declaration for a variable with a validation pattern:
wp_admin_password:
title: "WordPress administrator password"
description: "The password must be more than 8 characters and include at least one uppercase letter, one lowercase letter, one number, and one of the following special characters: !@#%^*_+-:?.,[]{}"
type: password
confirmation: true
# validate entered value against alphanumeric regular expression
pattern: "^(?=.*[!@#%^*_+\\-:?.,\\[\\]\\{\\}])(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?!.*[$\\(\\)]).{8,32}$"
required: true
The output of a sensitive-marked variable displays as <sensitive> with an Unlock option in the Application information tab. This tab is visible in the Job details and Stack details pages.
Example image for a sensitive-marked variable (Generated SSH private key) on the Application information tab:
To display the Application information tab for a stack created from your Terraform configuration:
Add lines for the schema title and
description.
Optionally add a line for a blue informational text box: informationalText.
Add at least one output in the outputs section, optionally grouped using outputGroups.
To allow copying of an output value displayed in the Application information tab:
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: "Deploy a WordPress instance"
# text under heading
description: "Create your own website or blog using WordPress."
...
# output variable groups
outputGroups:
- title: "Service endpoints"
outputs:
- wordpress_public_ip
- title: "Generated passwords"
outputs:
- generated_ssh_private_key
...
# output variable field names and values
outputs:
wordpress_public_ip:
type: link
title: "Your WordPress website"
generated_ssh_private_key:
title: "Generated SSH private key"
sensitive: true
How to Interact with Console
Items 🔗
This section describes how to interact with schema-controlled display of stack
information in the Oracle Cloud Infrastructure
Console.
Stack information is affected by the schema document (if any) that you include in the Terraform configuration for creating the stack. The schema document affects how variables look and behave during stack creation and what text is displayed in the Application Information tab for a created stack.