Skip to content
This repository has been archived by the owner on Oct 5, 2023. It is now read-only.

This is a simple starter example to demonstrate the use of complex variables with Schematics Blueprints

Notifications You must be signed in to change notification settings

Cloud-Schematics/blueprint-complex-inputs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blueprints example of working with complex Terraform variables

This is a starter example to demonstrate creating a simple scalable Blueprint from two linked Workspaces. It demonstrates working with complex Terraform input variables and resource data passing between the Workspaces. No cloud resources are created by this example.

Following Terraform resources are deployed:

  • null-resource (no IBM Cloud resources are deployed)

Blueprint definition - complex-blueprint.yaml

The Blueprint creates two modules, linking two Terraform configs as Workspaces.

  • terraform_module1
  • terraform_module1

The module TF configs are sourced from https://github.com/Cloud-Schematics/blueprint-example-modules

Blueprint file: complex-blueprint.yaml
├── terraform_module1
|    └── source: github.com/Cloud-Schematics/blueprint-example-modules/tf-inputs-outputs
└── terraform_module2
     └── source: github.com/Cloud-Schematics/blueprint-example-modules/tf-inputs-outputs

Blueprint definition inputs

The complex-blueprint.yaml definition file accepts the following inputs:

Name Type Value Description
region string null Sample string var for resource deployment region
resource_group string null Sample string var for resource group
sample_var string null Sample string var
boolean_var string null true/false
list_any_flow_scalar list(any) null
list_any_block_scalar list(any) null
docker_ports list(object({
internal = number
external = number
protocol = string })
null Sample complex input variable

Blueprints Outputs

The complex-blueprint.yaml definition creates the following outputs:

Name Type Value Description
nested_complex list(object({
internal = number
external = number
protocol = string })
Sample output dynamically created

Input file - complex-input.yaml

The input file defines the variable values for all the required Blueprint definition inputs. Review the file contents to observe the difference in formatting for the yaml scalar and block scalar formats.

Name Type Value Description
region string us-east Sample var for resource deployment region
resource_group string default Sample var for resource group
sample_var string testconfig Sample var
boolean_var string false Sample boolean var
list_any_flow_scalar list(any) ["36", "mqm-grand", "madison-circle-garden"] list in yaml scalar format
list_any_block_scalar: list(any) [
"36",
"mqm-grand",
"madison-circle-garden"
]
list in yaml block scalar format
docker_ports list(object({
internal = number
external = number
protocol = string })
[{ internal = 9900
external = 9900
protocol = "tcp"
}, {
internal = 9901
external = 9901
protocol = "ldp" }]
Sample complex input variable

Prerequisites

  1. Install the Schematics CLI plugin by follow the instructions in the documentation
  2. Configure IAM access permissions for the Schematics Blueprints service.
  3. Set Schematics Target Region The target (manage from) Schematics region for the Blueprint instance is determined by the IBM Cloud CLI target region. The region can be set with the ibmcloud target command.

Usage

The example command input here uses the minimum rights to create new resources. It assumes that the IBM Cloud resource group Default exists and the user has been granted Schematics access permissions to this group.

The following parameters are used for the blueprint create configuration.

  • Name of the blueprint: Blueprint_complex_inputs
  • Schematics management resource group: Default
  • Blueprint URL: https://github.com/Cloud-Schematics/blueprint-complex-inputs
  • Blueprint file: complex-blueprint.yaml
  • Blueprint Git branch main
  • Input file URL: https://github.com/Cloud-Schematics/blueprint-complex-inputs
  • Input file: complex-input.yaml
  • Input file Git branch main

Example commands

$ ibmcloud target -r <region>

$ ibmcloud schematics blueprint create -name Blueprint_Complex -resource-group Default -bp-git-url https://github.com/Cloud-Schematics/blueprint-complex-inputs -bp-git-branch main -bp-git-file complex-blueprint.yaml -input-git-url https://github.com/Cloud-Schematics/blueprint-complex-inputs -input-git-branch main -input-git-file complex-input.yaml 


$ ibmcloud schematics blueprint install -id blueprint_id

$ ibmcloud schematics blueprint job list -id blueprint_id

$ ibmcloud schematics blueprint get -id blueprint_id -profile outputs

$ ibmcloud schematics blueprint destroy -id blueprint_id

$ ibmcloud schematics blueprint delete -id blueprint_id

Next Steps

Looking for more samples? Check out the {{site.data.keyword.bplong_notm}} GitHub repository.

Check the example Readme files for further Blueprint customization and usage scenarios for each sample.

About

This is a simple starter example to demonstrate the use of complex variables with Schematics Blueprints

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published