Giter Site home page Giter Site logo

geethasathyamurthy / blueprint-complex-inputs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cloud-schematics/blueprint-complex-inputs

0.0 0.0 0.0 14 KB

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

blueprint-complex-inputs's Introduction

Blueprints example of working with complex Terraform variables

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

The default variable type is string and does not need to be specified in the blueprint.yaml definition. Where Terraform configs and modules require complex input variables, the Terraform varaible type must be specified in the module block on the module input statement.

Input files support specifying complex Terraform input values in yaml format. The format of a number of common complex types is illustrated in the complex-input.yaml file section below.

Blueprint CLI inputs only support string values.

Following resources are deployed:

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

Blueprint definition - complex-blueprint.yaml

The blueprint links two Terraform configs as Workspaces.

  • terraform_module1
  • terraform_module1

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
boolian_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 formating 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
boolian_var string false Sample boolian 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

Prerequisities

  • Resource group Default exists for Schematics IAM access control.

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

TEMPORARY USE OF payload_complex.json file from /test folder for CLI testing

copy payload_complex.json to CLI execution folder

Choose a Resource Group to associate the Blueprint with for Access Control. Available Resource Groups can be confirmed from the Console Resource Groups page.  

Depending on your account the RG in the payload_complex.json file may need changing to the name of an existing RG. Note some accounts have 'Default', others 'default'.

$ ibmcloud target -r <region>

$ ibmcloud schematics blueprint create --file payload_complex.json

CLI flag support due 27th June 2022

$ ibmcloud schematics blueprint create 
-name=Blueprint_Complex
-resource_group=Default
-bp_git_url https://github.com/Cloud-Schematics/blueprint-complex-inputs/complex_blueprint.yaml
-input_git_url https://github.com/Cloud-Schematics/blueprint-complex-inputs/complex_input.yaml
$ ibmcloud schematics blueprint install -id blueprint_id

$ ibmcloud schematics blueprint jobs -id blueprint_id

$ ibmcloud schematics blueprint get -id blueprint_id

$ ibmcloud schematics blueprint destroy -id blueprint_id

$ ibmcloud schematics blueprint delete -id blueprint_id

blueprint-complex-inputs's People

Contributors

kshamag avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.