This commit is contained in:
Sheng Chen 2018-03-02 15:36:34 +08:00 коммит произвёл GitHub
Родитель 1cf8a7f464
Коммит c28e5d55b9
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 1 добавлений и 82 удалений

Просмотреть файл

@ -9,4 +9,3 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
### Added
- Support Terraform commands: init, plan, apply, validate, refresh and destroy.
- Support visualizing the terraform module.
- Support linting and end to end tests.

Просмотреть файл

@ -1,6 +1,6 @@
# Azure Terraform
The VSCode Azure Terraform extension is designed to increase developer productivity building Terraform modules for Azure. The extension provides linting, terraform command support, resource graph visualization, testing and CloudShell integration inside VSCode.
The VSCode Azure Terraform extension is designed to increase developer productivity building Terraform modules for Azure. The extension provides terraform command support, resource graph visualization and CloudShell integration inside VSCode.
![overview](images/overview.png)
@ -12,7 +12,6 @@ This extension supports the following features:
- Terraform commands: init, plan, apply, validate, refresh and destroy.
- Visualize the terraform module.
- Run linting and end to end tests.
### Azure Terraform: init
@ -44,29 +43,6 @@ Executes `terraform destroy` command against the current project workspace. If r
Creates a visual representation of the components of the module and save it in `graph.png`. This command requires [GraphViz dot](http://www.graphviz.org) to be installed locally.
### Azure Terraform: execute test
Runs one of the following test against the current module using a test container:
- lint: This command checks the formating of the code of the Terraform module.
- end to end: This command will deploy the current module with the settings specified in the .tfvars file, verify that the deployment pass the controls and destroy the resources that have been created.
- custom: This command will run the customized command against the Terraform module.
You can run the test locally or in Azure.
- Running the test locally requires to have [Docker](http://www.docker.io) installed and create a Service Principal that will be used to authenticate against Azure.
- Running the test in Azure will create an Azure Container Group in your subscription, it will use the name and resource group defined in the settings files.
Use the following command to get the results of the test (Replace with your own values).
`az container logs -n terraformtesting -g TerraformTestRG`
In both cases the default test container is "microsoft/terraform-test" and it can be customized through the settings.
> NOTE: Running the tests in Azure will count against your Azure consumption.
### Azure Terraform: push
This command will sync workspace files that meet the filter `azureTerraform.files` setting in your configuration to Azure clouddrive.
@ -88,14 +64,8 @@ This extension requires:
## Extension Settings
- `azureTerraform` - Parent for Terraform-Azure related extension settings
- `azureTerraform.terminal` - Specifies terminal used to run Terraform commands. Valid settings are `cloudshell` or `integrated`
- `azureTerraform.files` - Indicates the files that should be synchronized to Azure CloudShell using the glob pattern string, for example `**/*.{tf,txt,yml,tfvars,rb}`
- `azureTerraform.test-container` - Indicates the container to use to run the tests, for example `microsoft/terraform-test`. Private registry is not supported at this time.
- `azureTerraform.aci-name` - Indicates the name of the Azure Container Instance to use for testing. For example: `terraformtesting`
- `azureTerraform.aci-ResGroup` - Indicates the name of the Resource Group to use for the ACI instance. For example: `TerrafornTestRG`
- `azureTerraform.aci-group` - Indicates the name of the Container Group that host the ACI instance. For example: `TerrafornTesting`
- `azureTerraform.test-location` - Indicates the location where to deploy the test container instance. For example: `westus`
## Known Issues

Просмотреть файл

@ -25,7 +25,6 @@
"onCommand:azureTerraform.refresh",
"onCommand:azureTerraform.destroy",
"onCommand:azureTerraform.visualize",
"onCommand:azureTerraform.exectest",
"onCommand:azureTerraform.push"
],
"main": "./out/extension",
@ -42,31 +41,6 @@
"type": "string",
"default": "**/*.{rb,sh,tf,tfvars,txt,yml}",
"description": "Indicates the files that should be synchronized to Azure Cloud Shell using the glob pattern string, for example: **/*.{tf,txt,yml,tfvars,rb}"
},
"azureTerraform.test-container": {
"type": "string",
"default": "microsoft/terraform-test",
"description": "Indicates the container that you want to use to run the tests. For example: microsoft/terraform-test"
},
"azureTerraform.aci-name": {
"type": "string",
"default": "terraformtesting",
"description": "Indicates the name of the Azure Container Instance to use for testing. For example: terraformtesting"
},
"azureTerraform.aci-ResGroup": {
"type": "string",
"default": "TerraformTestRG",
"description": "Indicates the name of the Resource Group to use for the ACI instance. For example: TerrafornTestRG"
},
"azureTerraform.aci-group": {
"type": "string",
"default": "TerraformTesting",
"description": "Indicates the name of the Container Group that host the ACI instance. For example: TerrafornTesting"
},
"azureTerraform.test-location": {
"type": "string",
"default": "westus",
"description": "Indicates the location where to deploy the test container instance. For example: westus"
}
}
},
@ -106,11 +80,6 @@
"title": "visualize",
"category": "Azure Terraform"
},
{
"command": "azureTerraform.exectest",
"title": "execute test",
"category": "Azure Terraform"
},
{
"command": "azureTerraform.push",
"title": "push",

Просмотреть файл

@ -4,9 +4,7 @@ import * as vscode from "vscode";
import { BaseShell } from "./baseShell";
import { CloudShell } from "./cloudShell";
import { IntegratedShell } from "./integratedShell";
import { TestOption } from "./shared";
import { DialogOption } from "./utils/uiUtils";
import { selectWorkspaceFolder } from "./utils/workspaceUtils";
let cloudShell: CloudShell;
let integratedShell: IntegratedShell;
@ -60,23 +58,6 @@ export function activate(ctx: vscode.ExtensionContext) {
await integratedShell.visualize();
}));
ctx.subscriptions.push(vscode.commands.registerCommand("azureTerraform.exectest", async () => {
console.log("Testing current module");
const pick: string = await vscode.window.showQuickPick(
[TestOption.lint, TestOption.e2e, TestOption.custom],
{ placeHolder: "Select the type of test that you want to run" },
);
if (!pick) {
return;
}
const workingDirectory: string = await selectWorkspaceFolder();
if (!workingDirectory) {
return;
}
await getShell().runTerraformTests(pick, workingDirectory);
}));
ctx.subscriptions.push(vscode.commands.registerCommand("azureTerraform.push", async () => {
if (terminalSetToCloudshell()) {
const tfFiles: vscode.Uri[] = await vscode.workspace.findFiles(filesGlobSetting());