vania-janet/multiturn-rag-retrieval-data huggingface dataset:
"template_data":[
{
"folder":".",
"type":"terraform_v1.0",
"variablestore":
{
"name":"sample_var",
"secure":true,
"value":"THIS IS IBM CLOUD TERRAFORM CLI DEMO",
"description":"Description of sample_var"
},
{
"name":"sleepy_time",
"value":"15"
}
]
}
]
}

Syntax

ibmcloud schematics workspace update --id WORKSPACE_ID [--file FILE_NAME] [--github-token GITHUB_TOKEN] [--pull-latest] [--output OUTPUT] [--json]
2. Update the workspace details for an existing workspace, such as the workspace name, variables, or source control URL.

ibmcloud schematics workspace update --id <WORKSPACE_ID>
3. Verify that your workspace is updated. Make sure that your workspace is in an Inactive state.

ibmcloud schematics workspace list
4. Refer to, [Managing IBM Cloud resources with Schematics](https://cloud.ibm.com/docs/schematics?topic=schematics-manage-lifecycle) to start creating, updating, or deleting IBM Cloud resources with Terraform.





 Verifying workspace update 

Confirm the details using the CLI command update where the parameters of your workspace were updated successfully that has been created earlier.

ibmcloud schematics workspace update --id us-east.workspace.testwspace03jan.811182d2 --target vpc_name --target vpc_tags
Do you really want to perform this action? [y/N]> y

Activity ID c10fc92ddfd2d9ec645fc5dbece5e341

OK

On successful update, it returns the updated details of an existing workspace.
[ibm_schematics_workspace_count](https://cloud.ibm.com/docs/schematics?topic=schematics-monitoring-instanceswkspace-actions-count) Yes No Yes 
 [ibm_schematics_workspace_vulnerability_count](https://cloud.ibm.com/docs/schematics?topic=schematics-monitoring-instanceswkspace-vulnerability-count) Yes No Yes 





 ibm_schematics_workspace_count 

The number of workspaces state and actions count is stated in the table.



Workspace state and action count

 Metadata Description 

 Metric Name ibm_schematics_workspace_count 
 Metric Type gauge 
 Frequency 60 seconds 
 Unit none 
 Labels ibm_schematics_workspace_status such as Active, Draft, Inactive, and Template Error are derived. 



For the Schematics instance, following five different time series counts or charts are derived from ibm_schematics_workspace_count metric.



Workspace time series count

 Status Query 

 Number of workspaces created Sum(ibm_schematics_workspace_count{}) 
 Number of active workspaces ibm_schematics_workspace_count{ibm_schematics_workspace_status = ”Active”} 
 Number of workspaces in draft state ibm_schematics_workspace_count{ibm_schematics_workspace_status = ”Draft”} 
 Number of inactive workspaces ibm_schematics_workspace_count{ibm_schematics_workspace_status = ”Inactive”} 
 Number of workspaces deleted ibm_schematics_workspace_count{ibm_schematics_workspace_status = ”Template Error”} 







 ibm_schematics_workspace_actions_count 

The number of workspace actions count are stated in the table.



Workspace actions count

 Metadata Description 

 Metric Name ibm_schematics_workspace_actions_count 
 Metric Type gauge 
 Frequency 60 seconds 
 Unit none
To allow version control of this file, make sure to store this configuration file in a GitHub or GitLab repository.

data "ibm_schematics_workspace" "vpc" {
workspace_id = "<schematics_workspace_ID>"
}

data "ibm_schematics_output" "vpc" {
workspace_id = "<schematics_workspace_ID>"
template_id = data.ibm_schematics_workspace.vpc.runtime_data.0.id
}

output "output_vars" {
value = data.ibm_schematics_output.vpc.output_values
}

output "ssh_command" {
value = data.ibm_schematics_output.vpc.output_values.sshcommand
}

output "vpc_id" {
value = data.ibm_schematics_output.vpc.output_values.vpc_id
}
Show more



Configuration file components

 ![Idea icon](https://cloud.ibm.com/docs-content/v1/content/ba89e173287b28d1453d2a327d8a1f74ae2f1662/schematics/images/idea.png) Understanding the configuration file components 

 data.ibm_schematics_workspace.workspace_id Enter the ID of the VPC workspace where you defined the output values that you want to access. You need this data source to retrieve the template ID of the workspace in the ibm_schematics_output data source. 
 data.ibm_schematics_output.workspace_id Enter the ID of the VPC workspace where you defined the output values that you want to access. 
 data.ibm_schematics_output.template_id Enter data.ibm_schematics_workspace.vpc.runtime_data.0.id to reference the Terraform template of your workspace.
template_repo=template_repo_request_model,
type=['terraform_v1.0.0'],
location="us-south",
resource_group="Default",
tags=[""]
).get_result()

print(json.dumps(workspace_response, indent = 2))





 Example Python response 

The following Python response is a generic example for reference.

INFO:root:Started Creating Schematic Workspace
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): iam.cloud.ibm.com:443
DEBUG:urllib3.connectionpool:https://iam.cloud.ibm.com:443 "POST /identity/token HTTP/1.1" 200 1072
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): us.schematics.cloud.ibm.com:443
DEBUG:urllib3.connectionpool:https://us.schematics.cloud.ibm.com:443 "POST /v1/workspaces HTTP/1.1" 201 None
{
"id": "us-south.workspace.Sample-Schematic-Scale-API-workspace.096bd8d8",
"name": "Sample Schematic Scale API workspace",
"crn": "crn:v1:bluemix:public:schematics:us-south:a/77efe1030c00b5c89cfd08648d3480bf:6f457fa4-4c59-4a8d-be69-483f16f8f200:workspace:us-south.workspace.Sample-Schematic-Scale-API-workspace.096bd8d8",
"type": [
"terraform_v1.0.0"
],
"description": "HPC Cluster schematic workspace using API",
"resource_group": "Default",
If you plan to provide your Terraform template by uploading a tape archive file (.tar), leave the URL empty, and use the [ibmcloud schematics workspace upload](https://cloud.ibm.com/docs/schematics?topic=schematics-schematics-cli-referenceschematics-workspace-upload) command after you created the workspace. If you want to clone from the Git repository see the [allowed and blocked file extensions](https://cloud.ibm.com/docs/schematics?topic=schematics-workspaces-faqclone-file-extension) for cloning. 
 env_values Optional A list of environment variables that you want to apply during the execution of a bash script or Terraform action. This field must be provided as a list of key-value pairs. Each entry will be a map with one entry where key = variable name and value = value. You can define environment variables for IBM Cloud catalog offerings that are provisioned by using a bash script files. 
 variable_name Optional Enter the name for the input variable that you declared in your Terraform configuration files. 
 variable_type Optional Terraform v0.12 supports string, list, map, bool, number and complex data types such as list(type), map(type), object({attribute name=type,..}), set(type), tuple([type]). 
 variable_value Optional Enter the value as a string for the primitive types such as bool, number, string, and HCL format for the complex variables, as you provide in a .tfvars file. You need to enter escaped string of HCL format for the value, as shown in the example. For more information about how to declare variables in a Terraform configuration file and provide value to schematics, see [Using input variables to customize resources](https://cloud.ibm.com/docs/schematics?topic=schematics-create-tf-configdeclare-variable).
curl -X GET https://schematics.cloud.ibm.com/v1/workspaces/badWOrkspaceId -H "Authorization: $IAM_TOKEN"
{"requestid":"3a3cbffe-e23a-4ccf-b764-042f7379c084","timestamp":"2021-11-11T17:00:07.169953698Z","messageid":"M1078","message":"Error while validating the location in the account. Verify you have permission to the location in the global catalog settings.","statuscode":403}

Yes there is a change in the API that checks for the location first and if it doesn’t get proper location for the workspace it returns 403 error instead of 404 error.
* How can I enable Terraform debug logging

You can set the environment variable for setting the Terraform log debug TF_LOG=debug trace in the payload, as shown in the sample payload. For more information, see [Schematics Workspaces update](https://cloud.ibm.com/docs/schematics?topic=schematics-schematics-cli-referenceschematics-workspace-update).

{
"name": "sample",
"type": [
"terraform_v0.12"
],
"description": "terraform workspace",
"tags": [
],
"template_repo": {
"url": "<your repo>"
},
"template_data": [
{
"folder": ".",
"type": "terraform_v0.12",
"env_values":
{
"TF_LOG":"debug"
}
]
}
]
}
* How can I import Cloud resources into a workspace?
A blueprint template, optionally declares a set of input variables that can be used to customize the blueprint template, while deploying or managing a blueprint environment. The template metadata for the input variables include the following: variable name, variable type, default value, variable description, sensitive, read only, hidden.

Blueprint inputs can be provided as:



* User-defined input, provided via the Schematics API, CLI or UI at config create time. They can be used to pass input values that would be a security exposure if written to a Git repository.
* Version-controlled [blueprint input file](https://cloud.ibm.com/docs/schematics?topic=schematics-sch-termsbpi2) (from a Git repository)







 Blueprint input files 

Version-controlled input file (from a Git repository) to pass inputs to customize the blueprint template for a specific environment. The type of an input variable is defined metadata in the template file.





 Blueprint jobs 

Blueprint operations (commands) are run as jobs by Schematics. A blueprint job keeps a record of the status, inputs, outputs, and files of every blueprint config, plan & run command execution.





 Blueprint lifecycle 

Blueprints follow a lifecycle approach to deploying and managing IBM Cloud environments. The tasks of working with a blueprint over its lifecycle can be grouped under four headings, [defining blueprints](https://cloud.ibm.com/docs/schematics?topic=schematics-define-blueprints), [deploying blueprints](https://cloud.ibm.com/docs/schematics?topic=schematics-deploy-blueprints), [maintaining blueprints](https://cloud.ibm.com/docs/schematics?topic=schematics-update-op-blueprints), and [deleting blueprints](https://cloud.ibm.com/docs/schematics?topic=schematics-delete-blueprints).
template_repo=template_repo_request_model,
type=['terraform_v1.0.0'],
location="us-south",
resource_group="Default",
tags=[""]
).get_result()

print(json.dumps(workspace_response, indent = 2))

Show more





 Example Python response 

The following Python response is a generic example for reference.

INFO:root:Started Creating Schematic Workspace
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): iam.cloud.ibm.com:443
DEBUG:urllib3.connectionpool:https://iam.cloud.ibm.com:443 "POST /identity/token HTTP/1.1" 200 1072
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): us.schematics.cloud.ibm.com:443
DEBUG:urllib3.connectionpool:https://us.schematics.cloud.ibm.com:443 "POST /v1/workspaces HTTP/1.1" 201 None
{
"id": "us-south.workspace.Sample-Schematic-Scale-API-workspace.096bd8d8",
"name": "Sample Schematic Scale API workspace",
"crn": "crn:v1:bluemix:public:schematics:us-south:a/77efe1030c00b5c89cfd08648d3480bf:6f457fa4-4c59-4a8d-be69-483f16f8f200:workspace:us-south.workspace.Sample-Schematic-Scale-API-workspace.096bd8d8",
"type": [
"terraform_v1.0.0"
],
"description": "HPC Cluster schematic workspace using API",
"resource_group": "Default",
ibmcloud schematics workspace state rm --id WORKSPACE_ID [--options OPTIONS] --address PARAMETER

Command options



Schematics state remove flags

 Flag Required / Optional Description 

 --id or -i Required The unique identifier of the workspace for which you want to remove the instance or resource. To find the ID of your workspace, run ibmcloud schematics workspace list command. 
 --options or -o Optional Enter the option flag that you want to remove. 
 --address or -adr Required Enter the address of the resource to mark as taint. 



Example

ibmcloud schematics workspace state rm --id myworkspace-a1aa1a1a-a11a-11 --address null_resource.sleep --destination null_resource.slept







 Workspaces commands 

Review the commands that you can use to set up and work with your IBM Cloud Schematics Workspace.



 ibmcloud schematics workspace action 

Retrieve all activities for a workspace, including the user ID of the person who initiated the action, the status, and a timestamp.

When you create a Terraform execution plan, or apply your Terraform template with Schematics, a Schematics Actions is automatically created and assigned an action ID. You can use the action ID to retrieve the logs of this action by using the [ibmcloud schematics logs](https://cloud.ibm.com/docs/schematics?topic=schematics-schematics-cli-referenceschematics-logs) command.

Syntax

ibmcloud schematics workspace action --id WORKSPACE_ID [--act-id ACTION_ID] [--output OUTPUT]

Command options



Schematics Workspaces action flags

 Flag Required / Optional Description 

 --id or -i Required The unique identifier of the workspace for which you want to retrieve workspace activities. To find the ID of your workspace, run ibmcloud schematics workspace list command. 
 --act-id or -a Optional Enter the ID of a action that you want to retrieve.
authenticator = IAMAuthenticator('')

schematics_service = SchematicsV1(authenticator = authenticator)

schematics_service.set_service_url('https://us.schematics.cloud.ibm.com')

template_source_data_request_model = {}
template_source_data_request_model['env_values'] = [
{
"name": "TF_CLI_ARGS_plan",
"value": "-parallelism=250",
},
{
"name": "TF_CLI_ARGS_apply",
"value": "-parallelism=250"
}
]
template_source_data_request_model['folder'] = ''
template_source_data_request_model['type'] = 'terraform_v1.0.0'
template_source_data_request_model['variablestore'] = [
{
"name": "bastion_key_pair",
"value": "scale-hpcc-key",
},
{
"name": "vpc_availability_zones",
"value": "us-south-2",
},
{
"name": "vpc_region",
"value": "us-south",
},
{
"name": "remote_cidr_blocks",
"value": ""169.252.0.0/18"]",
},
{
"name": "ibm_customer_number",
"value": "12345",
},
{
"name": "compute_cluster_gui_username",
"value": "admin",
},
{
"name": "compute_cluster_gui_password",
"value": "P@ssw0rd",
},
{
To view the region that you targeted, run ibmcloud target --output json and look at the region field. To target a different region, run ibmcloud target -r <region>. If you enter a location, make sure that the location matches the IBM Cloud region that you targeted. 
 description Optional Enter a description for your workspace. 
 template_repo.url Optional Enter the URL to the GitHub or GitLab repository where your Terraform configuration files are stored. 
 template_repo.branch Optional Enter the GitHub or GitLab branch where your Terraform configuration files are stored. Now, in template_repo, you can also update URL with more parameters as shown in the block. 
 template_repo.datafolder Optional Enter the name of the folder in the Git repository, that contains the template. 
 template_repo.release Optional Enter the GitHub or GitLab release that points to your Terraform configuration files. 
 github_source_repo_url Optional Enter the link to your GitHub repository. The link can point to the master branch, a different branch, or a subdirectory. If you choose to create your workspace without a GitHub repository, your workspace is created with a draft state. To connect your workspace to a GitHub repository later, you must use the ibmcloud schematics workspace update command. If you plan to provide your Terraform template by uploading a tape archive file (.tar), leave the URL empty, and use the [ibmcloud schematics workspace upload](https://cloud.ibm.com/docs/schematics?topic=schematics-schematics-cli-referenceschematics-workspace-upload) command after you created the workspace. If you want to clone from the Git repository see the [allowed and blocked file extensions](https://cloud.ibm.com/docs/schematics?topic=schematics-workspaces-faqclone-file-extension) for cloning. 
 env_values Optional A list of environment variables that you want to apply during the execution of a bash script or Terraform action.
* Git repository URL is mandatory in both [create](https://cloud.ibm.com/apidocs/schematics/schematicscreate-workspace), or [update](https://cloud.ibm.com/apidocs/schematics/schematicsreplace-workspace) workspace request payload only if compact flag is set.
* The [GET workspace](https://cloud.ibm.com/apidocs/schematics/schematicsget-workspace) response includes the compact field, only if the compact download mode is enabled.
* If the Git repository URL is the root of the repository, as stated in this [template](https://github.com/Cloud-Schematics/LEMP), the compact download, and full download are the exact same thing. It doesn't matter if the compact checkbox is checked or unchecked.
"template_data":[
{
"folder":".",
"type":"terraform_v1.0",
"variablestore":
{
"name":"sample_var",
"secure":true,
"value":"THIS IS IBM CLOUD TERRAFORM CLI DEMO",
"description":"Description of sample_var"
},
{
"name":"sleepy_time",
"value":"15"
}
]
}
]
}
3. See [Managing IBM Cloud resources with Schematics](https://cloud.ibm.com/docs/schematics?topic=schematics-manage-lifecycle) to start Deleting, updating, or deleting IBM Cloud resources with Terraform.





 Verifying a workspace destroy operation 

Verify that the resource is destroyed successfully.

Verify that the workspace resource is destroyed successfully as shown in the output.

Output

{
"activityid": "6e5c84b58100472395b53a056cc27edc"
}

On successful, destroy the unique activity ID of the workspace is returned.

For more information, see [workspace FAQs](https://cloud.ibm.com/docs/schematics?topic=schematics-workspaces-faqclusterdeletion-warn-faq).







 destroying workspace resources with Terraform 



1. Follow the steps in [Deleting Schematics data](https://cloud.ibm.com/docs/schematics?topic=schematics-delete-schematics-data-intro&interface=ui) to destroy your workspace with Terraform.
2. See [Managing IBM Cloud resources](https://cloud.ibm.com/docs/schematics?topic=schematics-manage-lifecycle) with Schematics to create, update, or delete the IBM Cloud resources.







 Next steps 



* Looking for additional workspace samples to work with?
ibmcloud schematics workspace import --id WID --address ibm_iam_access_group.accgrp --resourceID AccessGroupId-xxxxxx-xxxx-xxx-xxx-xxxx -o -var-file=schematics.tfvars





 ibmcloud schematics workspace list 

List the workspaces in your IBM Cloud account and optionally, show the details for your workspace.

Syntax

ibmcloud schematics workspace list [--limit LIMIT] [--offset OFFSET] [--output] [--region] [--json]

Command options



Schematics Workspaces list flags

 Flag Required / Optional Description 

 --limit or -l Optional The maximum number of workspaces that you want to list. The number must be a positive integer starting from 1, maximum is 200. The default value is -1. 
 --offset or -m Optional The position of the workspace in the list of workspaces. For example, if you have three workspaces in your account, the command returns these workspaces as a list with three elements. To see a specific workspace in this list, you must enter the position number that the workspace has in the list. To list the first workspace in the list, enter 0. To list the second workspace, enter 1 and so forth. Negative numbers are not supported and are ignored. The default value is -1. 
 --json or -j Deprecated Prints the output in the JSON format. 
 --output or -o Optional Returns the command-line output in JSON format. Currently only JSON file format is supported. 
 --region or -r Optional Specify the region, such as eu, us, eu-gb, eu-de, us-south, or us-east. 



Example

ibmcloud schematics workspace list --limit 10 --offset 20 --json





 ibmcloud schematics workspace new 

Create an Schematics Workspaces that points to your Terraform template in GitHub or GitLab.
The most frequent cause changes that are applied manually outside of Terraform automation.





 Next steps 

So far you have learned about Schematics Workspaces. The following are some next steps to explore.



* [Getting started usecase](https://cloud.ibm.com/docs/schematics?topic=schematics-get-started-terraform) to understand how to use workspace to deploy and manage your Infrastructure as Code (IaC) in the cloud environments.
* [Sample Terraform templates](https://cloud.ibm.com/docs/schematics?topic=schematics-create-tf-config) to provide you how to create well-structured, and reusable Terraform templates.
* See [Creating Workspaces](https://cloud.ibm.com/docs/schematics?topic=schematics-sch-create-wks) to dig into how to create workspace using the Terraform templates.
See [source](https://cloud.ibm.com/docs/schematics?topic=schematics-bp-template-schema-yamlbp-modules-sourceoptions) schema reference.

source_type: git
git:     
     git_repo_url: "https://github.ibm.com/steve-strutt/blueprint-examples-modules/tree/master/IBM-Storage"
     git_release: 1.0.1





 Module inputs 

Module inputs are defined in the input block of a module and follow the same type convention as Terraform HCL. The supported types are the same as the [Terraform variable types](https://developer.hashicorp.com/terraform/language/expressions/types). The type definition for a module input is specified on the template input.

inputs: 
  - name: list_any_flow_scalar
value: $blueprint.list_any_flow_scalar
- name: docker_ports
value: $module.terraform_module1.outputs.nested_complex

Similar to Terraform, module inputs can be specified as static values or interpolated references to template inputs or other modules by using the $ symbol as shown in the sample snippet.

Two input variable interpolation types are [supported](https://cloud.ibm.com/docs/schematics?topic=schematics-bp-template-schema-yamlbp-modules-inputs-value). Inter-module references, mapping module inputs to the outputs of other modules using the $module token. Additionally, templates input references can be defined using the $blueprint token. Check the readme and metadata for the [automation modules](https://github.com/terraform-ibm-modules) to determine the supported inputs and variable types.

To reference the output value of another module, the format is $module followed by the dependent module name, the token outputs, followed by referenced output name.

name: res_grp_id            
value: $module.accounts.outputs.res_grp_id
* Learn how to create an [IBM Cloud Schematics job](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/schematics_job) resource to run your Terraform template in IBM Cloud.
* To run Ansible playbooks in IBM Cloud check out the [IBM Cloud Schematics action](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/schematics_action) resource.
* Explore other supported Terraform resources and data sources for [IBM Cloud Schematics](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/schematics_action) or checkout other arguments and attributes that you can use for the Terraform resources that were used in this example.