GithubHelp home page GithubHelp logo

terraform-academy-ibmcloud's Introduction

Example of Terraform IBM Cloud Academy Training

This Terraform automation illustrates how to setup the cloud resources for training purpose and that can be decommission after X mnts / Hrs using IBM Cloud Schematics. Auto decommission of PaaS services driven via Cloud functions.

plot

Use cases

'Course Admin' usecases

  • Use the course admin's account, to provision the IBM Cloud services (as per the course content), in each Student account, 'course_content' resource group.
  • Use the course admin's account, to automatically destroy the course_content_resources; after 6 hours.
  • Use the course admin's account, to manually destroy & provision the course_content_resources.

'Students' usecases

  • Work with the course-content (Virtual server for VPC, watson-studio, machine-learning, etc..) provisioned in the 'course_content' resource group.
  • Will not be able to administer (create, delete, ..) the course-content resources.

Instructions

  1. Login into Enterprise account.
  2. Make sure that you are assigned the correct permissions to create workspaces and deploy resources.
  3. Create the Schematics governance workspace:
    1. From the IBM Cloud menu select Schematics.
      • Click Create workspace.
      • Enter a name for your workspace.
      • Click Create to create your workspace.
    2. On the workspace Settings page, enter this URL - https://github.com/Cloud-Schematics/terraform-academy-ibmcloud/tree/dev
    • Select the Terraform version: Terraform 1.0 or higher
    • Click Save template information.
    • In the Input variables section, The only one required parameter is:
      • ibmcloud_api_key of the student IBM Cloud acccount
    • Click Save changes.
    • The student account governance workspace is completed.
  4. Now apply your Terraform template by clicking Apply plan.
  5. As part of this Apply action, the PaaS services that are required for the student training will be provisioned in given students account.
  6. Also Cloud function will be created in the owner's enterprise account which will monitor the student's account resources. This cloud function cron-job will de-provision student account resources after the X mins.

Note

  • When you provision Virtual server for VPC, By default it allocates only 10 VPC per region.
  • If Apply Plan fails on student workspace, Governance workspace will continue to configure the decommission timer on failed workspace. Governance workspace will report the Apply Plan failure as warning & ask admin to check workspace apply logs for more details on failure.

Compatibility

This module is meant for use with Terraform 0.13 or later.

Requirements

Terraform plugins

Install

IBM Cloud CLI

Be sure you have installed IBM Cloud plug-in for Satellite

Terraform

Be sure you have the correct Terraform version ( 0.13 or later), you can choose the binary here:

Terraform provider plugins

Be sure you have the compiled plugins on $HOME/.terraform.d/plugins/

Usage

terraform init
terraform plan
terraform apply
terraform destroy

Example Usage

module "course_governance" {
  source = "./course-governance"

  ibmcloud_api_key  = var.ibmcloud_api_key
  user_list  = var.user_list
  decomission_timer = var.decomission_timer
  course_prefix     = var.course_prefix
  create_bc         = var.create_bc
  bch_plan          = var.bch_plan
  create_iot        = var.create_iot
  iot_plan          = var.iot_plan
  create_ml         = var.create_ml
  ml_plan           = var.ml_plan
  create_ws         = var.create_ws
  ws_plan           = var.ws_plan
  create_vsi        = var.create_vsi
  image             = var.image
  profile           = var.profile
}

Inputs

name description type required default sensitive
ibmcloud_api_key Provide student's IBM Cloud APIKEY Refer IBM Cloud Docs string โœ“ โœ“
decomission_timer Time length to de-provision the resource after the creation. string NA 10m ----
course_prefix Prefix to the Names of all Cloud Resources. string NA tf-acacdemy-training ----
user_list Student Information. list(object) NA [{ name = "user-1" email = "[email protected]" apikey = "apikey-1" },] ----
create_bc If set to true, it will create block chain. bool NA false ----
bch_plan Blockchain Platform service Plan. string NA standard ----
create_iot If set to true, it will create iot. bool NA false ----
iot_plan IOT Platform service Plan. string NA iotf-service-free ----
create_ml If set to true, it will create machine learning. bool NA false ----
ml_plan Machine learning service Plan. string NA lite ----
create_ws If set to true, it will create watson professional. bool NA true ----
ws_plan Watson Studio service instance Plan. string NA professional-v1 ----
create_vsi If set to true, it will create Virtual server for VPC. bool NA false ----

Outputs

Name Description
workspace_id Schematics worksapce Id
job_id Schematics workspace apply job Id
job_created_timer Schematics workspace resource created time
job_decomission_timer schematics workspace resource de-provision time
cron_expr Cron expression for cloud function to trigger alarm (UTC timezone)

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.