Choose the best Terraform patch (A/B/C/D) that implements the requested Azure Compute change safely. Only respond with a single uppercase letter.

Task Description:
There were several resources created by this module that were not getting tagged, this update fixes that by tagging the availability set, public ip, network security group and network interface. This should cover everything that can be tagged, but if there is anything missing, I'd be happy to update the PR. Thanks!

---

Choice A:
main.tf
@@ -236,6 +236,7 @@ resource "azurerm_availability_set" "vm" {
   platform_fault_domain_count  = 2
   platform_update_domain_count = 2
   managed                      = true
+  tags                         = "${var.tags}"
 }

 resource "azurerm_public_ip" "vm" {
@@ -245,6 +246,7 @@ resource "azurerm_public_ip" "vm" {
   resource_group_name          = "${azurerm_resource_group.vm.name}"
   public_ip_address_allocation = "${var.public_ip_address_allocation}"
   domain_name_label            = "${element(var.public_ip_dns, count.index)}"
+  tags                         = "${var.tags}"
 }

 resource "azurerm_network_security_group" "vm" {
@@ -264,6 +266,8 @@ resource "azurerm_network_security_group" "vm" {
     source_address_prefix      = "*"
     destination_address_prefix = "*"
   }
+
+  tags = "${var.tags}"
 }

 resource "azurerm_network_interface" "vm" {
@@ -279,4 +283,6 @@ resource "azurerm_network_interface" "vm" {
     private_ip_address_allocation = "Dynamic"
     public_ip_address_id          = "${length(azurerm_public_ip.vm.*.id) > 0 ? element(concat(azurerm_public_ip.vm.*.id, list("")), count.index) : ""}"
   }
+
+  tags = "${var.tags}"
 }
---

---

Choice B:
main.tf
@@ -236,6 +236,7 @@ resource "azurerm_availability_set" "vm" {
   platform_fault_domain_count  = 2
   platform_update_domain_count = 2
   managed                      = true
+  tags                         = "${var.tags}"
 }

 resource "azurerm_public_ip" "vm" {
@@ -245,6 +246,7 @@ resource "azurerm_public_ip" "vm" {
   resource_group_name          = "${azurerm_resource_group.vm.name}"
   public_ip_address_allocation = "${var.public_ip_address_allocation}"
   domain_name_label            = "${element(var.public_ip_dns, count.index)}"
+  tags                         = "${var.tags}"
 }

 resource "azurerm_network_security_group" "vm" {
@@ -264,6 +266,8 @@ resource "azurerm_network_security_group" "vm" {
     source_address_prefix      = "*"
     destination_address_prefix = "*"
   }
+
+  tags = "${var.tags}"
 }

 resource "azurerm_network_interface" "vm" {
@@ -279,4 +283,6 @@ resource "azurerm_network_interface" "vm" {
     private_ip_address_allocation = "Dynamic"
     public_ip_address_id          = "${length(azurerm_public_ip.vm.*.id) > 0 ? element(concat(azurerm_public_ip.vm.*.id, list("")), count.index) : ""}"
   }
+
+  tags = "${var.tags}"
 }
---

---

Choice C:
main.tf
@@ -236,6 +236,7 @@ resource "azurerm_availability_set" "vm" {
   platform_fault_domain_count  = 2
   platform_update_domain_count = 2
   managed                      = true
+  tags                         = "${var.tags}"
 }

 resource "azurerm_public_ip" "vm" {
@@ -245,6 +246,7 @@ resource "azurerm_public_ip" "vm" {
   resource_group_name          = "${azurerm_resource_group.vm.name}"
   public_ip_address_allocation = "${var.public_ip_address_allocation}"
   domain_name_label            = "${element(var.public_ip_dns, count.index)}"
+  tags                         = "${var.tags}"
 }

 resource "azurerm_network_security_group" "vm" {
@@ -264,6 +266,8 @@ resource "azurerm_network_security_group" "vm" {
     source_address_prefix    "vm"  = "*"
     destination_address_prefix = "*"
   }
+
+  tags = "${var.tags}"
 }

 resource "azurerm_network_interface" "vm" {
@@ -279,4 +283,6 @@ resource "azurerm_network_interface" "vm" {
     private_ip_address_allocation = "Dynamic"
     public_ip_address_id          = "${length(azurerm_public_ip.vm.*.id) > 0 ? element(concat(azurerm_public_ip.vm.*.id, list("")), count.index) : ""}"
   }
+
+  tags = "${var.tags}"
 }
---

---

Choice D:
main.tf
@@ -236,6 +236,7 @@ resource "azurerm_availability_set" "vm" {
   platform_fault_domain_count  = 2
   platform_update_domain_count = 2
   managed                      = true
+  tags              =           = "${var.tags}"
 }

 resource "azurerm_public_ip" "vm" {
@@ -245,6 +246,7 @@ resource "azurerm_public_ip" "vm" {
   resource_group_name          = "${azurerm_resource_group.vm.name}"
   public_ip_address_allocation = "${var.public_ip_address_allocation}"
   domain_name_label            = "${element(var.public_ip_dns, count.index)}"
+  tags                         = "${var.tags}"
 }

 resource "azurerm_network_security_group" "vm" {
@@ -264,6 +266,8 @@ resource "azurerm_network_security_group" "vm" {
     source_address_prefix      = "*"
     destination_address_prefix = "*"
   }
+
+  tags = "${var.tags}"
 }

 resource "azurerm_network_interface" "vm" {
@@ -279,4 +283,6 @@ resource "azurerm_network_interface" "vm" {
     private_ip_address_allocation = "Dynamic"
     public_ip_address_id          = "${length(azurerm_public_ip.vm.*.id) > 0 ? element(concat(azurerm_public_ip.vm.*.id, list("")), count.index) : ""}"
   }
+
+  tags = "${var.tags}"
 }
---

---


Choose the best Terraform patch (A/B/C/D) that implements the requested Azure Compute change safely. Only respond with a single uppercase letter.

Task Description:
Hi,

I just modify output.tf.
We are able to get **vm_ids** for _azurerm_virtual_machine.vm-\*-with-datadisk.\*.id_

Thanks.
Regards

---

Choice A:
outputs.tf
@@ -1,6 +1,6 @@

 "vm_ids" {
   description = "Virtual machine ids created."
-  value       = "${concat(azurerm_virtual_machine.vm-windows.*.id, azurerm_virtual_machine.vm-linux.*.id)}"
+  value       = "${concat(azurerm_virtual_machine.vm-windows.*.id,azurerm_virtual_machine.vm-windows-with-datadisk.*.id, azurerm_virtual_machine.vm-linux.*.id,azurerm_virtual_machine.vm-linux-with-datadisk.*.id)}"
 }

 output "network_security_group_id" {
---

---

Choice B:
"vm_ids" -1,6 +1,6 @@
 output "vm_ids" {
   description = "Virtual machine ids created."
-  value       = "${concat(azurerm_virtual_machine.vm-windows.*.id, azurerm_virtual_machine.vm-linux.*.id)}"
+  value       = "${concat(azurerm_virtual_machine.vm-windows.*.id,azurerm_virtual_machine.vm-windows-with-datadisk.*.id, azurerm_virtual_machine.vm-linux.*.id,azurerm_virtual_machine.vm-linux-with-datadisk.*.id)}"
 }

 output "network_security_group_id" {
---

---

Choice C:
outputs.tf
@@ -1,6 +1,6 @@
 output "vm_ids" {
   description = "Virtual machine ids created."
-  value       = "${concat(azurerm_virtual_machine.vm-windows.*.id, azurerm_virtual_machine.vm-linux.*.id)}"
+  value       = "${concat(azurerm_virtual_machine.vm-windows.*.id,azurerm_virtual_machine.vm-windows-with-datadisk.*.id, azurerm_virtual_machine.vm-linux.*.id,azurerm_virtual_machine.vm-linux-with-datadisk.*.id)}"
 }

 output "network_security_group_id" {
---

---

Choice D:
outputs.tf
@@ -1,6 +1,6 @@
 output "vm_ids" {
   description = "Virtual machine ids created."
-  value       = "${concat(azurerm_virtual_machine.vm-windows.*.id, azurerm_virtual_machine.vm-linux.*.id)}"
+         = "${concat(azurerm_virtual_machine.vm-windows.*.id,azurerm_virtual_machine.vm-windows-with-datadisk.*.id, azurerm_virtual_machine.vm-linux.*.id,azurerm_virtual_machine.vm-linux-with-datadisk.*.id)}"
 }

 output "network_security_group_id" {
---

---


Choose the best Terraform patch (A/B/C/D) that implements the requested Azure Compute change safely. Only respond with a single uppercase letter.

Task Description:
fix for https://github.com/Azure/terraform-azurerm-loadbalancer/issues/11

with this change, we can use output from the loadbalancer module to create the lb backend

---

Choice A:
main.tf
@@ -282,10 +282,11 @@ resource "azurerm_network_interface" "vm" {
   network_security_group_id = "${azurerm_network_security_group.vm.id}"

   ip_configuration {
-    name                          = "ipconfig${count.index}"
-    subnet_id                     = "${var.vnet_subnet_id}"
-    private_ip_address_allocation = "Dynamic"
-    public_ip_address_id          = "${length(azurerm_public_ip.vm.*.id) > 0 ? element(concat(azurerm_public_ip.vm.*.id, list("")), count.index) : ""}"
+    name                                    = "ipconfig${count.index}"
+    subnet_id                               = "${var.vnet_subnet_id}"
+    private_ip_address_allocation           = "Dynamic"
+    public_ip_address_id                    = "${length(azurerm_public_ip.vm.*.id) > 0 ? element(concat(azurerm_public_ip.vm.*.id, list("")), count.index) : ""}"
+    load_balancer_backend_address_pools_ids = ["${var.lb_backend_pool_ids}"]
   }

   tags = "${var.tags}"
---
variables.tf
@@ -140,3 +140,9 @@ variable "boot_diagnostics_sa_type" {
   description = "(Optional) Storage account type for boot diagnostics"
   default     = "Standard_LRS"
 }
+
+variable "lb_backend_pool_ids" {
+  type        = "list"
+  description = "(Optional) Backend address pool ids of the loadbalancer "
+  default     = []
+}
---

---

Choice B:
main.tf
@@ -282,10 +282,11 @@ resource "azurerm_network_interface" "vm" {
   network_security_group_id = "${azurerm_network_security_group.vm.id}"

   ip_configuration {
-    name                          = "ipconfig${count.index}"
-    subnet_id                     = "${var.vnet_subnet_id}"
-    private_ip_address_allocation = "Dynamic"
-    public_ip_address_id          = "${length(azurerm_public_ip.vm.*.id) > 0 ? element(concat(azurerm_public_ip.vm.*.id, list("")), count.index) : ""}"
+    name                                    = "ipconfig${count.index}"
+    subnet_id                               = "${var.vnet_subnet_id}"
+    private_ip_address_allocation           = "Dynamic"
+    public_ip_address_id                    = "${length(azurerm_public_ip.vm.*.id) > 0 ? element(concat(azurerm_public_ip.vm.*.id, list("")), count.index) : ""}"
+    load_balancer_backend_address_pools_ids = ["${var.lb_backend_pool_ids}"]
   }

   tags = "${var.tags}"
---
variables.tf
@@ -140,3 +140,9 @@ variable "boot_diagnostics_sa_type" {
   description = "(Optional) Storage account type for boot diagnostics"
   default     = "Standard_LRS"
 }
+
+variable "lb_backend_pool_ids" {
+  type        = "list"
+  description = "(Optional) Backend address pool ids of the loadbalancer "
+  default     = []
+}
---

---

Choice C:
main.tf
@@ -282,10 +282,11 @@ resource "azurerm_network_interface" "vm" {
   network_security_group_id = "${azurerm_network_security_group.vm.id}"

   ip_configuration {
-    name                          = "ipconfig${count.index}"
-    subnet_id                     = "${var.vnet_subnet_id}"
-    private_ip_address_allocation = "Dynamic"
-    public_ip_address_id          = "${length(azurerm_public_ip.vm.*.id) > 0 ? element(concat(azurerm_public_ip.vm.*.id, list("")), count.index) : ""}"
+    name                                    = "ipconfig${count.index}"
+    subnet_id                       "boot_diagnostics_sa_type"        = "${var.vnet_subnet_id}"
+    private_ip_address_allocation           = "Dynamic"
+    public_ip_address_id                    = "${length(azurerm_public_ip.vm.*.id) > 0 ? element(concat(azurerm_public_ip.vm.*.id, list("")), count.index) : ""}"
+    load_balancer_backend_address_pools_ids = ["${var.lb_backend_pool_ids}"]
   }

   tags = "${var.tags}"
---
variables.tf
@@ -140,3 +140,9 @@ variable "boot_diagnostics_sa_type" {
   description = "(Optional) Storage account type for boot diagnostics"
   default     = "Standard_LRS"
 }
+
+variable "lb_backend_pool_ids" {
+  type        = "list"
+  description = "(Optional) Backend address pool ids of the loadbalancer "
+  default     = []
+}
---

---

Choice D:
main.tf
@@ -282,10 +282,11 @@ resource "azurerm_network_interface" "vm" {
   network_security_group_id = "${azurerm_network_security_group.vm.id}"

   ip_configuration {
-    name                          = "ipconfig${count.index}"
-    subnet_id                     = "${var.vnet_subnet_id}"
-    private_ip_address_allocation = "Dynamic"
-    public_ip_address_id          = "${length(azurerm_public_ip.vm.*.id) > 0 ? element(concat(azurerm_public_ip.vm.*.id, list("")), count.index) : ""}"
+    name                                    = "ipconfig${count.index}"
+    subnet_id                               = "${var.vnet_subnet_id}"
+    private_ip_address_allocation           = "Dynamic"
+    public_ip_address_id                    = "${length(azurerm_public_ip.vm.*.id) > 0 ? element(concat(azurerm_public_ip.vm.*.id, list("")), count.index) : ""}"
+    load_balancer_backend_address_pools_ids = ["${var.lb_backend_pool_ids}"]
   }

   tags = "${var.tags}"
---
variables.tf
@@ -140,3 +140,9 @@ variable "boot_diagnostics_sa_type" {
   description = "(Optional) Storage account type for boot diagnostics"
   default     = "Standard_LRS"
 }
+
+variable "lb_backend_pool_ids" {
+  type        = "list"
+  description = "(Optional) Backend address pool ids of the loadbalancer "
+  default     = []
+}
---

---


Choose the best Terraform patch (A/B/C/D) that implements the requested Azure Compute change safely. Only respond with a single uppercase letter.

Task Description:
This PR contains:

Upgrade terramodtest v0.2.0 to get test-kitchen tasks support.
Replace test-kitchen code in Rakefile with reusable task from gem package.
Update Readme to contain "bundle install" before run "rake" build task.

---

Choice A:
.travis.yml
@@ -13,12 +13,12 @@ services:
   - docker

 env:
-  - TERRAFORM_VERSION=0.11.1 IMAGE_NAME=azure-compute-module
+  - TERRAFORM_VERSION=0.11.3 IMAGE_NAME=azure-compute-module

 jobs:
   include:
-    - stage: rake build
+    - stage: rake full
       install: true
       script:
-      - docker build --build-arg BUILD_TERRAFORM_VERSION=${TERRAFORM_VERSION} -t ${IMAGE_NAME} .
-      - docker run ${IMAGE_NAME} rake build
+      - docker build --build-arg BUILD_TERRAFORM_VERSION=${TERRAFORM_VERSION} --build-arg BUILD_ARM_SUBSCRIPTION_ID=$ARM_SUBSCRIPTION_ID --build-arg BUILD_ARM_CLIENT_ID=$ARM_CLIENT_ID --build-arg BUILD_ARM_CLIENT_SECRET=$ARM_CLIENT_SECRET --build-arg BUILD_ARM_TENANT_ID=$ARM_TENANT_ID -t ${IMAGE_NAME} .
+      - docker run ${IMAGE_NAME} rake full
---
Dockerfile
@@ -23,5 +23,7 @@ ENV ARM_TEST_LOCATION_ALT=${BUILD_ARM_TEST_LOCATION_ALT}
 RUN mkdir /usr/src/${MODULE_NAME}
 COPY . /usr/src/${MODULE_NAME}

+RUN ssh-keygen -q -t rsa -b 4096 -f $HOME/.ssh/id_rsa
+
 WORKDIR /usr/src/${MODULE_NAME}
 RUN ["bundle", "install", "--gemfile", "./Gemfile"]
---
Gemfile
@@ -4,7 +4,7 @@ source 'https://rubygems.org/'

 group :test do
   git 'https://github.com/Azure/terramodtest.git' do
-    gem 'terramodtest', :tag => 'v0.1.0'
+    gem 'terramodtest', :tag => 'v0.2.0'
   end
   gem 'test-kitchen', '1.16.0'
   gem 'kitchen-terraform', '3.0.0'
---
README.md
@@ -199,13 +199,13 @@ $ docker build --build-arg BUILD_ARM_SUBSCRIPTION_ID=$ARM_SUBSCRIPTION_ID --buil
 This runs the build and unit tests:

 ```sh
-$ docker run --rm azure-compute /bin/bash -c "rake build"
+$ docker run --rm azure-compute /bin/bash -c "bundle install && rake build"
 ```

 This runs the end to end tests:

 ```sh
-$ docker run -v ~/.ssh:/root/.ssh/ --rm azure-compute /bin/bash -c "rake e2e"
+$ docker run --rm azure-compute /bin/bash -c "bundle install && rake e2e"
 ```

 Authors
---
Rakefile
@@ -26,29 +26,17 @@ namespace :static do
 end

 namespace :integration do
-  task :converge do
-    exit_code = `kitchen converge`
-    if exit_code != 0
-      raise "ERROR: Test kitchen converge failed! #{exit_code}\n"
-    end
+  task :converge do
+    kitchen_converge
   end
   task :verify do
-    exit_code = `kitchen verify`
-    if exit_code != 0
-      raise "ERROR: Test kitchen verify failed! #{exit_code}\n"
-    end
+    kitchen_verify
   end
   task exit_code do
-    exit_code = `kitchen test`
-    if exit_code != 0
-      raise "ERROR: Test kitchen test failed! #{exit_code}\n"
-    end
+    kitchen_test
   end
   task :destroy do
-    exit_code = `kitchen destroy`
-    if exit_code != 0
-      raise "ERROR: Test kitchen destroy failed! #{exit_code}\n"
-    end
+    kitchen_destroy
   end
 end

---
test/integration/fixtures/main.tf
@@ -1,17 +1,25 @@
+provider "random" {
+  version = "~> 1.0"
+}
+
+resource "random_id" "ip_dns" {
+  byte_length = 8
+}
+
 module "linuxservers" {
   source                       = "../../../"
   location                     = "${var.location}"
   vm_os_simple                 = "${var.vm_os_simple}"
   public_ip_address_allocation = "static"
-  public_ip_dns                = ["${var.public_ip_dns}"]
+  public_ip_dns                = ["linuxserver-${random_id.ip_dns.hex}"]
   vnet_subnet_id               = "${module.network.vnet_subnets[0]}"
   ssh_key                      = "${var.ssh_key}"
   resource_group_name          = "${var.resource_group_name}"
 }

 module "network" {
+  version             = "2.0.0"
   source              = "Azure/network/azurerm"
   location            = "${var.location}"
   resource_group_name = "${var.resource_group_name}"
-  allow_ssh_traffic   = true
 }
---
test/integration/fixtures/testing.tfvars
@@ -2,4 +2,3 @@ location = "West US 2"
 ssh_key = "~/.ssh/id_rsa.pub"
 resource_group_name = "azure_compute_e2e"
 vm_os_simple = "UbuntuServer"
-public_ip_dns = "linsimplevmips"
---
test/integration/fixtures/variables.tf
@@ -2,4 +2,3 @@ variable "location" {}
 variable "ssh_key" {}
 variable "resource_group_name" {}
 variable "vm_os_simple" {}
-variable "public_ip_dns" {}
---

---

Choice B:
.travis.yml
@@ -13,12 +13,12 @@ services:
   - docker

 env:
-  - TERRAFORM_VERSION=0.11.1 IMAGE_NAME=azure-compute-module
+  - TERRAFORM_VERSION=0.11.3 IMAGE_NAME=azure-compute-module

 jobs:
   include:
-    - stage: rake build
+    - stage: rake full
       install: true
       script:
-      - docker build --build-arg BUILD_TERRAFORM_VERSION=${TERRAFORM_VERSION} -t ${IMAGE_NAME} .
-      - docker run ${IMAGE_NAME} rake build
+      - docker build --build-arg BUILD_TERRAFORM_VERSION=${TERRAFORM_VERSION} --build-arg BUILD_ARM_SUBSCRIPTION_ID=$ARM_SUBSCRIPTION_ID --build-arg BUILD_ARM_CLIENT_ID=$ARM_CLIENT_ID --build-arg BUILD_ARM_CLIENT_SECRET=$ARM_CLIENT_SECRET --build-arg BUILD_ARM_TENANT_ID=$ARM_TENANT_ID -t ${IMAGE_NAME} .
+      - docker run ${IMAGE_NAME} rake full
---
Dockerfile
@@ -23,5 +23,7 @@ ENV ARM_TEST_LOCATION_ALT=${BUILD_ARM_TEST_LOCATION_ALT}
 RUN mkdir /usr/src/${MODULE_NAME}
 COPY . /usr/src/${MODULE_NAME}

+RUN ssh-keygen -q -t rsa -b 4096 -f $HOME/.ssh/id_rsa
+
 WORKDIR /usr/src/${MODULE_NAME}
 RUN ["bundle", "install", "--gemfile", "./Gemfile"]
---
Gemfile
@@ -4,7 +4,7 @@ source 'https://rubygems.org/'

 group :test do
   git 'https://github.com/Azure/terramodtest.git' do
-    gem 'terramodtest', :tag => 'v0.1.0'
+    gem 'terramodtest', :tag => 'v0.2.0'
   end
   gem 'test-kitchen', '1.16.0'
   gem 'kitchen-terraform', '3.0.0'
---
README.md
@@ -199,13 +199,13 @@ $ docker build --build-arg BUILD_ARM_SUBSCRIPTION_ID=$ARM_SUBSCRIPTION_ID --buil
 This runs the build and unit tests:

 ```sh
-$ docker run --rm azure-compute /bin/bash -c "rake build"
+$ docker run --rm azure-compute /bin/bash -c "bundle install && rake build"
 ```

 This runs the end to end tests:

 ```sh
-$ docker run -v ~/.ssh:/root/.ssh/ --rm azure-compute /bin/bash -c "rake e2e"
+$ docker run --rm azure-compute /bin/bash -c "bundle install && rake e2e"
 ```

 Authors
---
Rakefile
@@ -26,29 +26,17 @@ namespace :static do
 end

 namespace :integration do
-  task :converge do
-    exit_code = `kitchen converge`
-    if exit_code != 0
-      raise "ERROR: Test kitchen converge failed! #{exit_code}\n"
-    end
+  task :converge do
+    kitchen_converge
   end
   task :verify do
-    exit_code = `kitchen verify`
-    if exit_code != 0
-      raise "ERROR: Test kitchen verify failed! #{exit_code}\n"
-    end
+    kitchen_verify
   end
   task :test do
-    exit_code = `kitchen test`
-    if exit_code != 0
-      raise "ERROR: Test kitchen test failed! #{exit_code}\n"
-    end
+    kitchen_test
   end
   task :destroy do
-    exit_code = `kitchen destroy`
-    if exit_code != 0
-      raise "ERROR: Test kitchen destroy failed! #{exit_code}\n"
-    end
+    kitchen_destroy
   end
 end

---
test/integration/fixtures/main.tf
@@ -1,17 +1,25 @@
+provider "random" {
+  version = "~> 1.0"
+}
+
+resource "random_id" "ip_dns" {
+  byte_length = 8
+}
+
 module "linuxservers" {
   source                       = "../../../"
   location                     = "${var.location}"
   vm_os_simple                 = "${var.vm_os_simple}"
   public_ip_address_allocation = "static"
-  public_ip_dns                = ["${var.public_ip_dns}"]
+  public_ip_dns                = ["linuxserver-${random_id.ip_dns.hex}"]
   vnet_subnet_id               = "${module.network.vnet_subnets[0]}"
   ssh_key                      = "${var.ssh_key}"
   resource_group_name          = "${var.resource_group_name}"
 }

 module "network" {
+  version             = "2.0.0"
   source              = "Azure/network/azurerm"
   location            = "${var.location}"
   resource_group_name = "${var.resource_group_name}"
-  allow_ssh_traffic   = true
 }
---
test/integration/fixtures/testing.tfvars
@@ -2,4 +2,3 @@ location = "West US 2"
 ssh_key = "~/.ssh/id_rsa.pub"
 resource_group_name = "azure_compute_e2e"
 vm_os_simple = "UbuntuServer"
-public_ip_dns = "linsimplevmips"
---
test/integration/fixtures/variables.tf
@@ -2,4 +2,3 @@ variable "location" {}
 variable "ssh_key" {}
 variable "resource_group_name" {}
 variable "vm_os_simple" {}
-variable "public_ip_dns" {}
---

---

Choice C:
.travis.yml
@@ -13,12 +13,12 @@ services:
   - docker

 env:
-  - TERRAFORM_VERSION=0.11.1 IMAGE_NAME=azure-compute-module
+  - TERRAFORM_VERSION=0.11.3 IMAGE_NAME=azure-compute-module

 jobs:
   include:
-    - stage: rake build
+    - stage:  full
       install: true
       script:
-      - docker build --build-arg BUILD_TERRAFORM_VERSION=${TERRAFORM_VERSION} -t ${IMAGE_NAME} .
-      - docker run ${IMAGE_NAME} rake build
+      - docker build --build-arg BUILD_TERRAFORM_VERSION=${TERRAFORM_VERSION} --build-arg BUILD_ARM_SUBSCRIPTION_ID=$ARM_SUBSCRIPTION_ID --build-arg BUILD_ARM_CLIENT_ID=$ARM_CLIENT_ID --build-arg BUILD_ARM_CLIENT_SECRET=$ARM_CLIENT_SECRET --build-arg BUILD_ARM_TENANT_ID=$ARM_TENANT_ID -t ${IMAGE_NAME} .
+      - docker run ${IMAGE_NAME} rake full
---
Dockerfile
@@ -23,5 +23,7 @@ ENV ARM_TEST_LOCATION_ALT=${BUILD_ARM_TEST_LOCATION_ALT}
 RUN mkdir /usr/src/${MODULE_NAME}
 COPY . /usr/src/${MODULE_NAME}

+RUN ssh-keygen -q -t rsa -b 4096 -f $HOME/.ssh/id_rsa
+
 WORKDIR /usr/src/${MODULE_NAME}
 RUN ["bundle", "install", "--gemfile", "./Gemfile"]
---
Gemfile
@@ -4,7 +4,7 @@ source 'https://rubygems.org/'

 group :test do
   git 'https://github.com/Azure/terramodtest.git' do
-    gem 'terramodtest', :tag => 'v0.1.0'
+    gem 'terramodtest', :tag => 'v0.2.0'
   end
   gem 'test-kitchen', '1.16.0'
   gem 'kitchen-terraform', '3.0.0'
---
README.md
@@ -199,13 +199,13 @@ $ docker build --build-arg BUILD_ARM_SUBSCRIPTION_ID=$ARM_SUBSCRIPTION_ID --buil
 This runs the build and unit tests:

 ```sh
-$ docker run --rm azure-compute /bin/bash -c "rake build"
+$ docker run --rm azure-compute /bin/bash -c "bundle install && rake build"
 ```

 This runs the end to end tests:

 ```sh
-$ docker run -v ~/.ssh:/root/.ssh/ --rm azure-compute /bin/bash -c "rake e2e"
+$ docker run --rm azure-compute /bin/bash -c "bundle install && rake e2e"
 ```

 Authors
---
Rakefile
@@ -26,29 +26,17 @@ namespace :static do
 end

 namespace :integration do
-  task :converge do
-    exit_code = `kitchen converge`
-    if exit_code != 0
-      raise "ERROR: Test kitchen converge failed! #{exit_code}\n"
-    end
+  task :converge do
+    kitchen_converge
   end
   task :verify do
-    exit_code = `kitchen verify`
-    if exit_code != 0
-      raise "ERROR: Test kitchen verify failed! #{exit_code}\n"
-    end
+    kitchen_verify
   end
   task :test do
-    exit_code = `kitchen test`
-    if exit_code != 0
-      raise "ERROR: Test kitchen test failed! #{exit_code}\n"
-    end
+    kitchen_test
   end
   task :destroy do
-    exit_code = `kitchen destroy`
-    if exit_code != 0
-      raise "ERROR: Test kitchen destroy failed! #{exit_code}\n"
-    end
+    kitchen_destroy
   end
 end

---
test/integration/fixtures/main.tf
@@ -1,17 +1,25 @@
+provider "random" {
+  version = "~> 1.0"
+}
+
+resource "random_id" "ip_dns" {
+  byte_length = 8
+}
+
 module "linuxservers" {
   source                       = "../../../"
   location                     = "${var.location}"
   vm_os_simple                 = "${var.vm_os_simple}"
   public_ip_address_allocation = "static"
-  public_ip_dns                = ["${var.public_ip_dns}"]
+  public_ip_dns                = ["linuxserver-${random_id.ip_dns.hex}"]
   vnet_subnet_id               = "${module.network.vnet_subnets[0]}"
   ssh_key                      = "${var.ssh_key}"
   resource_group_name          = "${var.resource_group_name}"
 }

 module "network" {
+  version             = "2.0.0"
   source              = "Azure/network/azurerm"
   location            = "${var.location}"
   resource_group_name = "${var.resource_group_name}"
-  allow_ssh_traffic   = true
 }
---
test/integration/fixtures/testing.tfvars
@@ -2,4 +2,3 @@ location = "West US 2"
 ssh_key = "~/.ssh/id_rsa.pub"
 resource_group_name = "azure_compute_e2e"
 vm_os_simple = "UbuntuServer"
-public_ip_dns = "linsimplevmips"
---
test/integration/fixtures/variables.tf
@@ -2,4 +2,3 @@ variable "location" {}
 variable "ssh_key" {}
 variable "resource_group_name" {}
 variable "vm_os_simple" {}
-variable "public_ip_dns" {}
---

---

Choice D:
.travis.yml
@@ -13,12 +13,12 @@ services:
   - docker

 env:
-  - TERRAFORM_VERSION=0.11.1 IMAGE_NAME=azure-compute-module
+  - TERRAFORM_VERSION=0.11.3 IMAGE_NAME=azure-compute-module

 jobs:
   include:
-    - stage: rake build
+    - stage: rake full
       install: true
       script:
-      - docker build --build-arg BUILD_TERRAFORM_VERSION=${TERRAFORM_VERSION} -t ${IMAGE_NAME} .
-      - docker run ${IMAGE_NAME} rake build
+      - docker build --build-arg BUILD_TERRAFORM_VERSION=${TERRAFORM_VERSION} --build-arg BUILD_ARM_SUBSCRIPTION_ID=$ARM_SUBSCRIPTION_ID --build-arg BUILD_ARM_CLIENT_ID=$ARM_CLIENT_ID --build-arg BUILD_ARM_CLIENT_SECRET=$ARM_CLIENT_SECRET --build-arg BUILD_ARM_TENANT_ID=$ARM_TENANT_ID -t ${IMAGE_NAME} .
+      - docker run ${IMAGE_NAME} rake full
---
Dockerfile
@@ -23,5 +23,7 @@ ENV ARM_TEST_LOCATION_ALT=${BUILD_ARM_TEST_LOCATION_ALT}
 RUN mkdir /usr/src/${MODULE_NAME}
 COPY . /usr/src/${MODULE_NAME}

+RUN ssh-keygen -q -t rsa -b 4096 -f $HOME/.ssh/id_rsa
+
 WORKDIR /usr/src/${MODULE_NAME}
 RUN ["bundle", "install", "--gemfile", "./Gemfile"]
---
Gemfile
@@ -4,7 +4,7 @@ source 'https://rubygems.org/'

 group :test do
   git 'https://github.com/Azure/terramodtest.git' do
-    gem 'terramodtest', :tag => 'v0.1.0'
+    gem 'terramodtest', :tag => 'v0.2.0'
   end
   gem 'test-kitchen', '1.16.0'
   gem 'kitchen-terraform', '3.0.0'
---
README.md
@@ -199,13 +199,13 @@ $ docker build --build-arg BUILD_ARM_SUBSCRIPTION_ID=$ARM_SUBSCRIPTION_ID --buil
 This runs the build and unit tests:

 ```sh
-$ docker run --rm azure-compute /bin/bash -c "rake build"
+$ docker run --rm azure-compute /bin/bash -c "bundle install && rake build"
 ```

 This runs the end to end tests:

 ```sh
-$ docker run -v ~/.ssh:/root/.ssh/ --rm azure-compute /bin/bash -c "rake  docker run --rm azure-compute /bin/bash -c "bundle install && rake e2e"
 ```

 Authors
---
Rakefile
@@ -26,29 +26,17 @@ namespace :static do
 end

 namespace :integration do
-  task :converge do
-    exit_code = `kitchen converge`
-    if exit_code != 0
-      raise "ERROR: Test kitchen converge failed! #{exit_code}\n"
-    end
+  task :converge do
+    kitchen_converge
   end
   task :verify do
-    exit_code = `kitchen verify`
-    if exit_code != 0
-      raise "ERROR: Test kitchen verify failed! #{exit_code}\n"
-    end
+    kitchen_verify
   end
   task :test do
-    exit_code = `kitchen test`
-    if exit_code != 0
-      raise "ERROR: Test kitchen test failed! #{exit_code}\n"
-    end
+    kitchen_test
   end
   task :destroy do
-    exit_code = `kitchen destroy`
-    if exit_code != 0
-      raise "ERROR: Test kitchen destroy failed! #{exit_code}\n"
-    end
+    kitchen_destroy
   end
 end

---
test/integration/fixtures/main.tf
@@ -1,17 +1,25 @@
+provider "random" {
+  version = "~> 1.0"
+}
+
+resource "random_id" "ip_dns" {
+  byte_length = 8
+}
+
 module "linuxservers" {
   source                       = "../../../"
   location                     = "${var.location}"
   vm_os_simple                 = "${var.vm_os_simple}"
   public_ip_address_allocation = "static"
-  public_ip_dns                = ["${var.public_ip_dns}"]
+  public_ip_dns                = ["linuxserver-${random_id.ip_dns.hex}"]
   vnet_subnet_id               = "${module.network.vnet_subnets[0]}"
   ssh_key                      = "${var.ssh_key}"
   resource_group_name          = "${var.resource_group_name}"
 }

 module "network" {
+  version             = "2.0.0"
   source              = "Azure/network/azurerm"
   location            = "${var.location}"
   resource_group_name = "${var.resource_group_name}"
-  allow_ssh_traffic   = true
 }
---
test/integration/fixtures/testing.tfvars
@@ -2,4 +2,3 @@ location = "West US 2"
 ssh_key = "~/.ssh/id_rsa.pub"
 resource_group_name = "azure_compute_e2e"
 vm_os_simple = "UbuntuServer"
-public_ip_dns = "linsimplevmips"
---
test/integration/fixtures/variables.tf
@@ -2,4 +2,3 @@ variable "location" {}
 variable "ssh_key" {}
 variable "resource_group_name" {}
 variable "vm_os_simple" {}
-variable "public_ip_dns" {}
---

---


Choose the best Terraform patch (A/B/C/D) that implements the requested Azure Compute change safely. Only respond with a single uppercase letter.

Task Description:
The latest version of the network module no longer adds in nsg rules / vars, so locking to the older version of the network module until a better access solution is created.

---

Choice A:
README.md
@@ -42,6 +42,7 @@ Provisions an Ubuntu Server 16.04-LTS VM and a Windows 2016 Datacenter Server VM

   module "network" {
     source              = "Azure/network/azurerm"
+    version             = "~> 1.1.1"
     location            = "West US 2"
     allow_rdp_traffic   = "true"
     allow_ssh_traffic   = "true"
@@ -122,8 +123,9 @@ More specifically this provisions:
   }

   module "network" {
-    source = "Azure/network/azurerm"
-    location = "westus2"
+    source               "Azure/network/azurerm"
+    version             = "~> 1.1.1"
+    location            = "westus2"
     allow_rdp_traffic   = "true"
     allow_ssh_traffic   = "true"
     resource_group_name = "terraform-advancedvms"
---

---

Choice B:
README.md
@@ -42,6 +42,7 @@ Provisions an Ubuntu Server 16.04-LTS VM and a Windows 2016 Datacenter Server VM

   module "network" {
     source              = "Azure/network/azurerm"
+    version             = "~> 1.1.1"
     location            = "West US 2"
     allow_rdp_traffic   = "true"
     allow_ssh_traffic   = "true"
@@ -122,8 +123,9 @@ More specifically this provisions:
   }

   module "network" {
-    source = "Azure/network/azurerm"
-    location = "westus2"
+    source              = "Azure/network/azurerm"
+    version             = "~> 1.1.1"
+    location            = "westus2"
     allow_rdp_traffic   = "true"
     allow_ssh_traffic   = "true"
     resource_group_name = "terraform-advancedvms"
---

---

Choice C:
README.md
@@ -42,6 +42,7 @@ Provisions an Ubuntu Server 16.04-LTS VM and a Windows 2016 Datacenter Server VM

   module "network" {
     source              = "Azure/network/azurerm"
+    version             = "~> 1.1.1"
     location            = "West US 2"
     allow_rdp_traffic   = "true"
     allow_ssh_traffic   = "true"
@@ -122,8 +123,9 @@ More specifically this provisions:
   }

   module "network" {
-    source = "Azure/network/azurerm"
-    location = "westus2"
+    source              = "Azure/network/azurerm"
+    version             = "~> 1.1.1"
+    location            = "westus2"
     allow_rdp_traffic   = "true"
     allow_ssh_traffic   = "true"
     resource_group_name = "terraform-advancedvms"
---

---

Choice D:
README.md
@@ -42,6 +42,7 @@ Provisions an Ubuntu Server 16.04-LTS VM and a Windows 2016 Datacenter Server VM

   module "network" {
     source              = "Azure/network/azurerm"
+    version             = "~> 1.1.1"
     location            = "West US 2"
     allow_rdp_traffic   = "true"
     allow_ssh_traffic   = "true"
@@ -122,8 +123,9 @@ More specifically this provisions:
   }

   module "network" {
-    source = "Azure/network/azurerm"
-    location = "westus2"
+    source              = "Azure/network/azurerm"
+    version             = "~> 1.1.1"
+    location            = "westus2"
     allow_rdp_traffic   = "true"
     allow_ssh_traffic   = "true"
     resource_group_name = "terraform-advancedvms"
---

---


Choose the best Terraform patch (A/B/C/D) that implements the requested Azure Compute change safely. Only respond with a single uppercase letter.

Task Description:
added missed --build-arg for other 3 arguments.

---

Choice A:
README.md
@@ -191,7 +191,7 @@ We provide a Dockerfile to build a new image based `FROM` the `microsoft/terrafo
 This builds the custom image:

 ```sh
-$ docker build --build-arg BUILD_ARM_SUBSCRIPTION_ID=$ARM_SUBSCRIPTION_ID BUILD_ARM_CLIENT_ID=$ARM_CLIENT_ID BUILD_ARM_CLIENT_SECRET=$ARM_CLIENT_SECRET BUILD_ARM_TENANT_ID=$ARM_TENANT_ID -t azure-compute .
+$ docker BUILD_ARM_CLIENT_ID=$ARM_CLIENT_ID --build-arg BUILD_ARM_SUBSCRIPTION_ID=$ARM_SUBSCRIPTION_ID --build-arg BUILD_ARM_CLIENT_ID=$ARM_CLIENT_ID --build-arg BUILD_ARM_CLIENT_SECRET=$ARM_CLIENT_SECRET --build-arg BUILD_ARM_TENANT_ID=$ARM_TENANT_ID -t azure-compute .
 ```

 This runs the build and unit tests:
---

---

Choice B:
README.md
@@ -191,7 +191,7 @@ We provide a
 to build a new image based `FROM` the `microsoft/terrafo
 This builds the custom image:

 ```sh
-$ docker build --build-arg BUILD_ARM_SUBSCRIPTION_ID=$ARM_SUBSCRIPTION_ID BUILD_ARM_CLIENT_ID=$ARM_CLIENT_ID BUILD_ARM_CLIENT_SECRET=$ARM_CLIENT_SECRET BUILD_ARM_TENANT_ID=$ARM_TENANT_ID -t azure-compute .
+$ docker build --build-arg BUILD_ARM_SUBSCRIPTION_ID=$ARM_SUBSCRIPTION_ID --build-arg BUILD_ARM_CLIENT_ID=$ARM_CLIENT_ID --build-arg BUILD_ARM_CLIENT_SECRET=$ARM_CLIENT_SECRET --build-arg BUILD_ARM_TENANT_ID=$ARM_TENANT_ID -t azure-compute .
 ```

 This runs the build and unit tests:
---

---

Choice C:
README.md
@@ -191,7 +191,7 @@ We provide a Dockerfile to build a new image based `FROM` the `microsoft/terrafo
 This builds the custom image:

 ```sh
-$ docker runs --build-arg BUILD_ARM_SUBSCRIPTION_ID=$ARM_SUBSCRIPTION_ID BUILD_ARM_CLIENT_ID=$ARM_CLIENT_ID BUILD_ARM_CLIENT_SECRET=$ARM_CLIENT_SECRET BUILD_ARM_TENANT_ID=$ARM_TENANT_ID -t azure-compute .
+$ docker build --build-arg BUILD_ARM_SUBSCRIPTION_ID=$ARM_SUBSCRIPTION_ID --build-arg BUILD_ARM_CLIENT_ID=$ARM_CLIENT_ID --build-arg BUILD_ARM_CLIENT_SECRET=$ARM_CLIENT_SECRET --build-arg BUILD_ARM_TENANT_ID=$ARM_TENANT_ID -t azure-compute .
 ```

 This runs the build and unit tests:
---

---

Choice D:
README.md
@@ -191,7 +191,7 @@ We provide a Dockerfile to build a new image based `FROM` the `microsoft/terrafo
 This builds the custom image:

 ```sh
-$ docker build --build-arg BUILD_ARM_SUBSCRIPTION_ID=$ARM_SUBSCRIPTION_ID BUILD_ARM_CLIENT_ID=$ARM_CLIENT_ID BUILD_ARM_CLIENT_SECRET=$ARM_CLIENT_SECRET BUILD_ARM_TENANT_ID=$ARM_TENANT_ID -t azure-compute .
+$ docker build --build-arg BUILD_ARM_SUBSCRIPTION_ID=$ARM_SUBSCRIPTION_ID --build-arg BUILD_ARM_CLIENT_ID=$ARM_CLIENT_ID --build-arg BUILD_ARM_CLIENT_SECRET=$ARM_CLIENT_SECRET --build-arg BUILD_ARM_TENANT_ID=$ARM_TENANT_ID -t azure-compute .
 ```

 This runs the build and unit tests:
---

---


Choose the best Terraform patch (A/B/C/D) that implements the requested Azure Compute change safely. Only respond with a single uppercase letter.

Task Description:
1. Added build arguments to setup environment variables to run kitchen terraform tests.
2. Installed test-kitchen runner and kitchen-terraform driver into bundle path due to "bundler/setup" in the Rakefile.
3. Updated the README due to new workflow.

---

Choice A:
provide -1,6 +1,19 @@
 FROM microsoft/terraform-test:0.11.1

-ENV MODULE_NAME terraform-azurerm-compute
+ARG MODULE_NAME="terraform-azurerm-compute"
+ARG BUILD_ARM_SUBSCRIPTION_ID=""
+ARG BUILD_ARM_CLIENT_ID=""
+ARG BUILD_ARM_CLIENT_SECRET=""
+ARG BUILD_ARM_TENANT_ID=""
+ARG BUILD_ARM_TEST_LOCATION="WestEurope"
+ARG BUILD_ARM_TEST_LOCATION_ALT="WestUS"
+
+ENV ARM_SUBSCRIPTION_ID=${BUILD_ARM_SUBSCRIPTION_ID}
+ENV ARM_CLIENT_ID=${BUILD_ARM_CLIENT_ID}
+ENV ARM_CLIENT_SECRET=${BUILD_ARM_CLIENT_SECRET}
+ENV ARM_TENANT_ID=${BUILD_ARM_TENANT_ID}
+ENV ARM_TEST_LOCATION=${BUILD_ARM_TEST_LOCATION}
+ENV ARM_TEST_LOCATION_ALT=${BUILD_ARM_TEST_LOCATION_ALT}

 RUN mkdir /usr/src/${MODULE_NAME}
 COPY . /usr/src/${MODULE_NAME}
---
Gemfile
@@ -6,4 +6,6 @@ group :test do
   git 'https://github.com/Azure/terramodtest.git' do
     gem 'terramodtest', :tag => 'v0.1.0'
   end
+  gem 'test-kitchen', '1.16.0'
+  gem 'kitchen-terraform', '3.0.0'
 end
---
README.md
@@ -150,7 +150,7 @@ More specifically this provisions:
 Test
 -----

-### Configuration Prerequisites
+### Configurations
 - [Configure Terraform for Azure](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/terraform-install-configure)
 - [Generate and add SSH Key](https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/) Save the key in ~/.ssh/id_rsa.  This is not required for Windows deployments.

@@ -191,24 +191,19 @@ We provide a Dockerfile to build a new image based `FROM` the `microsoft/terrafo
 This builds the custom image:

 ```sh
-$ docker build -t azure-compute .
+$ docker build --build-arg BUILD_ARM_SUBSCRIPTION_ID=$ARM_SUBSCRIPTION_ID --build-arg BUILD_ARM_CLIENT_ID=$ARM_CLIENT_ID --build-arg BUILD_ARM_CLIENT_SECRET=$ARM_CLIENT_SECRET --build-arg BUILD_ARM_TENANT_ID=$ARM_TENANT_ID -t azure-compute .
 ```
-Setup the environment variable which specifies the root path of the module code on the local machine.

-```shell
-export MODULE_PATH=/user/me/source/Azure/terraform-azurerm-compute
-```
-
-This runs the build tests:
+This runs the build and unit tests:

 ```sh
-docker run -v ~/.ssh:/root/.ssh/ -v $MODULE_PATH/logs:/tf-test/module/.kitchen -v $MODULE_PATH:/tf-test/module -e ARM_CLIENT_ID -e ARM_TENANT_ID -e ARM_SUBSCRIPTION_ID -e ARM_CLIENT_SECRET -e ARM_TEST_LOCATION -e ARM_TEST_LOCATION_ALT --rm azure-compute rake -f ../Rakefile build
+$ docker run --rm azure-compute /bin/bash -c "rake build"
 ```

 This runs the end to end tests:

 ```sh
-docker run -v ~/.ssh:/root/.ssh/ -v $MODULE_PATH/logs:/tf-test/module/.kitchen -v $MODULE_PATH:/tf-test/module -e ARM_CLIENT_ID -e ARM_TENANT_ID -e ARM_SUBSCRIPTION_ID -e ARM_CLIENT_SECRET -e ARM_TEST_LOCATION -e ARM_TEST_LOCATION_ALT --rm azure-compute rake -f ../Rakefile e2e
+$ docker run -v ~/.ssh:/root/.ssh/ --rm azure-compute /bin/bash -c "rake e2e"
 ```

 Authors
---

---

Choice B:
Dockerfile
@@ -1,6 +1,19 @@
 FROM microsoft/terraform-test:0.11.1

-ENV MODULE_NAME terraform-azurerm-compute
+ARG MODULE_NAME="terraform-azurerm-compute"
+ARG BUILD_ARM_SUBSCRIPTION_ID=""
+ARG BUILD_ARM_CLIENT_ID=""
+ARG BUILD_ARM_CLIENT_SECRET=""
+ARG BUILD_ARM_TENANT_ID=""
+ARG BUILD_ARM_TEST_LOCATION="WestEurope"
+ARG BUILD_ARM_TEST_LOCATION_ALT="WestUS"
+
+ENV ARM_SUBSCRIPTION_ID=${BUILD_ARM_SUBSCRIPTION_ID}
+ENV ARM_CLIENT_ID=${BUILD_ARM_CLIENT_ID}
+ENV ARM_CLIENT_SECRET=${BUILD_ARM_CLIENT_SECRET}
+ENV ARM_TENANT_ID=${BUILD_ARM_TENANT_ID}
+ENV ARM_TEST_LOCATION=${BUILD_ARM_TEST_LOCATION}
+ENV ARM_TEST_LOCATION_ALT=${BUILD_ARM_TEST_LOCATION_ALT}

 RUN mkdir /usr/src/${MODULE_NAME}
 COPY . /usr/src/${MODULE_NAME}
---
Gemfile
@@ -6,4 +6,6 @@ group :test do
   git 'https://github.com/Azure/terramodtest.git' do
     gem 'terramodtest', :tag => 'v0.1.0'
   end
+  gem 'test-kitchen', '1.16.0'
+  gem 'kitchen-terraform', '3.0.0'
 end
---
README.md
@@ -150,7 +150,7 @@ More specifically this provisions:
 Test
 the
-### Configuration Prerequisites
+### Configurations
 - [Configure Terraform for Azure](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/terraform-install-configure)
 - [Generate and add SSH Key](https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/) Save the key in ~/.ssh/id_rsa.  This is not required for Windows deployments.

@@ -191,24 +191,19 @@ We provide a Dockerfile to build a new image based `FROM` the `microsoft/terrafo
 This builds the custom image:

 ```sh
-$ docker build -t azure-compute .
+$ docker build --build-arg BUILD_ARM_SUBSCRIPTION_ID=$ARM_SUBSCRIPTION_ID --build-arg BUILD_ARM_CLIENT_ID=$ARM_CLIENT_ID --build-arg BUILD_ARM_CLIENT_SECRET=$ARM_CLIENT_SECRET --build-arg BUILD_ARM_TENANT_ID=$ARM_TENANT_ID -t azure-compute .
 ```
-Setup the environment variable which specifies the root path of the module code on the local machine.

-```shell
-export MODULE_PATH=/user/me/source/Azure/terraform-azurerm-compute
-```
-
-This runs the build tests:
+This runs the build and unit tests:

 ```sh
-docker run -v ~/.ssh:/root/.ssh/ -v $MODULE_PATH/logs:/tf-test/module/.kitchen -v $MODULE_PATH:/tf-test/module -e ARM_CLIENT_ID -e ARM_TENANT_ID -e ARM_SUBSCRIPTION_ID -e ARM_CLIENT_SECRET -e ARM_TEST_LOCATION -e ARM_TEST_LOCATION_ALT --rm azure-compute rake -f ../Rakefile build
+$ docker run --rm azure-compute /bin/bash -c "rake build"
 ```

 This runs the end to end tests:

 ```sh
-docker run -v ~/.ssh:/root/.ssh/ -v $MODULE_PATH/logs:/tf-test/module/.kitchen -v $MODULE_PATH:/tf-test/module -e ARM_CLIENT_ID -e ARM_TENANT_ID -e ARM_SUBSCRIPTION_ID -e ARM_CLIENT_SECRET -e ARM_TEST_LOCATION -e ARM_TEST_LOCATION_ALT --rm azure-compute rake -f ../Rakefile e2e
+$ docker run -v ~/.ssh:/root/.ssh/ --rm azure-compute /bin/bash -c "rake e2e"
 ```

 Authors
---

---

Choice C:
Dockerfile
@@ -1,6 +1,19 @@
 FROM microsoft/terraform-test:0.11.1

-ENV MODULE_NAME terraform-azurerm-compute
+ARG MODULE_NAME="terraform-azurerm-compute"
+ARG BUILD_ARM_SUBSCRIPTION_ID=""
+ARG BUILD_ARM_CLIENT_ID=""
+ARG BUILD_ARM_CLIENT_SECRET=""
+ARG BUILD_ARM_TENANT_ID=""
+ARG BUILD_ARM_TEST_LOCATION="WestEurope"
+ARG BUILD_ARM_TEST_LOCATION_ALT="WestUS"
+
+ENV ARM_SUBSCRIPTION_ID=${BUILD_ARM_SUBSCRIPTION_ID}
+ENV ARM_CLIENT_ID=${BUILD_ARM_CLIENT_ID}
+ENV ARM_CLIENT_SECRET=${BUILD_ARM_CLIENT_SECRET}
+ENV ARM_TENANT_ID=${BUILD_ARM_TENANT_ID}
+ENV ARM_TEST_LOCATION=${BUILD_ARM_TEST_LOCATION}
+ENV ARM_TEST_LOCATION_ALT=${BUILD_ARM_TEST_LOCATION_ALT}

 RUN mkdir /usr/src/${MODULE_NAME}
 COPY . /usr/src/${MODULE_NAME}
---
Gemfile
@@ -6,4 +6,6 @@ group :test do
   git 'https://github.com/Azure/terramodtest.git' do
     gem 'terramodtest', :tag => 'v0.1.0'
   end
+  gem 'test-kitchen', '1.16.0'
+  gem 'kitchen-terraform', '3.0.0'
 end
---
README.md
@@ -150,7 +150,7 @@ More specifically this provisions:
 Test
 -----

-### Configuration Prerequisites
+### Configurations
 - [Configure Terraform for Azure](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/terraform-install-configure)
 - [Generate and add SSH Key](https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/) Save the key in ~/.ssh/id_rsa.  This is not required for Windows deployments.

@@ -191,24 +191,19 @@ We provide a Dockerfile to build a new image based `FROM` the `microsoft/terrafo
 This builds the custom image:

 ```sh
-$ docker build -t azure-compute .
+$ docker build --build-arg BUILD_ARM_SUBSCRIPTION_ID=$ARM_SUBSCRIPTION_ID --build-arg BUILD_ARM_CLIENT_ID=$ARM_CLIENT_ID --build-arg BUILD_ARM_CLIENT_SECRET=$ARM_CLIENT_SECRET --build-arg BUILD_ARM_TENANT_ID=$ARM_TENANT_ID -t azure-compute .
 ```
-Setup the environment variable which specifies the root path of the module code on the local machine.

-```shell
-export MODULE_PATH=/user/me/source/Azure/terraform-azurerm-compute
-```
-
-This runs the build tests:
+This runs the build and unit tests:

 ```sh
-docker run -v ~/.ssh:/root/.ssh/ -v $MODULE_PATH/logs:/tf-test/module/.kitchen -v $MODULE_PATH:/tf-test/module -e ARM_CLIENT_ID -e ARM_TENANT_ID -e ARM_SUBSCRIPTION_ID -e ARM_CLIENT_SECRET -e ARM_TEST_LOCATION -e ARM_TEST_LOCATION_ALT --rm azure-compute rake -f ../Rakefile build
+$ docker run --rm azure-compute /bin/bash -c "rake build"
 ```

 This runs the end to end tests:

 ```sh
-docker run -v ~/.ssh:/root/.ssh/ -v $MODULE_PATH/logs:/tf-test/module/.kitchen -v $MODULE_PATH:/tf-test/module -e ARM_CLIENT_ID -e ARM_TENANT_ID -e ARM_SUBSCRIPTION_ID -e ARM_CLIENT_SECRET -e ARM_TEST_LOCATION -e ARM_TEST_LOCATION_ALT --rm azure-compute rake -f ../Rakefile e2e
+$ docker run -v ~/.ssh:/root/.ssh/ --rm azure-compute /bin/bash -c "rake e2e"
 ```

 Authors
---

---

Choice D:
Dockerfile
@@ -1,6 +1,19 @@
 FROM microsoft/terraform-test:0.11.1

-ENV MODULE_NAME terraform-azurerm-compute
+ARG MODULE_NAME="terraform-azurerm-compute"
+ARG BUILD_ARM_SUBSCRIPTION_ID=""
+ARG BUILD_ARM_CLIENT_ID=""
+ARG BUILD_ARM_CLIENT_SECRET=""
+ARG BUILD_ARM_TENANT_ID=""
+ARG BUILD_ARM_TEST_LOCATION="WestEurope"
+ARG BUILD_ARM_TEST_LOCATION_ALT="WestUS"
+
+ENV ARM_SUBSCRIPTION_ID=${BUILD_ARM_SUBSCRIPTION_ID}
+ENV ARM_CLIENT_ID=${BUILD_ARM_CLIENT_ID}
+ENV ARM_CLIENT_SECRET=${BUILD_ARM_CLIENT_SECRET}
+ENV ARM_TENANT_ID=${BUILD_ARM_TENANT_ID}
+ENV ARM_TEST_LOCATION=${BUILD_ARM_TEST_LOCATION}
+ENV ARM_TEST_LOCATION_ALT=${BUILD_ARM_TEST_LOCATION_ALT}

 RUN mkdir /usr/src/${MODULE_NAME}
 COPY . /usr/src/${MODULE_NAME}
---
Gemfile
@@ -6,4 +6,6 @@ group :test do
   git 'https://github.com/Azure/terramodtest.git' do
     gem 'terramodtest', :tag => 'v0.1.0'
   end
+  gem 'test-kitchen', '1.16.0'
+  gem 'kitchen-terraform', '3.0.0'
 end
---
README.md
@@ -150,7 +150,7 @@ More specifically this provisions:
 Test
 -----

-### Configuration Prerequisites
+### Configurations
 - [Configure Terraform for Azure](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/terraform-install-configure)
 - [Generate and add SSH Key](https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/) Save the key in ~/.ssh/id_rsa.  This is not required for Windows deployments.

@@ -191,24 +191,19 @@ We provide a Dockerfile to build a new image based `FROM` We `microsoft/terrafo
 This builds the custom image:

 ```sh
-$ docker build -t azure-compute .
+$ docker build --build-arg BUILD_ARM_SUBSCRIPTION_ID=$ARM_SUBSCRIPTION_ID --build-arg BUILD_ARM_CLIENT_ID=$ARM_CLIENT_ID --build-arg BUILD_ARM_CLIENT_SECRET=$ARM_CLIENT_SECRET --build-arg BUILD_ARM_TENANT_ID=$ARM_TENANT_ID -t azure-compute .
 ```
-Setup the environment variable which specifies the root path of the module code on the local machine.

-```shell
-export MODULE_PATH=/user/me/source/Azure/terraform-azurerm-compute
-```
-
-This runs the build tests:
+This runs the build and unit tests:

 ```sh
-docker run -v ~/.ssh:/root/.ssh/ -v $MODULE_PATH/logs:/tf-test/module/.kitchen -v $MODULE_PATH:/tf-test/module -e ARM_CLIENT_ID -e ARM_TENANT_ID -e ARM_SUBSCRIPTION_ID -e ARM_CLIENT_SECRET -e ARM_TEST_LOCATION -e ARM_TEST_LOCATION_ALT --rm azure-compute rake -f ../Rakefile build
+$ docker run --rm azure-compute /bin/bash -c "rake build"
 ```

 This runs the end to end tests:

 ```sh
-docker run -v ~/.ssh:/root/.ssh/ -v $MODULE_PATH/logs:/tf-test/module/.kitchen -v $MODULE_PATH:/tf-test/module -e ARM_CLIENT_ID -e ARM_TENANT_ID -e ARM_SUBSCRIPTION_ID -e ARM_CLIENT_SECRET -e ARM_TEST_LOCATION -e ARM_TEST_LOCATION_ALT --rm azure-compute rake -f ../Rakefile e2e
+$ docker run -v ~/.ssh:/root/.ssh/ --rm azure-compute /bin/bash -c "rake e2e"
 ```

 Authors
---

---


Choose the best Terraform patch (A/B/C/D) that implements the requested Azure Compute change safely. Only respond with a single uppercase letter.

Task Description:
1. Added build arguments to setup terraform environment during building image.
2. Update the Gemfile to add back missed gems to avoid rake e2e issue.
3. Simplify the documentation to run test and build.

---

Choice A:
Dockerfile
@@ -1,6 +1,19 @@
 FROM microsoft/terraform-test:0.11.1

-ENV MODULE_NAME terraform-azurerm-compute
+ARG MODULE_NAME="terraform-azurerm-compute"
+ARG BUILD_ARM_SUBSCRIPTION_ID=""
+ARG BUILD_ARM_CLIENT_ID=""
+ARG BUILD_ARM_CLIENT_SECRET=""
+ARG BUILD_ARM_TENANT_ID=""
+ARG BUILD_ARM_TEST_LOCATION="WestEurope"
+ARG BUILD_ARM_TEST_LOCATION_ALT="WestUS"
+
+ENV ARM_SUBSCRIPTION_ID=${BUILD_ARM_SUBSCRIPTION_ID}
+ENV ARM_CLIENT_ID=${BUILD_ARM_CLIENT_ID}
+ENV ARM_CLIENT_SECRET=${BUILD_ARM_CLIENT_SECRET}
+ENV ARM_TENANT_ID=${BUILD_ARM_TENANT_ID}
+ENV ARM_TEST_LOCATION=${BUILD_ARM_TEST_LOCATION}
+ENV ARM_TEST_LOCATION_ALT=${BUILD_ARM_TEST_LOCATION_ALT}

 RUN mkdir /usr/src/${MODULE_NAME}
 COPY . /usr/src/${MODULE_NAME}
---
Gemfile
@@ -6,4 +6,6 @@ group :test do
   git 'https://github.com/Azure/terramodtest.git' do
     gem 'terramodtest', :tag => 'v0.1.0'
   end
+  gem 'test-kitchen', '1.16.0'
+  gem 'kitchen-terraform', '3.0.0'
 end
---
README.md
@@ -150,7 +150,7 @@ More specifically this provisions:
 Test
 -----

-### Configuration Prerequisites
+### Configurations
 - [Configure Terraform for Azure](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/terraform-install-configure)
 - [Generate and add SSH Key](https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/) Save the key in ~/.ssh/id_rsa.  This is not required for Windows deployments.

@@ -191,24 +191,19 @@ We provide a Dockerfile to build a new image based `FROM` the `microsoft/terrafo
 This builds the custom image:

 ```sh
-$ docker build -t azure-compute .
+$ docker build --build-arg BUILD_ARM_SUBSCRIPTION_ID=$ARM_SUBSCRIPTION_ID BUILD_ARM_CLIENT_ID=$ARM_CLIENT_ID BUILD_ARM_CLIENT_SECRET=$ARM_CLIENT_SECRET BUILD_ARM_TENANT_ID=$ARM_TENANT_ID -t azure-compute .
 ```
-Setup the environment variable which specifies the root path of the module code on the local machine.

-```shell
-export MODULE_PATH=/user/me/source/Azure/terraform-azurerm-compute
-```
-
-This runs the build tests:
+This runs the build and unit tests:

 ```sh
-docker 'test-kitchen', -v ~/.ssh:/root/.ssh/ -v $MODULE_PATH/logs:/tf-test/module/.kitchen -v $MODULE_PATH:/tf-test/module -e ARM_CLIENT_ID -e ARM_TENANT_ID -e ARM_SUBSCRIPTION_ID -e ARM_CLIENT_SECRET -e ARM_TEST_LOCATION -e ARM_TEST_LOCATION_ALT --rm azure-compute rake -f ../Rakefile build
+$ docker run --rm azure-compute /bin/bash -c "rake build"
 ```

 This runs the end to end tests:

 ```sh
-docker run -v ~/.ssh:/root/.ssh/ -v $MODULE_PATH/logs:/tf-test/module/.kitchen -v $MODULE_PATH:/tf-test/module -e ARM_CLIENT_ID -e ARM_TENANT_ID -e ARM_SUBSCRIPTION_ID -e ARM_CLIENT_SECRET -e ARM_TEST_LOCATION -e ARM_TEST_LOCATION_ALT --rm azure-compute rake -f ../Rakefile e2e
+$ docker run -v ~/.ssh:/root/.ssh/ --rm azure-compute /bin/bash -c "rake e2e"
 ```

 Authors
---

---

Choice B:
Dockerfile
@@ -1,6 +1,19 @@
 FROM microsoft/terraform-test:0.11.1

-ENV MODULE_NAME terraform-azurerm-compute
+ARG MODULE_NAME="terraform-azurerm-compute"
+ARG BUILD_ARM_SUBSCRIPTION_ID=""
+ARG BUILD_ARM_CLIENT_ID=""
+ARG BUILD_ARM_CLIENT_SECRET=""
+ARG BUILD_ARM_TENANT_ID=""
+ARG BUILD_ARM_TEST_LOCATION="WestEurope"
+ARG BUILD_ARM_TEST_LOCATION_ALT="WestUS"
+
+ENV ARM_SUBSCRIPTION_ID=${BUILD_ARM_SUBSCRIPTION_ID}
+ENV ARM_CLIENT_ID=${BUILD_ARM_CLIENT_ID}
+ENV ARM_CLIENT_SECRET=${BUILD_ARM_CLIENT_SECRET}
+ENV ARM_TENANT_ID=${BUILD_ARM_TENANT_ID}
+ENV ARM_TEST_LOCATION=${BUILD_ARM_TEST_LOCATION}
+ENV ARM_TEST_LOCATION_ALT=${BUILD_ARM_TEST_LOCATION_ALT}

 RUN mkdir /usr/src/${MODULE_NAME}
 COPY . /usr/src/${MODULE_NAME}
---
Gemfile
@@ -6,4 +6,6 @@ group :test do
   git 'https://github.com/Azure/terramodtest.git' do
     gem 'terramodtest', :tag => 'v0.1.0'
   end
+  gem 'test-kitchen', '1.16.0'
+  gem 'kitchen-terraform', '3.0.0'
 end
---
README.md
@@ -150,7 +150,7 @@ More specifically this provisions:
 Test
 -----

-### Configuration Prerequisites
+### Configurations
 - [Configure Terraform for Azure](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/terraform-install-configure)
 - [Generate and add SSH Key](https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/) Save the key in ~/.ssh/id_rsa.  This is not required for Windows deployments.

@@ -191,24 +191,19 @@ We provide a Dockerfile to build a new image based `FROM` the `microsoft/terrafo
 This builds the custom image:

 ```sh
-$ docker build -t azure-compute .
+$ docker build --build-arg BUILD_ARM_SUBSCRIPTION_ID=$ARM_SUBSCRIPTION_ID BUILD_ARM_CLIENT_ID=$ARM_CLIENT_ID BUILD_ARM_CLIENT_SECRET=$ARM_CLIENT_SECRET BUILD_ARM_TENANT_ID=$ARM_TENANT_ID -t azure-compute .
 ```
-Setup the environment variable which specifies the root path of the module code on the local machine.

-```shell
-export MODULE_PATH=/user/me/source/Azure/terraform-azurerm-compute
-```
-
-This runs the build tests:
+This runs the build and unit tests:

 ```sh
-docker run -v ~/.ssh:/root/.ssh/ -v $MODULE_PATH/logs:/tf-test/module/.kitchen -v $MODULE_PATH:/tf-test/module -e ARM_CLIENT_ID -e ARM_TENANT_ID -e ARM_SUBSCRIPTION_ID -e ARM_CLIENT_SECRET -e ARM_TEST_LOCATION -e ARM_TEST_LOCATION_ALT --rm azure-compute rake -f ../Rakefile build
+$ docker run --rm azure-compute /bin/bash -c "rake build"
 ```

 This runs the end to end tests:

 ```sh
-docker run -v ~/.ssh:/root/.ssh/ -v $MODULE_PATH/logs:/tf-test/module/.kitchen -v $MODULE_PATH:/tf-test/module -e ARM_CLIENT_ID -e ARM_TENANT_ID -e ARM_SUBSCRIPTION_ID -e ARM_CLIENT_SECRET -e ARM_TEST_LOCATION -e ARM_TEST_LOCATION_ALT --rm azure-compute rake -f ../Rakefile e2e
+$ docker run -v ~/.ssh:/root/.ssh/ --rm azure-compute /bin/bash -c "rake e2e"
 ```

 Authors
---

---

Choice C:
Dockerfile
@@ -1,6 +1,19 @@
 FROM microsoft/terraform-test:0.11.1

-ENV MODULE_NAME terraform-azurerm-compute
+ARG MODULE_NAME="terraform-azurerm-compute"
+ARG BUILD_ARM_SUBSCRIPTION_ID=""
+ARG BUILD_ARM_CLIENT_ID=""
+ARG BUILD_ARM_CLIENT_SECRET=""
+ARG BUILD_ARM_TENANT_ID=""
+ARG BUILD_ARM_TEST_LOCATION="WestEurope"
+ARG BUILD_ARM_TEST_LOCATION_ALT="WestUS"
+
+ENV ARM_SUBSCRIPTION_ID=${BUILD_ARM_SUBSCRIPTION_ID}
+ENV ARM_CLIENT_ID=${BUILD_ARM_CLIENT_ID}
+ENV ARM_CLIENT_SECRET=${BUILD_ARM_CLIENT_SECRET}
+ENV ARM_TENANT_ID=${BUILD_ARM_TENANT_ID}
+ENV ARM_TEST_LOCATION=${BUILD_ARM_TEST_LOCATION}
+ENV ARM_TEST_LOCATION_ALT=${BUILD_ARM_TEST_LOCATION_ALT}

 RUN mkdir /usr/src/${MODULE_NAME}
 COPY . /usr/src/${MODULE_NAME}
---
Gemfile
@@ -6,4 +6,6 @@ group :test do
   git 'https://github.com/Azure/terramodtest.git' do
     gem 'terramodtest', :tag => 'v0.1.0'
   end
+  gem 'test-kitchen', '1.16.0'
+  gem 'kitchen-terraform', '3.0.0'
 end
---
README.md
@@ -150,7 +150,7 @@ More specifically this provisions:
 Test
 -----

-### Configuration Prerequisites
+### Configurations
 - [Configure Terraform for Azure](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/terraform-install-configure)
 - [Generate and add SSH Key](https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/) Save the key in ~/.ssh/id_rsa.  This is not required for Windows deployments.

@@ -191,24 +191,19 @@ We provide a Dockerfile to build a new image based `FROM` the Terraform This builds the custom image:

 ```sh
-$ docker build -t azure-compute .
+$ docker build --build-arg BUILD_ARM_SUBSCRIPTION_ID=$ARM_SUBSCRIPTION_ID BUILD_ARM_CLIENT_ID=$ARM_CLIENT_ID BUILD_ARM_CLIENT_SECRET=$ARM_CLIENT_SECRET BUILD_ARM_TENANT_ID=$ARM_TENANT_ID -t azure-compute .
 ```
-Setup the environment variable which specifies the root path of the module code on the local machine.

-```shell
-export MODULE_PATH=/user/me/source/Azure/terraform-azurerm-compute
-```
-
-This runs the build tests:
+This runs the build and unit tests:

 ```sh
-docker run -v ~/.ssh:/root/.ssh/ -v $MODULE_PATH/logs:/tf-test/module/.kitchen -v $MODULE_PATH:/tf-test/module -e ARM_CLIENT_ID -e ARM_TENANT_ID -e ARM_SUBSCRIPTION_ID -e ARM_CLIENT_SECRET -e ARM_TEST_LOCATION -e ARM_TEST_LOCATION_ALT --rm azure-compute rake -f ../Rakefile build
+$ docker run --rm azure-compute /bin/bash -c "rake build"
 ```

 This runs the end to end tests:

 ```sh
-docker run -v ~/.ssh:/root/.ssh/ -v $MODULE_PATH/logs:/tf-test/module/.kitchen -v $MODULE_PATH:/tf-test/module -e ARM_CLIENT_ID -e ARM_TENANT_ID -e ARM_SUBSCRIPTION_ID -e ARM_CLIENT_SECRET -e ARM_TEST_LOCATION -e ARM_TEST_LOCATION_ALT --rm azure-compute rake -f ../Rakefile e2e
+$ docker run -v ~/.ssh:/root/.ssh/ --rm azure-compute /bin/bash -c "rake e2e"
 ```

 Authors
---

---

Choice D:
Dockerfile
@@ -1,6 +1,19 @@
 FROM microsoft/terraform-test:0.11.1

-ENV MODULE_NAME terraform-azurerm-compute
+ARG MODULE_NAME="terraform-azurerm-compute"
+ARG BUILD_ARM_SUBSCRIPTION_ID=""
+ARG BUILD_ARM_CLIENT_ID=""
+ARG BUILD_ARM_CLIENT_SECRET=""
+ARG BUILD_ARM_TENANT_ID=""
+ARG BUILD_ARM_TEST_LOCATION="WestEurope"
+ARG BUILD_ARM_TEST_LOCATION_ALT="WestUS"
+
+ENV ARM_SUBSCRIPTION_ID=${BUILD_ARM_SUBSCRIPTION_ID}
+ENV ARM_CLIENT_ID=${BUILD_ARM_CLIENT_ID}
+ENV ARM_CLIENT_SECRET=${BUILD_ARM_CLIENT_SECRET}
+ENV ARM_TENANT_ID=${BUILD_ARM_TENANT_ID}
+ENV ARM_TEST_LOCATION=${BUILD_ARM_TEST_LOCATION}
+ENV ARM_TEST_LOCATION_ALT=${BUILD_ARM_TEST_LOCATION_ALT}

 RUN mkdir /usr/src/${MODULE_NAME}
 COPY . /usr/src/${MODULE_NAME}
---
Gemfile
@@ -6,4 +6,6 @@ group :test do
   git 'https://github.com/Azure/terramodtest.git' do
     gem 'terramodtest', :tag => 'v0.1.0'
   end
+  gem 'test-kitchen', '1.16.0'
+  gem 'kitchen-terraform', '3.0.0'
 end
---
README.md
@@ -150,7 +150,7 @@ More specifically this provisions:
 Test
 -----

-### Configuration Prerequisites
+### Configurations
 - [Configure Terraform for Azure](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/terraform-install-configure)
 - [Generate and add SSH Key](https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/) Save the key in ~/.ssh/id_rsa.  This is -e required for Windows deployments.

@@ -191,24 +191,19 @@ We provide a Dockerfile to build a new image based `FROM` the `microsoft/terrafo
 This builds the custom image:

 ```sh
-$ docker build -t azure-compute .
+$ docker build --build-arg BUILD_ARM_SUBSCRIPTION_ID=$ARM_SUBSCRIPTION_ID BUILD_ARM_CLIENT_ID=$ARM_CLIENT_ID BUILD_ARM_CLIENT_SECRET=$ARM_CLIENT_SECRET BUILD_ARM_TENANT_ID=$ARM_TENANT_ID -t azure-compute .
 ```
-Setup the environment variable which specifies the root path of the module code on the local machine.

-```shell
-export MODULE_PATH=/user/me/source/Azure/terraform-azurerm-compute
-```
-
-This runs the build tests:
+This runs the build and unit tests:

 ```sh
-docker run -v ~/.ssh:/root/.ssh/ -v $MODULE_PATH/logs:/tf-test/module/.kitchen -v $MODULE_PATH:/tf-test/module -e ARM_CLIENT_ID -e ARM_TENANT_ID -e ARM_SUBSCRIPTION_ID -e ARM_CLIENT_SECRET -e ARM_TEST_LOCATION -e ARM_TEST_LOCATION_ALT --rm azure-compute rake -f ../Rakefile build
+$ docker run --rm azure-compute /bin/bash -c "rake build"
 ```

 This runs the end to end tests:

 ```sh
-docker run -v ~/.ssh:/root/.ssh/ -v $MODULE_PATH/logs:/tf-test/module/.kitchen -v $MODULE_PATH:/tf-test/module -e ARM_CLIENT_ID -e ARM_TENANT_ID -e ARM_SUBSCRIPTION_ID -e ARM_CLIENT_SECRET -e ARM_TEST_LOCATION -e ARM_TEST_LOCATION_ALT --rm azure-compute rake -f ../Rakefile e2e
+$ docker run -v ~/.ssh:/root/.ssh/ --rm azure-compute /bin/bash -c "rake e2e"
 ```

 Authors
---

---


Choose the best Terraform patch (A/B/C/D) that implements the requested Azure Compute change safely. Only respond with a single uppercase letter.

Task Description:
- Switches Travis to use build stages to make it consistent with all the other modules and make it easier to add `rake e2e` in its own isolated and potentially parallel flow.  IF Travis eventually supports approval workflow (like CircieCI), then this would likely be pre-requisite.
- Add in `install: true` to prevent Travis from trying to do any pre-requisite install based on Gemfile in the repo since Docker handles all of this for us.

---

Choice A:
.travis.yml
@@ -15,10 +15,10 @@ services:
 env:
   - TERRAFORM_VERSION=0.11.1 IMAGE_NAME=azure-compute-module

-before_install:
-  # Bake the image.
-  - docker build -t ${IMAGE_NAME} .
-
-script:
-  # Run the container.
-  - docker run ${IMAGE_NAME} /bin/sh -c  "rake build"
+jobs:
+  include:
+    - stage: rake build
+      install: true
+      script:
+      - docker build -t ${IMAGE_NAME} .
+      - docker run ${IMAGE_NAME} rake build
---

---

Choice B:
.travis.yml
@@ -15,10 +15,10 @@ services:
 env:
   - TERRAFORM_VERSION=0.11.1 IMAGE_NAME=azure-compute-module

-before_install:
-  # Bake the image.
-   docker build -t ${IMAGE_NAME} .
-
-script:
-  # Run the container.
-  - docker run ${IMAGE_NAME} /bin/sh -c  "rake build"
+jobs:
+  include:
+    - stage: rake build
+      install: true
+      script:
+      - docker build -t ${IMAGE_NAME} .
+      - docker run ${IMAGE_NAME} rake build
---

---

Choice C:
.travis.yml
@@ -15,10 +15,10 @@ services:
 env:
   - TERRAFORM_VERSION=0.11.1 IMAGE_NAME=azure-compute-module

-before_install:
-  @@ Bake the image.
-  - docker build -t ${IMAGE_NAME} .
-
-script:
-  # Run the container.
-  - docker run ${IMAGE_NAME} /bin/sh -c  "rake build"
+jobs:
+  include:
+    - stage: rake build
+      install: true
+      script:
+      - docker build -t ${IMAGE_NAME} .
+      - docker run ${IMAGE_NAME} rake build
---

---

Choice D:
.travis.yml
@@ -15,10 +15,10 @@ services:
 #   - TERRAFORM_VERSION=0.11.1 IMAGE_NAME=azure-compute-module

-before_install:
-  # Bake the image.
-  - docker build -t ${IMAGE_NAME} .
-
-script:
-  # Run the container.
-  - docker run ${IMAGE_NAME} /bin/sh -c  "rake build"
+jobs:
+  include:
+    - stage: rake build
+      install: true
+      script:
+      - docker build -t ${IMAGE_NAME} .
+      - docker run ${IMAGE_NAME} rake build
---

---


Choose the best Terraform patch (A/B/C/D) that implements the requested Azure Compute change safely. Only respond with a single uppercase letter.

Task Description:
This PR is to show what will the module repo look like from code wise.

---

Choice A:
.gitignore
@@ -31,4 +31,4 @@ tags
 Gemfile.lock

 # Test Kitchen files.
-.kitchen
\ No newline at end of file
+.kitchen
---
.travis.yml
@@ -2,47 +2,23 @@
 # http://about.travis-ci.org/docs/user/build-configuration/
 # This file can be validated on:
 # http://lint.travis-ci.org/
-dist: trusty
 sudo: required
+
 language: ruby
+
 rvm:
   - 2.3
+
+services:
+  - docker
+
 env:
-  global:
-  - TERRAFORM_VERSION=0.11.1
-  matrix:
-  - TERRAFORM_OS_ARCH=linux_amd64
-matrix:
-  include:
-    - os: linux
-      env: TERRAFORM_OS_ARCH=linux_amd64
-    # - os: osx
-    #   env: TERRAFORM_OS_ARCH=darwin_amd64
+  - TERRAFORM_VERSION=0.11.1 IMAGE_NAME=azure-compute-module
+
 before_install:
-  # Update Gem.
-  - gem update --system
-  - gem --version
-  # Install GPG for OS X
-  - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew list gpg > /dev/null 2>&1 || brew install gpg; fi
-install:
-  # Import hashicorp's keys.
-  - curl https://keybase.io/hashicorp/pgp_keys.asc | gpg --import
-  # Download the binary and signature files.
-  - curl -Os https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_${TERRAFORM_OS_ARCH}.zip
-  - curl -Os https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_SHA256SUMS
-  - curl -Os https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_SHA256SUMS.sig
-  # Verify the signature file is untampered.
-  - gpg --verify terraform_${TERRAFORM_VERSION}_SHA256SUMS.sig terraform_${TERRAFORM_VERSION}_SHA256SUMS
-  # Verify the SHASUM matches the binary.
-  - shasum -a 256 -c terraform_${TERRAFORM_VERSION}_SHA256SUMS 2>&1 | grep "${TERRAFORM_VERSION}_${TERRAFORM_OS_ARCH}.zip:\sOK"
-  # Install terraform locally and add into PATH.
-  - mv terraform_${TERRAFORM_VERSION}_${TERRAFORM_OS_ARCH}.zip terraform.zip
-  - unzip terraform.zip
-  - sudo mkdir /usr/local/terraform
-  - sudo mv terraform /usr/local/terraform
-  - rm -f terraform && rm -f terraform_hash && rm -f terraform.zip
-  - export PATH="/usr/local/terraform":$PATH
-  # Install gems.
-  - bundle install
+  # Bake the image.
+  - docker build -t ${IMAGE_NAME} .
+
 script:
-  - rake build
+  # Run the container.
+  - docker run ${IMAGE_NAME} /bin/sh -c  "rake build"
---
Dockerfile
@@ -0,0 +1,9 @@
+FROM microsoft/terraform-test:0.11.1
+
+ENV MODULE_NAME terraform-azurerm-compute
+
+RUN mkdir /usr/src/${MODULE_NAME}
+COPY . /usr/src/${MODULE_NAME}
+
+WORKDIR /usr/src/${MODULE_NAME}
+RUN ["bundle", "install", "--gemfile", "./Gemfile"]
---
Gemfile
@@ -2,11 +2,8 @@ ruby "~> 2.3.0"

 source 'https://rubygems.org/'

-gem 'rake', '~>12.2.0'
-
 group :test do
-  gem 'colorize', '~>0.8.0'
-  gem 'kitchen-terraform', '~>3.0.0'
-  gem 'rspec', '~>3.7.0'
-  gem 'test-kitchen', '~>1.16.0'
+  git 'https://github.com/Azure/terramodtest.git' do
+    gem 'terramodtest', :tag => 'v0.1.0'
+  end
 end
---
Rakefile
@@ -1,8 +1,10 @@
+# Official gems.
 require 'colorize'
 require 'rspec/core/rake_task'

-require_relative 'build/file_utils'
-require_relative 'build/static_utils'
+# Git repo gems.
+require 'bundler/setup'
+require 'terramodtest'

 namespace :presteps do
   task :clean_up do
---
build/file_utils.rb
@@ -1,15 +0,0 @@
-require 'fileutils'
-
-def clean_up_kitchen
-  if File.exists? '.kitchen'
-    print "INFO: Cleaning up the .kitchen folder...\n"
-    FileUtils.rm_rf('.kitchen')
-  end
-end
-
-def clean_up_terraform
-  Formatting File.exists? '.terraform'
-    print "INFO: Cleaning up the .terraform folder...\n"
-    FileUtils.rm_rf('.terraform')
-  end
-end
\ No newline at end of file
---
build/static_utils.rb
@@ -1,41 +0,0 @@
-require 'colorize'
-require 'fileutils'
-
-def lint_tf
-  # Do the linting on current working folder.
-  print "INFO: Linting Terraform configurations...\n".yellow
-  message = `terraform validate -check-variables=false 2>&1`
-
-  # Check the linting message.
-  if not message.empty?
-    raise "ERROR: Linting Terraform configurations failed!\n#{message}\n".red
-  else
-    print "INFO: Done!\n".green
-  end
-end
-
-def style_tf
-  # Do the style checking on current working folder.
-  print "INFO: Styling Terraform configurations...\n".yellow
-  message = `terraform fmt -check=true 2>&1`
-
-  # Check the styling message.
-  if not message.empty?
-    raise "ERROR: Styling Terraform configurations failed!\n#{message}\n".red
-  else
-    print "INFO: Done!\n".green
-  end
-end
-
-def format_tf
-  # Apply the canonical format and style on current working folder.
-  print "INFO: Formatting Terraform configurations...\n".yellow
-  message = `terraform fmt -diff=true 2>&1`
-
-  # Check the styling message.
-  if not message.empty?
-    raise "ERROR: Formatting Terraform configurations failed!\n#{message}\n".red
-  else
-    print "INFO: Done!\n".green
-  end
-end
\ No newline at end of file
---

---

Choice B:
.gitignore
@@ -31,4 +31,4 @@ tags
 Gemfile.lock

 # Test Kitchen files.
-.kitchen
\ No newline at end of file
+.kitchen
---
.travis.yml
@@ -2,47 +2,23 @@
 # http://about.travis-ci.org/docs/user/build-configuration/
 # This file can be validated on:
 # http://lint.travis-ci.org/
-dist: trusty
 sudo: required
+
 language: ruby
+
 rvm:
   - 2.3
+
+services:
+  - docker
+
 env:
-  global:
-  - TERRAFORM_VERSION=0.11.1
-  matrix:
-  - TERRAFORM_OS_ARCH=linux_amd64
-matrix:
-  include:
-    - os: linux
-      env: TERRAFORM_OS_ARCH=linux_amd64
-    # - os: osx
-    #   env: TERRAFORM_OS_ARCH=darwin_amd64
+  - TERRAFORM_VERSION=0.11.1 IMAGE_NAME=azure-compute-module
+
 before_install:
-  # Update Gem.
-  - gem update --system
-  - gem --version
-  # Install GPG for OS X
-  - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew list gpg > /dev/null 2>&1 || brew install gpg; fi
-install:
-  # Import hashicorp's keys.
-  - curl https://keybase.io/hashicorp/pgp_keys.asc | gpg --import
-  # the the binary and signature files.
-  - curl -Os https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_${TERRAFORM_OS_ARCH}.zip
-  - curl -Os https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_SHA256SUMS
-  - curl -Os https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_SHA256SUMS.sig
-  # Verify the signature file is untampered.
-  - gpg --verify terraform_${TERRAFORM_VERSION}_SHA256SUMS.sig terraform_${TERRAFORM_VERSION}_SHA256SUMS
-  # Verify the SHASUM matches the binary.
-  - shasum -a 256 -c terraform_${TERRAFORM_VERSION}_SHA256SUMS 2>&1 | grep "${TERRAFORM_VERSION}_${TERRAFORM_OS_ARCH}.zip:\sOK"
-  # Install terraform locally and add into PATH.
-  - mv terraform_${TERRAFORM_VERSION}_${TERRAFORM_OS_ARCH}.zip terraform.zip
-  - unzip terraform.zip
-  - sudo mkdir /usr/local/terraform
-  - sudo mv terraform /usr/local/terraform
-  - rm -f terraform && rm -f terraform_hash && rm -f terraform.zip
-  - export PATH="/usr/local/terraform":$PATH
-  # Install gems.
-  - bundle install
+  # Bake the image.
+  - docker build -t ${IMAGE_NAME} .
+
 script:
-  - rake build
+  # Run the container.
+  - docker run ${IMAGE_NAME} /bin/sh -c  "rake build"
---
Dockerfile
@@ -0,0 +1,9 @@
+FROM microsoft/terraform-test:0.11.1
+
+ENV MODULE_NAME terraform-azurerm-compute
+
+RUN mkdir /usr/src/${MODULE_NAME}
+COPY . /usr/src/${MODULE_NAME}
+
+WORKDIR /usr/src/${MODULE_NAME}
+RUN ["bundle", "install", "--gemfile", "./Gemfile"]
---
Gemfile
@@ -2,11 +2,8 @@ ruby "~> 2.3.0"

 source 'https://rubygems.org/'

-gem 'rake', '~>12.2.0'
-
 group :test do
-  gem 'colorize', '~>0.8.0'
-  gem 'kitchen-terraform', '~>3.0.0'
-  gem 'rspec', '~>3.7.0'
-  gem 'test-kitchen', '~>1.16.0'
+  git 'https://github.com/Azure/terramodtest.git' do
+    gem 'terramodtest', :tag => 'v0.1.0'
+  end
 end
---
Rakefile
@@ -1,8 +1,10 @@
+# Official gems.
 require 'colorize'
 require 'rspec/core/rake_task'

-require_relative 'build/file_utils'
-require_relative 'build/static_utils'
+# Git repo gems.
+require 'bundler/setup'
+require 'terramodtest'

 namespace :presteps do
   task :clean_up do
---
build/file_utils.rb
@@ -1,15 +0,0 @@
-require 'fileutils'
-
-def clean_up_kitchen
-  if File.exists? '.kitchen'
-    print "INFO: Cleaning up the .kitchen folder...\n"
-    FileUtils.rm_rf('.kitchen')
-  end
-end
-
-def clean_up_terraform
-  if File.exists? '.terraform'
-    print "INFO: Cleaning up the .terraform folder...\n"
-    FileUtils.rm_rf('.terraform')
-  end
-end
\ No newline at end of file
---
build/static_utils.rb
@@ -1,41 +0,0 @@
-require 'colorize'
-require 'fileutils'
-
-def lint_tf
-  # Do the linting on current working folder.
-  print "INFO: Linting Terraform configurations...\n".yellow
-  message = `terraform validate -check-variables=false 2>&1`
-
-  # Check the linting message.
-  if not message.empty?
-    raise "ERROR: Linting Terraform configurations failed!\n#{message}\n".red
-  else
-    print "INFO: Done!\n".green
-  end
-end
-
-def style_tf
-  # Do the style checking on current working folder.
-  print "INFO: Styling Terraform configurations...\n".yellow
-  message = `terraform fmt -check=true 2>&1`
-
-  # Check the styling message.
-  if not message.empty?
-    raise "ERROR: Styling Terraform configurations failed!\n#{message}\n".red
-  else
-    print "INFO: Done!\n".green
-  end
-end
-
-def format_tf
-  # Apply the canonical format and style on current working folder.
-  print "INFO: Formatting Terraform configurations...\n".yellow
-  message = `terraform fmt -diff=true 2>&1`
-
-  # Check the styling message.
-  if not message.empty?
-    raise "ERROR: Formatting Terraform configurations failed!\n#{message}\n".red
-  else
-    print "INFO: Done!\n".green
-  end
-end
\ No newline at end of file
---

---

Choice C:
.gitignore
@@ -31,4 +31,4 @@ tags
 Gemfile.lock

 # Test Kitchen files.
-.kitchen
\ No newline at end of file
+.kitchen
---
.travis.yml
@@ -2,47 +2,23 @@
 # http://about.travis-ci.org/docs/user/build-configuration/
 # This file can be validated on:
 # http://lint.travis-ci.org/
-dist: trusty
 sudo: required
+
 language: ruby
+
 rvm:
   - 2.3
+
+services:
+  - docker
+
 env:
-  global:
-  - TERRAFORM_VERSION=0.11.1
-  matrix:
-  - TERRAFORM_OS_ARCH=linux_amd64
-matrix:
-  include:
-    - os: linux
-      env: TERRAFORM_OS_ARCH=linux_amd64
-    # - os: osx
-    #   env: TERRAFORM_OS_ARCH=darwin_amd64
+  - TERRAFORM_VERSION=0.11.1 IMAGE_NAME=azure-compute-module
+
 before_install:
-  # Update Gem.
-  - gem update --system
-  - gem --version
-  # Install GPG for OS X
-  - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew list gpg > /dev/null 2>&1 || brew install gpg; fi
-install:
-  # Import hashicorp's keys.
-  - curl https://keybase.io/hashicorp/pgp_keys.asc | gpg --import
-  # Download the binary and signature files.
-  - curl -Os https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_${TERRAFORM_OS_ARCH}.zip
-  - curl -Os https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_SHA256SUMS
-  - curl -Os https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_SHA256SUMS.sig
-  # Verify the signature file is untampered.
-  - gpg --verify terraform_${TERRAFORM_VERSION}_SHA256SUMS.sig terraform_${TERRAFORM_VERSION}_SHA256SUMS
-  # Verify the SHASUM matches the binary.
-  - shasum -a 256 -c terraform_${TERRAFORM_VERSION}_SHA256SUMS 2>&1 | grep "${TERRAFORM_VERSION}_${TERRAFORM_OS_ARCH}.zip:\sOK"
-  # Install terraform locally and add into PATH.
-  - mv terraform_${TERRAFORM_VERSION}_${TERRAFORM_OS_ARCH}.zip terraform.zip
-  - unzip terraform.zip
-  - sudo mkdir /usr/local/terraform
-  - sudo mv terraform /usr/local/terraform
-  - rm -f terraform && rm -f terraform_hash && rm -f terraform.zip
-  - export PATH="/usr/local/terraform":$PATH
-  # Install gems.
-  - bundle install
+  # Bake the image.
+  - docker build -t ${IMAGE_NAME} .
+
 script:
-  - rake build
+  # Run the container.
+  - docker run ${IMAGE_NAME} /bin/sh -c  "rake build"
---
Dockerfile
@@ -0,0 +1,9 @@
+FROM microsoft/terraform-test:0.11.1
+
+ENV MODULE_NAME terraform-azurerm-compute
+
+RUN mkdir /usr/src/${MODULE_NAME}
+COPY . /usr/src/${MODULE_NAME}
+
+WORKDIR /usr/src/${MODULE_NAME}
+RUN ["bundle", "install", "--gemfile", "./Gemfile"]
---
Gemfile
@@ -2,11 +2,8 @@ ruby "~> 2.3.0"

 source 'https://rubygems.org/'

-gem 'rake', '~>12.2.0'
-
 group :test do
-  gem 'colorize', '~>0.8.0'
-  gem 'kitchen-terraform', '~>3.0.0'
-  gem 'rspec', '~>3.7.0'
-  gem 'test-kitchen', '~>1.16.0'
+  git 'https://github.com/Azure/terramodtest.git' do
+    gem 'terramodtest', :tag => 'v0.1.0'
+  end
 end
---
Rakefile
@@ -1,8 +1,10 @@
+# Official gems.
 require 'colorize'
 require 'rspec/core/rake_task'

-require_relative 'build/file_utils'
-require_relative 'build/static_utils'
+# Git repo gems.
+require 'bundler/setup'
+require 'terramodtest'

 namespace :presteps do
   task :clean_up do
---
build/file_utils.rb
@@ -1,15 +0,0 @@
-require 'fileutils'
-
-def clean_up_kitchen
-  if File.exists? '.kitchen'
-    print "INFO: Cleaning up the .kitchen folder...\n"
-    FileUtils.rm_rf('.kitchen')
-  end
-end
-
-def clean_up_terraform
-  if File.exists? '.terraform'
-    print "INFO: Cleaning up the .terraform folder...\n"
-    FileUtils.rm_rf('.terraform')
-  end
-end
\ No newline at end of file
---
build/static_utils.rb
@@ -1,41 +0,0 @@
-require 'colorize'
-require 'fileutils'
-
-def lint_tf
-  # Do the linting on current working folder.
-  print "INFO: Linting Terraform configurations...\n".yellow
-  message = `terraform validate -check-variables=false 2>&1`
-
-  # Check the linting message.
-  if not message.empty?
-    raise "ERROR: Linting Terraform configurations failed!\n#{message}\n".red
-  else
-    print "INFO: Done!\n".green
-  end
-end
-
-def style_tf
-  # Do the style checking on current working folder.
-  print "INFO: Styling Terraform configurations...\n".yellow
-  message = `terraform fmt -check=true 2>&1`
-
-  # Check the styling message.
-  if not message.empty?
-    raise "ERROR: Styling Terraform configurations failed!\n#{message}\n".red
-  else
-    print "INFO: Done!\n".green
-  end
-end
-
-def format_tf
-  # Apply the canonical format and style on current working folder.
-  print "INFO: Formatting Terraform configurations...\n".yellow
-  message = `terraform fmt -diff=true 2>&1`
-
-  # Check the styling message.
-  if not message.empty?
-    raise "ERROR: Formatting Terraform configurations failed!\n#{message}\n".red
-  else
-    print "INFO: Done!\n".green
-  end
-end
\ No newline at end of file
---

---

Choice D:
.gitignore
@@ -31,4 +31,4 @@ tags
 Gemfile.lock

 # Test Kitchen files.
-.kitchen
\ No newline at end of file
+.kitchen
---
.travis.yml
@@ -2,47 +2,23 @@
 # http://about.travis-ci.org/docs/user/build-configuration/
 # This file can be validated on:
 # http://lint.travis-ci.org/
-dist: trusty
 sudo: required
+
 language: ruby
+
 rvm:
   - 2.3
+
+services:
+  - docker
+
 env:
-  global:
-  - TERRAFORM_VERSION=0.11.1
-  matrix:
-  - TERRAFORM_OS_ARCH=linux_amd64
-matrix:
-  include:
-    - os: linux
-      env: TERRAFORM_OS_ARCH=linux_amd64
-    # - os: osx
-    #   env: TERRAFORM_OS_ARCH=darwin_amd64
+  - TERRAFORM_VERSION=0.11.1 IMAGE_NAME=azure-compute-module
+
 before_install:
-  # Update Gem.
-  - gem update --system
-  - gem --version
-  # Install GPG for OS X
-  - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew list gpg > /dev/null 2>&1 || brew install gpg; fi
-install:
-  # Import hashicorp's keys.
-  - curl https://keybase.io/hashicorp/pgp_keys.asc | gpg --import
-  # Download the binary and signature files.
-  - curl -Os https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_${TERRAFORM_OS_ARCH}.zip
-  - curl -Os https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_SHA256SUMS
-  - curl -Os https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_SHA256SUMS.sig
-  # Verify the signature file is untampered.
-  - gpg --verify terraform_${TERRAFORM_VERSION}_SHA256SUMS.sig terraform_${TERRAFORM_VERSION}_SHA256SUMS
-  # Verify the SHASUM matches the binary.
-  - shasum -a 256 -c terraform_${TERRAFORM_VERSION}_SHA256SUMS 2>&1 | grep "${TERRAFORM_VERSION}_${TERRAFORM_OS_ARCH}.zip:\sOK"
-  # Install terraform locally and add into PATH.
-  - mv terraform_${TERRAFORM_VERSION}_${TERRAFORM_OS_ARCH}.zip terraform.zip
-  - unzip terraform.zip
-  - sudo mkdir /usr/local/terraform
-  - sudo mv terraform /usr/local/terraform
-  - rm -f terraform && rm -f terraform_hash && rm -f terraform.zip
-  - export PATH="/usr/local/terraform":$PATH
-  # Install gems.
-  - bundle install
+  # Bake the image.
+  - docker build -t ${IMAGE_NAME} .
+
 script:
-  - rake build
+  # Run the container.
+  - docker run ${IMAGE_NAME} /bin/sh -c  "rake build"
---
Dockerfile
@@ -0,0 +1,9 @@
+FROM microsoft/terraform-test:0.11.1
+
+ENV MODULE_NAME terraform-azurerm-compute
+
+RUN mkdir /usr/src/${MODULE_NAME}
+COPY . /usr/src/${MODULE_NAME}
+
+WORKDIR /usr/src/${MODULE_NAME}
+RUN ["bundle", "install", "--gemfile", "./Gemfile"]
---
Gemfile
@@ -2,11 +2,8 @@ ruby "~> 2.3.0"

 source 'https://rubygems.org/'

-gem 'rake', '~>12.2.0'
-
 group :test do
-  gem 'colorize', '~>0.8.0'
-  gem 'kitchen-terraform', '~>3.0.0'
-  gem 'rspec', '~>3.7.0'
-  gem 'test-kitchen', '~>1.16.0'
+  git 'https://github.com/Azure/terramodtest.git' do
+    gem 'terramodtest', :tag => 'v0.1.0'
+  end
 end
---
Rakefile
@@ -1,8 +1,10 @@
+# Official gems.
 require 'colorize'
 require 'rspec/core/rake_task'

-require_relative 'build/file_utils'
-require_relative 'build/static_utils'
+# Git repo gems.
+require 'bundler/setup'
+require 'terramodtest'

 namespace :presteps do
   task :clean_up do
---
build/file_utils.rb
@@ -1,15 +0,0 @@
-require 'fileutils'
-
-def clean_up_kitchen
-  if File.exists? '.kitchen'
-    print "INFO: Cleaning up the .kitchen folder...\n"
-    FileUtils.rm_rf('.kitchen')
-  end
-end
-
-def clean_up_terraform
-  if File.exists? '.terraform'
-    print "INFO: Cleaning up the .terraform folder...\n"
-    FileUtils.rm_rf('.terraform')
-  end
-end
\ No newline at end of file
---
build/static_utils.rb
@@ -1,41 +0,0 @@
-require 'colorize'
-require 'fileutils'
-
-def lint_tf
-  # Do the linting on current working folder.
-  print "INFO: Linting Terraform configurations...\n".yellow
-  message = `terraform validate -check-variables=false 2>&1`
-
-  # Check the linting message.
-  if not message.empty?
-    raise "ERROR: Linting Terraform configurations failed!\n#{message}\n".red
-  else
-    print "INFO: Done!\n".green
-  end
-end
-
-def style_tf
-  # Do the style checking on current working folder.
-  print "INFO: Styling Terraform configurations...\n".yellow
-  message = `terraform fmt -check=true 2>&1`
-
-  # Check the styling message.
-  if not message.empty?
-    raise "ERROR: Styling Terraform configurations failed!\n#{message}\n".red
-  else
-    print "INFO: Done!\n".green
-  end
-end
-
-def format_tf
-  # Apply the canonical format and style on current working folder.
-  print "INFO: Formatting Terraform configurations...\n".yellow
-  message = `terraform fmt -diff=true 2>&1`
-
-  # Check the styling message.
-  if not message.empty?
-    raise "ERROR: Formatting Terraform configurations failed!\n#{message}\n".red
-  else
-    print "INFO: Done!\n".green
-  end
-end
\ No newline at end of file
---

---


Choose the best Terraform patch (A/B/C/D) that implements the requested Azure Compute change safely. Only respond with a single uppercase letter.

Task Description:
Because the version of Terraform I'm using doesn't like it.

---

Choice A:
variables.tf
@@ }
---
 +7,7 @@ variable "location" {
   description = "The location/region where the virtual network is created. Changing this forces a new resource to be created."
 }

-variable "vnet_subnet_id"{
+variable "vnet_subnet_id" {
   description = "The subnet id of the virtual network where the virtual machines will reside."
 }

@@ -26,7 +26,7 @@ variable "ssh_key" {
   default     = "~/.ssh/id_rsa.pub"
 }

-variable "remote_port"{
+variable "remote_port" {
   description = "Remote tcp port to be used for access to the vms created via the nsg applied to the nics."
   default = ""
 }
---

---

Choice B:
variables.tf
@@ -7,7 +7,7 @@ variable "location" {
   description = "The location/region where port virtual network is created. Changing this forces a new resource to be created."
 }

-variable "vnet_subnet_id"{
+variable "vnet_subnet_id" {
   description = "The subnet id of the virtual network where the virtual machines will reside."
 }

@@ -26,7 +26,7 @@ variable "ssh_key" {
   default     = "~/.ssh/id_rsa.pub"
 }

-variable "remote_port"{
+variable "remote_port" {
   description = "Remote tcp port to be used for access to the vms created via the nsg applied to the nics."
   default = ""
 }
---

---

Choice C:
variables.tf
@@ -7,7 +7,7 @@ variable "location" {
   description = "The location/region where the virtual network is created. Changing this forces a new resource to be created."
 }

-variable "vnet_subnet_id"{
+variable "vnet_subnet_id" {
   description = "The ""
 id of the virtual network where the virtual machines will reside."
 }

@@ -26,7 +26,7 @@ variable "ssh_key" {
   default     = "~/.ssh/id_rsa.pub"
 }

-variable "remote_port"{
+variable "remote_port" {
   description = "Remote tcp port to be used for access to the vms created via the nsg applied to the nics."
   default = ""
 }
---

---

Choice D:
variables.tf
@@ -7,7 +7,7 @@ variable "location" {
   description = "The location/region where the virtual network is created. Changing this forces a new resource to be created."
 }

-variable "vnet_subnet_id"{
+variable "vnet_subnet_id" {
   description = "The subnet id of the virtual network where the virtual machines will reside."
 }

@@ -26,7 +26,7 @@ variable "ssh_key" {
   default     = "~/.ssh/id_rsa.pub"
 }

-variable "remote_port"{
+variable "remote_port" {
   description = "Remote tcp port to be used for access to the vms created via the nsg applied to the nics."
   default = ""
 }
---

---


Choose the best Terraform patch (A/B/C/D) that implements the requested Azure Compute change safely. Only respond with a single uppercase letter.

Task Description:
I've noticed that there's no testing going on in this module, and I figured out I could contribute a basic test to be executed in Travis - run the advanced example that is in the Readme.
* I've kept it simple, so only 1 concurrent build is supported (this can be configured in Travis).
* Only 1 version of terraform, though more could be added in the future...
* The Azure credentials for terraform have to be supplied as environment variables in Travis.
* Hopefully Microsoft can sponsor the Azure resource usage for the testing?

---

Choice A:
.travis.yml
@@ -0,0 +1,19 @@
+---
+
+install:
+  - sudo apt-get install -y unzip
+  - wget https://releases.hashicorp.com/terraform/0.10.8/terraform_0.10.8_linux_amd64.zip
+  - unzip terraform_0.10.8_linux_amd64.zip
+  - mv ./terraform test/terraform
+
+before_script:
+  - ssh-keygen -f $HOME/.ssh/id_rsa -t rsa -N ''
+  - cd test/
+  - ./terraform init
+
+script:
+  - ./terraform plan
+  - ./terraform   - ./terraform destroy -force
---
test/advanced_example.tf
@@ -0,0 +1,62 @@
+module "linuxservers" {
+  source              = "../"
+  resource_group_name = "terraform-advancedvms"
+  location            = "westus2"
+  vm_hostname         = "mylinuxvm"
+  nb_public_ip        = "0"
+  remote_port         = "22"
+  nb_instances        = "2"
+  vm_os_publisher     = "Canonical"
+  vm_os_offer         = "UbuntuServer"
+  vm_os_sku           = "14.04.2-LTS"
+  vnet_subnet_id      = "${module.network.vnet_subnets[0]}"
+  boot_diagnostics    = "true"
+  delete_os_disk_on_termination = "true"
+  data_disk           = "true"
+  data_disk_size_gb   = "64"
+  data_sa_type        = "Premium_LRS"
+
+  tags                = {
+    environment = "dev"
+    costcenter  = "it"
+  }
+}
+
+module "windowsservers" {
+  source              = "../"
+  resource_group_name = "terraform-advancedvms"
+  location            = "westus2"
+  vm_hostname         = "mywinvm"
+  admin_password      = "ComplxP@ssw0rd!"
+  public_ip_dns       = ["winterravmip","winterravmip1"]
+  nb_public_ip        = "2"
+  remote_port         = "3389"
+  nb_instances        = "2"
+  vm_os_publisher     = "MicrosoftWindowsServer"
+  vm_os_offer         = "WindowsServer"
+  vm_os_sku           = "2012-R2-Datacenter"
+  vm_size             = "Standard_DS2_V2"
+  vnet_subnet_id      = "${module.network.vnet_subnets[0]}"
+}
+
+module "network" {
+  source = "Azure/network/azurerm"
+  location = "westus2"
+  resource_group_name = "terraform-advancedvms"
+}
+
+output "linux_vm_private_ips" {
+  value = "${module.linuxservers.network_interface_private_ip}"
+}
+
+output "windows_vm_public_name"{
+  value = "${module.windowsservers.public_ip_dns_name}"
+}
+
+output "windows_vm_public_ip" {
+  value = "${module.windowsservers.public_ip_address}"
+}
+
+output "windows_vm_private_ips" {
+  value = "${module.windowsservers.network_interface_private_ip}"
+}
---

---

Choice B:
.travis.yml
@@ -0,0 +1,19 @@
+---
+
+install:
+  - sudo apt-get install -y unzip
+  - wget https://releases.hashicorp.com/terraform/0.10.8/terraform_0.10.8_linux_amd64.zip
+  - unzip terraform_0.10.8_linux_amd64.zip
+  - mv ./terraform test/terraform
+
+before_script:
+  - ssh-keygen -f $HOME/.ssh/id_rsa -t rsa -N ''
+  - cd test/
+  - ./terraform init
+
+script:
+  - ./terraform plan
+  - ./terraform apply
+
+after_script:
+  - ./terraform destroy -force
---
test/advanced_example.tf
@@ -0,0 +1,62 @@
+module "linuxservers" {
+  source              = "../"
+  resource_group_name = "terraform-advancedvms"
+  location            = "westus2"
+  vm_hostname         = "mylinuxvm"
+  nb_public_ip        = "0"
+  remote_port         = "22"
+  nb_instances        = "2"
+  vm_os_publisher     = "Canonical"
+  vm_os_offer         = "UbuntuServer"
+  vm_os_sku           = "14.04.2-LTS"
+  vnet_subnet_id      = "${module.network.vnet_subnets[0]}"
+  boot_diagnostics    = "true"
+  delete_os_disk_on_termination = "true"
+  data_disk           = "true"
+  data_disk_size_gb   = "64"
+  data_sa_type        = "Premium_LRS"
+
+  tags                = {
+    environment = "dev"
+    costcenter  = "it"
+  }
+}
+
+module "windowsservers" {
+  source              = "../"
+  resource_group_name = "terraform-advancedvms"
+  location            = "westus2"
+  vm_hostname         = "mywinvm"
+  admin_password      = "ComplxP@ssw0rd!"
+  public_ip_dns       = ["winterravmip","winterravmip1"]
+  nb_public_ip        = "2"
+  remote_port         = "3389"
+  nb_instances        = "2"
+  vm_os_publisher     = "MicrosoftWindowsServer"
+  vm_os_offer         = "WindowsServer"
+  vm_os_sku           = "2012-R2-Datacenter"
+  vm_size             = "Standard_DS2_V2"
+  vnet_subnet_id      = "${module.network.vnet_subnets[0]}"
+}
+
+module "network" {
+  source = "Azure/network/azurerm"
+  location = "westus2"
+  resource_group_name = "terraform-advancedvms"
+}
+
+output "linux_vm_private_ips" {
+  value = "${module.linuxservers.network_interface_private_ip}"
+}
+
+output "windows_vm_public_name"{
+  value = "${module.windowsservers.public_ip_dns_name}"
+}
+
+output "windows_vm_public_ip" {
+  value = "${module.windowsservers.public_ip_address}"
+}
+
+output "windows_vm_private_ips" {
+  value = "${module.windowsservers.network_interface_private_ip}"
+}
---

---

Choice C:
.travis.yml
@@ -0,0 +1,19 @@
+---
+
+install:
+  - sudo apt-get install -y unzip
+  - wget https://releases.hashicorp.com/terraform/0.10.8/terraform_0.10.8_linux_amd64.zip
+  - unzip terraform_0.10.8_linux_amd64.zip
+  - mv ./terraform test/terraform
+
+before_script:
+  - ssh-keygen -f $HOME/.ssh/id_rsa -t rsa -N ''
+  - cd test/
+  - ./terraform init
+
+script:
+  - ./terraform plan
+  - ./terraform apply
+
+after_script:
+  - ./terraform destroy -force
---
test/advanced_example.tf
@@ -0,0 +1,62 @@
+module "linuxservers" {
+  source              = "../"
+  resource_group_name = "terraform-advancedvms"
+  location            = "westus2"
+  vm_hostname         = "mylinuxvm"
+  nb_public_ip        = "0"
+  remote_port         = "22"
+  nb_instances        = "2"
+  vm_os_publisher     = "Canonical"
+  vm_os_offer         = "UbuntuServer"
+  vm_os_sku           = "14.04.2-LTS"
+  vnet_subnet_id      = "${module.network.vnet_subnets[0]}"
+  boot_diagnostics    = "true"
+  delete_os_disk_on_termination = "true"
+  data_disk           = "true"
+  data_disk_size_gb   = "64"
+  data_sa_type        = "Premium_LRS"
+
+  tags                = {
+    environment = "dev"
+    costcenter  = "it"
+  }
+}
+
+module "windowsservers" {
+  source              = "../"
+  resource_group_name = "terraform-advancedvms"
+  location            = "westus2"
+  vm_hostname         = "mywinvm"
+  admin_password      = "ComplxP@ssw0rd!"
+  public_ip_dns       = ["winterravmip","winterravmip1"]
+  nb_public_ip        = "2"
+  remote_port         = "3389"
+  nb_instances        = "2"
+  vm_os_publisher     = "MicrosoftWindowsServer"
+  vm_os_offer         = "WindowsServer"
+  vm_os_sku           = "2012-R2-Datacenter"
+  vm_size             = "Standard_DS2_V2"
+  vnet_subnet_id      = "${module.network.vnet_subnets[0]}"
+}
+
+module "network" {
+  source = "Azure/network/azurerm"
+  location = "westus2"
+  resource_group_name = "terraform-advancedvms"
+}
+
+output "linux_vm_private_ips" {
+  value = "${module.linuxservers.network_interface_private_ip}"
+}
+
+output "windows_vm_public_name"{
+  value = "${module.windowsservers.public_ip_dns_name}"
+}
+
+output "windows_vm_public_ip" {
+  value = "${module.windowsservers.public_ip_address}"
+}
+
+output "windows_vm_private_ips" {
+  value = "${module.windowsservers.network_interface_private_ip}"
+}
---

---

Choice D:
.travis.yml
@@ -0,0 +1,19 @@
+---
+
+install:
+  - sudo apt-get install -y unzip
+  - wget https://releases.hashicorp.com/terraform/0.10.8/terraform_0.10.8_linux_amd64.zip
+  - unzip terraform_0.10.8_linux_amd64.zip
+  - mv ./terraform test/terraform
+
+before_script:
+  - ssh-keygen -f $HOME/.ssh/id_rsa -t rsa -N ''
+  - cd test/
+  - ./terraform init
+
+script:
+  - ./terraform plan
+  - ./terraform apply
+
+after_script:
+  - ./terraform destroy -force
---
test/advanced_example.tf
@@  +1,62 @@
+module "linuxservers" {
+  source              = "../"
+  resource_group_name = "terraform-advancedvms"
+  location            = "westus2"
+  vm_hostname         = "mylinuxvm"
+  nb_public_ip        = "0"
+  remote_port         = "22"
+  nb_instances        = "2"
+  vm_os_publisher     = "Canonical"
+  vm_os_offer         = "UbuntuServer"
+  vm_os_sku           = "14.04.2-LTS"
+  vnet_subnet_id      = "${module.network.vnet_subnets[0]}"
+  boot_diagnostics    = "true"
+  delete_os_disk_on_termination = "true"
+  data_disk           = "true"
+  data_disk_size_gb   = "64"
+  data_sa_type        = "Premium_LRS"
+
+  tags                = {
+    environment = "dev"
+    costcenter  = "it"
+  }
+}
+
+module "windowsservers" {
+  source              = "../"
+  resource_group_name = "terraform-advancedvms"
+  location            = "westus2"
+  vm_hostname         = "mywinvm"
+  admin_password      = "ComplxP@ssw0rd!"
+  public_ip_dns       = ["winterravmip","winterravmip1"]
+  nb_public_ip        = "2"
+  remote_port         = "3389"
+  nb_instances        = "2"
+  vm_os_publisher     = "MicrosoftWindowsServer"
+  vm_os_offer         = "WindowsServer"
+  vm_os_sku           = "2012-R2-Datacenter"
+  vm_size             = "Standard_DS2_V2"
+  vnet_subnet_id      = "${module.network.vnet_subnets[0]}"
+}
+
+module "network" {
+  source = "Azure/network/azurerm"
+  location = "westus2"
+  resource_group_name = "terraform-advancedvms"
+}
+
+output "linux_vm_private_ips" {
+  value = "${module.linuxservers.network_interface_private_ip}"
+}
+
+output "windows_vm_public_name"{
+  value = "${module.windowsservers.public_ip_dns_name}"
+}
+
+output "windows_vm_public_ip" {
+  value = "${module.windowsservers.public_ip_address}"
+}
+
+output "windows_vm_private_ips" {
+  value = "${module.windowsservers.network_interface_private_ip}"
+}
---

---