Skip to content

Commit 1787760

Browse files
committed
changes
1 parent acb3fb4 commit 1787760

1 file changed

Lines changed: 68 additions & 20 deletions

File tree

README.md

Lines changed: 68 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,82 @@ Purpose: allow execution of Terraform deployment from CloudShell. Multiple “Te
33

44
Additional workflow recommendation: it is very easy to customize Blueprint setup script that will run the “Deploy Terraform” command on the service, and a similar teardown script that will run the “Destroy Terraform” command – this way the Terraform Module lifecycle is connected to the Sandbox lifecycle.
55

6+
## Content
7+
* (1) cloudshell-iac-terraform - Python package
8+
* (2) generic_terraform_service - Main Shell
9+
* Used in a generic fashion or used to build an extension for a specific purpose (e.g. MsSql)
10+
* (3) backends\azure_tf_backend - Azure Remote Provider Shell
11+
612
## Shell Usage Instructions
7-
1. Import Shell to CloudShell “Shells” screen.
13+
14+
1. Import Shell(/s) to CloudShell “Shells” screen.
815
2. Add Terraform Service to Blueprint/Sandbox.
9-
3. Configure the different attributes to match the requirement of the deployment.
10-
*Please see below the documentation per attribute.
11-
12-
## Service Attributes
13-
|Attribute Name|Data Type|Description|
14-
|:---|:---|:---|
15-
|Github Terraform Module URL|String|path to target module. Can be provided in three formats: <br/> 1)https://github.com/<ACCOUNT>/<REPO>/tree/<BRANCH>/<PATH_TO_FOLDER> <br/> 2)https://github.com/<ACCOUNT>/<REPO>/blob/<BRANCH>/<PATH_TO_FOLDER>/filename.tf<br/> 3)https://raw.githubusercontent.com/<ACCOUNT>/<REPO>/<BRANCH>/<PATH_TO_FOLDER>/filename.tf |
16-
|Terraform Version|String|The version of terraform.exe that will be downloaded and used (If not specified latest version will be used)|
17-
|Github Token|String| Github developer token to be used in order to download TF module|
18-
|Cloud Provider|String| Reference to the CloudProvider resource that shall be used to create authentication|
19-
|Branch|String| In case specified will override the branch in the Github Terraform Module URL |
20-
|Terraform Outputs|String| Used by the system to place the non-sensitive execution outputs|
21-
|Terraform Sensitive Outputs|String|Used by the system to place the sensitive execution outputs|
22-
|Terraform Inputs|String|Comma separated values to specify TF inputs (e.g. varname1=varvalue1,varname2=varvalue2...)|
23-
|Remote State Provider|String|Reference a Remote State provider resource to enable remote state file|
24-
|Custom Tags|String|Comma separated name=value list to be used in case Auto Tagging is enabled|
25-
|Apply Tags|Boolean|Specify whether TF resources will be auto-tagged|
26-
27-
## Commands
16+
3. Configure the different attributes to match the requirement of the deployment.</br>
17+
\* Please see below the documentation per attribute.
18+
19+
## Config Object (cloudshell-iac-terraform)
20+
The shell proivdes a configuration mechanism enabling you to set the behavior of the shell
21+
The object is 'TerraformShellConfig' and holds the following parameters:
22+
23+
|Attribute Name|Data Type|Default Value|Description|
24+
|:---|:---|:---|:---|
25+
| write_sandbox_messages | bool | False | |
26+
| update_live_status | bool | False | |
27+
| inputs_map | Dict | None | |
28+
| outputs_map | Dict | None | |
29+
30+
## Service Attributes (generic_terraform_service)
31+
|Attribute Name|Data Type|Description|Mandatory?|
32+
|:---|:---|:---|:---|
33+
|Github Terraform Module URL|String|path to target module. Can be provided in three formats: <br/> 1)https://github.com/ACCOUNT/REPO/tree/BRANCH/PATH_TO_FOLDER <br/> 2)https://github.com/ACCOUNT/REPO/blob/BRANCH/PATH_TO_FOLDER/FILENAME.tf<br/> 3)https://raw.githubusercontent.com/ACCOUNT/REPO/BRANCH/PATH_TO_FOLDER/FILENAME.tf | Yes |
34+
|Terraform Version|String|The version of terraform.exe that will be downloaded and used (If not specified latest version will be used)| No |
35+
|Github Token|String| Github developer token to be used in order to download TF module| Yes |
36+
|Cloud Provider|String| Reference to the CloudProvider resource that shall be used to create authentication| Yes |
37+
|Branch|String| In case specified will override the branch in the Github Terraform Module URL | No |
38+
|Terraform Outputs|String| Used by the system to place the non-sensitive execution outputs| No |
39+
|Terraform Sensitive Outputs|String|Used by the system to place the sensitive execution outputs| No |
40+
|Terraform Inputs|String|Comma separated values to specify TF inputs (e.g. varname1=varvalue1,varname2=varvalue2...)| * |
41+
|Remote State Provider|String|Reference a Remote State provider resource to enable remote state file</br> If not specified the statefile will be kept locally and a temp directory will remain present after execution and only removed after successful destroy| No |
42+
|Custom Tags|String|Comma separated name=value list to be used in case Auto Tagging is enabled| No |
43+
|Apply Tags|Boolean|Specify whether TF resources will be auto-tagged| N/A|
44+
\* if required by the tf module
45+
46+
## Commands (generic_terraform_service)
2847
|Command|Description|
2948
|:-----|:-----|
3049
|Execute Terraform module| Takes care of the full deployment cycle:<br/>INIT<br/>PLAN<br/>APPLY|
3150
|Destroy Terraform module|Destroys the Terraform deployment previously done for this module.|
3251

52+
## Azure Remote Provider Shell (backends\azure_tf_backend)
53+
54+
The Azure Remote Provider shell is used in order to enable Cloudshell access to Azure storage to be used in order to store the remote statefile.</br>
55+
One must create a resource and fill in the attributes - then specify that resource name as the Remote State Provider.
56+
Only one type of authentication is allowed either by Access Key or using the Cloud Provider authentication keys.
57+
58+
|Attribute|Type|Description|
59+
|:-----|:-----|:-----|
60+
Storage Account Name|String| The name of the Storage Account to be used |
61+
Container Name|String| The name of the Container to be used |
62+
Access Key|String| Access Key of the container|
63+
Cloud Provider|String| Cloud Provider resource name that holds the authentication keys|
64+
Resource Group|String| The resource group of the Storage Account|
65+
66+
## xxx Remote Provider Shell (backends\xxx_tf_backend)
67+
\* Additional Remote Providers soon to come (TBD)
68+
3369
## Additional Notes
70+
71+
### Discretion
72+
73+
* Sensitive output will encrypted and appear in the UI as bullet dots
74+
* Logs will not include sensitive data
75+
* Executions history will not be accessible via Execution Server access
76+
77+
### Logging
78+
79+
80+
81+
3482
- All of the shell commands are executed using python’s “Sub Process” package on the Execution Server that is running the Shell command.
3583
- The Terraform Shell can run locally on the execution server – it requires that there’s access from the execution server to the path where Terraform.exe is located and to the path where the Terraform module is located.
3684
- It is also possible to put the Terraform module on a shared network location (example: \\my-storage-server\terraform\module_name) and grant permission to that storage server to the System account (Host_Name$) of the execution server

0 commit comments

Comments
 (0)