vania-janet/multiturn-rag-retrieval-data huggingface dataset:
template_source_data_request_model['type'] = 'terraform_v0.14'
template_source_data_request_model['variablestore'] = [
{
"name": "ssh_key_name",
"value": "hpcc-slurm-key",
},
{
"name": "resource_group",
"value": "Default"
}]

template_repo_request_model = {}
template_repo_request_model['url'] = 'https://github.ibm.com/workload-eng-services/hpc-cluster-slurm'

logging.info("Started Creating Schematic Workspace")

workspace_response = schematics_service.create_workspace(
description="HPC Cluster Schematic workspace using API",
name="Sample Schematic API workspace",
template_data=[template_source_data_request_model],
template_repo=template_repo_request_model,
type=['terraform_v0.14'],
location="us-south",
resource_group="Default",
tags=["<optional tags>"],
x_github_token= ""
).get_result()

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

logging.info("Completed Creating Schematic Workspace")
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 1054
To find the ID of the template, run ibmcloud schematics workspace get --id <workspace_ID> and find the template ID in the Template Variables for: field of your command-line output. 



Example

ibmcloud schematics state pull --id myworkspace-a1aa1a1a-a11a-11 --template a1aa11a1-11a1-11





 ibmcloud schematics workspace state show 

Provides the readable output from a state or plan of a workspace as Terraform sees it. You can use to ensure the current state and planned operations status. You need to use the workspace ID to retrieve the logs by using the [ibmcloud schematics logs](https://cloud.ibm.com/docs/schematics?topic=schematics-schematics-cli-referenceschematics-logs) command.

Syntax

ibmcloud schematics workspace state show --id WORKSPACE_ID --address ADDRESS [--options OPTIONS]

Command options



Schematics state pull flags

 Flag Required / Optional Description 

 --id or -i Required The unique ID of the workspace to update. 
 --address or -adr Required Enter the address that points to a single resource in the state to show. 
 --options or -o Optional Enter the command-line flags. 



Example

ibmcloud schematics workspace show --id myworkspace-a1aa1a1a-a11a-11 --address null_resource.sleep





 ibmcloud schematics workspace state mv 

Moves an instance or resources from the Terraform state. For example, if you move an instance from the state, the Schematics Workspaces instance continues running, but Terraform plan cannot see that instance. You can use the workspace ID to retrieve the logs by using the [ibmcloud schematics logs](https://cloud.ibm.com/docs/schematics?topic=schematics-schematics-cli-referenceschematics-logs) command.

ibmcloud schematics workspace state mv --id WORKSPACE_ID --source SOURCE --destination DESTINATION

Command options
ibmcloud schematics workspace untaint --id myworkspace-asdff1a1a-42145-11 --address null_resource.sleep





 ibmcloud schematics workspace update 

IBM Cloud Schematics deprecates older version of Terraform. For more information, see [Deprecating older version of Terraform process in IBM Cloud Schematics](https://cloud.ibm.com/docs/schematics?topic=schematics-deprecate-tf-version).

Update the details for an existing workspace, such as the workspace name, variables, or source control URL. To provision or modify IBM Cloud, see the [ibmcloud schematics plan](https://cloud.ibm.com/docs/schematics?topic=schematics-schematics-cli-referenceschematics-plan) command.

IBM Cloud Schematics supports 50 API requests per minute, per host, and per customer. The region can be us-east, us-south, eu-gb, or eu-de region. You need to wait before calling the command again. Ensure the location and the url endpoint are pointing to the same region when you create or update workspaces and actions. For more information about location and endpoint, see [Where is my information stored?](https://cloud.ibm.com/docs/schematics?topic=schematics-secure-datapi-location).

If you provided your Terraform template by uploading a tape archive file (.tar) and you want to update your template, you must use the [ibmcloud schematics workspace upload](https://cloud.ibm.com/docs/schematics?topic=schematics-schematics-cli-referenceschematics-workspace-upload) command.

Syntax

ibmcloud schematics workspace update --id WORKSPACE_ID [--file FILE_NAME] [--github-token GITHUB_TOKEN] [--pull-latest] [--output OUTPUT] [--json]
"application:compensation",
"environment:production"
],
"template_repo":{
"url":"https://github.com/Anil-CM/newrepo"
},
"workspace_status":{
"frozen":true
},
"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. Verify that the workspace is successfully updated.

curl -X GET https://schematics.cloud.ibm.com/v1/workspaces -H "Authorization: <iam_access_token>"
4. see [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 

Verify that the workspace update is successfully as shown in the output.

Output

{
"id": "us-east.workspace.testwspace03jan.cf74cc48",
"name": "testwspace03jan",
template_source_data_request_model['type'] = 'terraform_v0.14'
template_source_data_request_model['variablestore'] = [
{
"name": "ssh_key_name",
"value": "hpcc-slurm-key",
},
{
"name": "resource_group",
"value": "Default"
}]

template_repo_request_model = {}
template_repo_request_model['url'] = 'https://github.ibm.com/workload-eng-services/hpc-cluster-slurm'

logging.info("Started Creating Schematic Workspace")

workspace_response = schematics_service.create_workspace(
description="HPC Cluster Schematic workspace using API",
name="Sample Schematic API workspace",
template_data=[template_source_data_request_model],
template_repo=template_repo_request_model,
type=['terraform_v0.14'],
location="us-south",
resource_group="Default",
tags=["<optional tags>"],
x_github_token= ""
).get_result()

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

logging.info("Completed Creating Schematic Workspace")





 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 1054
Then, click Apply plan to refresh your workspace.





 Expected outcome 

Follow the steps to view the Agent infrastructure workspace setup.



1. Navigate to the [Resources list](https://cloud.ibm.com/resources/) page.
2. Verify the following resources are provisioned from the resource list page.



* VPC > Search<agent_prefix>-vpc the status as Available.
* Services and Software > <agent_prefix>-logdna the status as Active.
* Clusters > <agent_prefix>-iks the status as Normal.



Optionally, you can search the provisioned resources with the tag name from the [Resources list](https://cloud.ibm.com/resources/) page.







 Deploying the Agent services 

You can use Schematics to deploy the Agent services on the Agent infrastructure. For beta, the Agent service must be deployed in a newly provisioned Agent infrastructure.



1. Log in to [IBM Cloud](https://cloud.ibm.com/).
2. Navigate to Schematics > Workspaces > [Create workspace](https://cloud.ibm.com/schematics/workspaces/create).



* In Specify Template section:



* GitHub, GitLab or Bitbucket repository URL - https://github.com/Cloud-Schematics/schematics-agents/tree/main/templates/service.
* Personal access token - <leave it blank>.
* Terraform Version - terraform_v1.0. Note that you need to select Terraform version 1.0 or greater than version.
* Click Next.



* In Workspace details section:



* Workspace name as schematics-agent-service.
* Tags as agents-service.
* Resource group as default or other resource group for this workspace.
* Location as North America or other [region](https://cloud.ibm.com/docs/schematics?topic=schematics-multi-region-deployment) for this workspace.
"values_url": "https://us.schematics.cloud.ibm.com/v1/workspaces/us-south.workspace.Sample-Schematic-API-workspace.0f4b9089/template_data/369f3505-906f-45/values",
"values": "",
"variablestore":
{
"name": "ssh_key_name",
"secure": false,
"value": "hpcc-slurm-key",
"type": "",
"description": ""
},
{
"name": "resource_group",
"secure": false,
"value": "Default",
"type": "",
"description": ""
}
],
"has_githubtoken": false
}
],
"runtime_data": [
{
"id": "369f3505-906f-45",
"engine_name": "terraform",
"engine_version": "v0.14.11",
"state_store_url": "https://us.schematics.cloud.ibm.com/v1/workspaces/us-south.workspace.Sample-Schematic-API-workspace.0f4b9089/runtime_data/369f3505-906f-45/state_store",
"log_store_url": "https://us.schematics.cloud.ibm.com/v1/workspaces/us-south.workspace.Sample-Schematic-API-workspace.0f4b9089/runtime_data/369f3505-906f-45/log_store"
}
],
"shared_data": {
"resource_group_id": ""
},
Run [apply command](https://cloud.ibm.com/apidocs/schematics/schematicsapply-workspace-command) to provision an Agent infrastructure.

curl -X PUT https://schematics.cloud.ibm.com/v1/workspaces/{w_id}/apply -H 'authorization: <auth>' -H 'cache-control: no-cache' -H 'content-type: application/json' -d '{
"name": "smulampa-schematics-agent-infra-workspace",
"type": [
"terraform_v1.0"
],
"description": "schematics agents infra workspace",
"template_repo": {
"url": ""
},
"template_data": [{
"folder": ".",
"type": "terraform_v1.0",
"variablestore": {
"name": "agent_prefix",
"type": "string",
"value": "myproject-agent"
},
{
"name": "location",
"type": "string",
"value": "us-south"
},
{
"name": "resource_group_name",
"type": "string",
"value": "Default"
}
]
}]
}'
6. Run [job logs](https://cloud.ibm.com/apidocs/schematics/schematicsget-job) to pull your workspace logs.

curl -X GET https://schematics.cloud.ibm.com/v1/workspaces/{w_id}/runtime_data/{template_id}/log_store -H 'authorization: <auth>' -H 'cache-control: no-cache' -H 'content-type: application/json'
self.schematics_service = SchematicsV1(authenticator=self.authenticator)

        self.schematics_service.set_service_url('https://us.schematics.cloud.ibm.com')
        logging.info("Schematic Services created")

    def update_variables(self, w_id, t_id, variablestore):

        print("Function Schematic Update Variables Started")
        variables_update_result = self.schematics_service.replace_workspace_inputs(w_id=w_id, t_id=t_id, variablestore=variablestore
    ).get_result()

        return variables_update_result   
Show more





 config.json template file 

Use this template file in the public GitHub repository: [config.json](https://github.com/IBM-Cloud/hpc-cluster-symphony/blob/master/sample/configs/hpc_workspace_config.json)





 Example Python response 

INFO:root:Schematic Variable Update Started
INFO:root:Schematic Services created
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 983
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): us.schematics.cloud.ibm.com:443
DEBUG:urllib3.connectionpool:https://us.schematics.cloud.ibm.com:443 "GET /v1/workspaces/us-south.workspace.Schematic-Sunil-Test-Workspace.5a4cbf11 HTTP/1.1" 200 None
Function Schematic Update Variables Started
Service locations and endpoints 

Review the IBM Cloud Schematics supported locations and how Schematics differentiates between the user data and template storage location, and the deployment region of your IBM Cloud® resources.



  Where can I create and run Schematics Workspaces? 

You can choose to create Schematics Workspaces in the US or Europe geographies by using one of the following API endpoints, or by using the Location drop-down menu in the IBM Cloud console.

For more information about the Schematics private service endpoint, see [Using private endpoints](https://cloud.ibm.com/docs/schematics?topic=schematics-secure-datapi-location).





  Where do my Schematics Actions run? 

The location that you choose for your Schematics Workspaces determines the location where your Schematics jobs, such plan or apply, run.



Regions where an action is?

 Geography/ location  Location to run Schematics Actions                                   

 North America        Schematics jobs run in either the us-south or us-east location.      
 Dallas               Schematics jobs run in the us-south location.                        
 Washington           Schematics jobs run in the us-east location.                         
 Europe               Schematics jobs run in either the eu-de or eu-gb location.           
 Frankfurt            Schematics jobs run in the eu-de location.                           
 London               Schematics jobs run in the eu-gb location.                           







  Where is my Schematics and template data stored? 

The region your workspace data is stored is determined by the location where you create your workspace. For more information, see [Securing your data](https://cloud.ibm.com/docs/schematics?topic=schematics-secure-data).





  Where are my IBM Cloud resources provisioned? 

The region or regions where your IBM Cloud resources are provisioned are determined by the region that you specify in your Terraform configuration. You can specify a region for each individual resource, or to specify a region in the provider block of your Terraform configuration that is applied to all resources. Multiple regions are supported by using provider aliases. For more information, see [Terraform provider block configuration](https://cloud.ibm.com/docs/ibm-cloud-provider-for-terraform?topic=ibm-cloud-provider-for-terraform-provider-reference).
self.schematics_service = SchematicsV1(authenticator=self.authenticator)

        self.schematics_service.set_service_url('https://us.schematics.cloud.ibm.com')
        logging.info("Schematic Services created")

    def update_variables(self, w_id, t_id, variablestore):

        print("Function Schematic Update Variables Started")
        variables_update_result = self.schematics_service.replace_workspace_inputs(w_id=w_id, t_id=t_id, variablestore=variablestore
    ).get_result()

        return variables_update_result   
Show more





 config.json template file 

Use this template file in the public GitHub repository: [config.json](https://github.com/IBM-Cloud/hpc-cluster-openshift/blob/master/sample/configs/hpc_workspace_config.json)





 Example Python response 

INFO:root:Schematic Variable Update Started
INFO:root:Schematic Services created
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 983
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): us.schematics.cloud.ibm.com:443
DEBUG:urllib3.connectionpool:https://us.schematics.cloud.ibm.com:443 "GET /v1/workspaces/us-south.workspace.Schematic-Sunil-Test-Workspace.5a4cbf11 HTTP/1.1" 200 None
Function Schematic Update Variables Started
--vault ([VaultReferenceInCreationRequest](https://cloud.ibm.com/docs/cli?topic=cli-hpcs-cli-pluginuko-vault-reference-in-creation-request-example-schema))
: Required. The ID of the vault where the managed key is to be created.

--label (string)
: Required. The label of the key. The length must be between 1 and 255 characters. The value must match the regular expression /^[A-Za-z0-9._ /-]+$/.

--tags ([Tag[]](https://cloud.ibm.com/docs/cli?topic=cli-hpcs-cli-pluginuko-tag-example-schema))
: Optional. Key-value pairs that are associated with the key. The length must be between 0 and 128 items.

--description (string)
: Optional. The description of the managed key. The length must be between 0 and 200 characters. The value must match the regular expression /(.|\n)/.
* Example

ibmcloud hpcs uko managed-key-create 
--uko-vault=5295ad47-2ce9-43c3-b9e7-e5a9482c362b 
--template-name=IBM-CLOUD-EXAMPLE-TEMPLATE 
--vault='{"id": "5295ad47-2ce9-43c3-b9e7-e5a9482c362b"}' 
--label='IBM CLOUD KEY' 
--tags='[{"name": "first-tag", "value": "for-IBM-CLOUD"}]' 
--output json
* Output

The command returns the output similar to the following example:

ETag
2022-05-26T14:18:10Z
{
curl -X PUT https://schematics.cloud.ibm.com/v1/workspaces/{w_id}/apply -H 'authorization: <auth>' -H 'cache-control: no-cache' -H 'content-type: application/json' -d '{
"name": "smulampa-schematics-agent-service-workspace",
"type": [
"terraform_v1.0"
],
"description": "schematics agents service workspace",
"template_repo": {
"url": ""
},
"template_data": [{
"folder": ".",
"type": "terraform_v1.0",
"variablestore": {
"name": "agent_prefix",
"type": "string",
"value": "myproject-agent"
},
{
"name": "location",
"type": "string",
"value": "us-south"
},
{
"name": "resource_group_name",
"type": "string",
"value": "Default"
}
]
}]
}'

Wait 15 - 30 minutes to complete the service execution
6. Run [job logs](https://cloud.ibm.com/apidocs/schematics/schematicsget-job) to pull your workspace logs.

curl -X GET https://schematics.cloud.ibm.com/v1/workspaces/workspaces/{w_id}/runtime_data/{template_id}/log_store -H 'authorization: <auth>' -H 'cache-control: no-cache' -H 'content-type: application/json'
7.
To change your action, wait for the job to complete, then change your settings, and click Check action or Run action again.









 Editing the Schematics Actions settings 

The Settings option edits the action Details, Ansible action, and IBM Cloud resource inventory parameters. Then, you can click Save button to save the edited configuration. Finally, you click Check action and Run action to validate and rerun your action playbook.

You can monitor the progress of an action by reviewing the logs on the Jobs page. You can use [ibmcloud schematics job list](https://cloud.ibm.com/docs/schematics?topic=schematics-schematics-cli-referenceschematics-list-job) command to view the complete job logs of your action.

In the console, there is no limit set to display the job logs. Every 30 seconds the job logs gets automatically refreshed. You can use [ibmcloud schematics job list](https://cloud.ibm.com/docs/schematics?topic=schematics-schematics-cli-referenceschematics-list-job) command to view the complete job logs of your action.





 Deleting an action 

If you no longer need your Schematics action, you can delete it. Deleting an action removes the Ansible playbook and your action data. However, any configurations on your target hosts you made by using the action are not removed.



1. From the [Schematics Actions dashboard](https://cloud.ibm.com/schematics/actions), find the action that you want to delete.
2. From the Actions menu, click Delete.







 Action state 

Action state indicates the result of creating and processing an action that can be known to the Schematics system state. The table represents the Schematics Actions state and its description.



Action state

 State Description 

 Critical When the template is unable to download the repository, or the repository name is invalid, the template fails and changes the action state as critical. 
 Disabled Disallows user execution. 
 Locked After configuration is in Normal state.
https://cloud.ibm.com/schematics/actions/create?name=ansible-app-deploy&repository=https://github.com/Cloud-Schematics/ansible-app-deploy
4. Open your web browser and enter the URL.
5. Verify that the Schematics Actions create page opens and that the Action name and Repository URL are pre-populated.







 Adding the button to a website or page 

You can add an image to your URL to create your Deploy to IBM Cloud button.



 Adding the button in HTML 

To add the button in an HTML page, such as a website, copy the following code into the page where you want to position the button. Replace <deployment URL> with the URL for the Schematics action.

<a href="<deployment URL>" target="_blank">
<img src="https://cloud.ibm.com/media/docs/images/icons/Deploy_to_cloud.svg" alt="Deploy to {{site.data.keyword.cloud_notm}} button">
</a>





 Adding the button in Markdown 

To add the button into a Markdown file, such as in a repositories readme file, use the following syntax. Replace <deployment URL> with the URL for the deployment link.

[Deploy to {{site.data.keyword.cloud_notm}} button](https://cloud.ibm.com/media/docs/images/icons/Deploy_to_cloud.svg)]







 Next steps 

Explore the [!Schematics samples templates](https://cloud.ibm.com/docs/schematics?topic=schematics-sample_actiontemplates) to deploy in your IBM Cloud account. Looking for more code examples? Check out the [samples for IBM Cloud Schematics GitHub repositories](https://github.com/Cloud-Schematics?q=Ansible&type=all&language=&sort=).
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.

For more information, see [troubleshooting section](https://cloud.ibm.com/docs/schematics?topic=schematics-wks-create-api&interface=cli).







 Updating a workspace using the API 



1. Follow the [steps](https://cloud.ibm.com/docs/schematics?topic=schematics-setup-apics_api) to retrieve your IAM access token and authenticate with IBM Cloud Schematics by using the API.
2. Updating the details for an existing workspace, such as the workspace name, variables, or source control URL.

Example

PUT /v1/workspaces/{w_id} HTTP/1.1
Host: schematics.cloud.ibm.com
Content-Type: application/json
Authorization: <auth_token>
{
"name":"testwspace03jan",
"type":[
"terraform_v1.0"
],
"description":"terraform workspace updated",
"location":"us-east",
"tags":[
"department:HR",
"application:compensation",
"environment:production"
],
"template_repo":{
"url":"https://github.com/Anil-CM/newrepo"
},
"workspace_status":{
"frozen":true
},
"template_data":[
{
"folder":".",
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. 
 resource_group Optional Name of the resource group the workspace will be associated with. Defaults to the 'Default' resource group. 
 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 GitHub or GitLab branch where your Terraform configuration files are stored. 
 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.