summaryrefslogtreecommitdiff
path: root/vendor/github.com/mitchellh/packer/builder/azure/arm
diff options
context:
space:
mode:
authorThomas Hipp <thipp@suse.de>2017-09-15 09:37:45 +0200
committerThomas Hipp <thipp@suse.de>2017-09-15 10:01:36 +0200
commit651fe263818d1c4ad5ba8adf8c8485ce647dc40b (patch)
treefc73bb74bdcce03c48169ce624698bf240b55e6b /vendor/github.com/mitchellh/packer/builder/azure/arm
parent23635373aed10aab286a2436459670b686b581bb (diff)
downloadterraform-provider-libvirt-651fe263818d1c4ad5ba8adf8c8485ce647dc40b.tar
terraform-provider-libvirt-651fe263818d1c4ad5ba8adf8c8485ce647dc40b.tar.gz
vendor: update deps
This updates all vendored packages. The Glide config has been changed to try and stick to versions instead of commit IDs if possible. Signed-off-by: Thomas Hipp <thipp@suse.de>
Diffstat (limited to 'vendor/github.com/mitchellh/packer/builder/azure/arm')
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/artifact.go3
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/artifact_test.go3
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/authenticate.go3
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/azure_client.go3
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/builder.go11
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/builder_test.go3
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/capture_template.go3
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/capture_template_test.go3
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/config.go64
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/config_test.go89
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/openssh_key_pair.go3
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/openssh_key_pair_test.go3
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/step.go3
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/step_capture_image.go3
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/step_capture_image_test.go3
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/step_create_resource_group.go3
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/step_create_resource_group_test.go3
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/step_delete_os_disk.go3
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/step_delete_os_disk_test.go3
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/step_delete_resource_group.go3
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/step_delete_resource_group_test.go3
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/step_deploy_template.go3
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/step_deploy_template_test.go3
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/step_get_certificate.go3
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/step_get_certificate_test.go3
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/step_get_ip_address.go16
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/step_get_ip_address_test.go166
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/step_get_os_disk.go3
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/step_get_os_disk_test.go3
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/step_power_off_compute.go3
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/step_power_off_compute_test.go3
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/step_set_certificate.go3
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/step_set_certificate_test.go3
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/step_test.go3
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/step_validate_template.go3
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/step_validate_template_test.go3
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/template_factory.go11
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment08.approved.json3
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment09.approved.json3
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment10.approved.json144
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/template_factory_test.go37
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/tempname.go3
-rw-r--r--vendor/github.com/mitchellh/packer/builder/azure/arm/tempname_test.go3
43 files changed, 422 insertions, 221 deletions
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/artifact.go b/vendor/github.com/mitchellh/packer/builder/azure/arm/artifact.go
index eade5017..e8a72091 100644
--- a/vendor/github.com/mitchellh/packer/builder/azure/arm/artifact.go
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/artifact.go
@@ -1,6 +1,3 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
-
package arm
import (
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/artifact_test.go b/vendor/github.com/mitchellh/packer/builder/azure/arm/artifact_test.go
index 7202b652..1b9a472a 100644
--- a/vendor/github.com/mitchellh/packer/builder/azure/arm/artifact_test.go
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/artifact_test.go
@@ -1,6 +1,3 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
-
package arm
import (
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/authenticate.go b/vendor/github.com/mitchellh/packer/builder/azure/arm/authenticate.go
index d89a1254..7f0b5bdc 100644
--- a/vendor/github.com/mitchellh/packer/builder/azure/arm/authenticate.go
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/authenticate.go
@@ -1,6 +1,3 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
-
package arm
import (
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/azure_client.go b/vendor/github.com/mitchellh/packer/builder/azure/arm/azure_client.go
index 10c8d4bb..3fd58bc3 100644
--- a/vendor/github.com/mitchellh/packer/builder/azure/arm/azure_client.go
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/azure_client.go
@@ -1,6 +1,3 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
-
package arm
import (
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/builder.go b/vendor/github.com/mitchellh/packer/builder/azure/arm/builder.go
index 5377b7bb..e6993cfb 100644
--- a/vendor/github.com/mitchellh/packer/builder/azure/arm/builder.go
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/builder.go
@@ -1,6 +1,3 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
-
package arm
import (
@@ -119,7 +116,9 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
}
endpointConnectType := PublicEndpoint
- if b.isPrivateNetworkCommunication() {
+ if b.isPublicPrivateNetworkCommunication() && b.isPrivateNetworkCommunication() {
+ endpointConnectType = PublicEndpointInPrivateNetwork
+ } else if b.isPrivateNetworkCommunication() {
endpointConnectType = PrivateEndpoint
}
@@ -245,6 +244,10 @@ func (b *Builder) writeSSHPrivateKey(ui packer.Ui, debugKeyPath string) {
}
}
+func (b *Builder) isPublicPrivateNetworkCommunication() bool {
+ return DefaultPrivateVirtualNetworkWithPublicIp != b.config.PrivateVirtualNetworkWithPublicIp
+}
+
func (b *Builder) isPrivateNetworkCommunication() bool {
return b.config.VirtualNetworkName != ""
}
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/builder_test.go b/vendor/github.com/mitchellh/packer/builder/azure/arm/builder_test.go
index 47f7a74b..a44d363d 100644
--- a/vendor/github.com/mitchellh/packer/builder/azure/arm/builder_test.go
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/builder_test.go
@@ -1,6 +1,3 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
-
package arm
import (
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/capture_template.go b/vendor/github.com/mitchellh/packer/builder/azure/arm/capture_template.go
index 23e70199..0332a02f 100644
--- a/vendor/github.com/mitchellh/packer/builder/azure/arm/capture_template.go
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/capture_template.go
@@ -1,6 +1,3 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
-
package arm
type CaptureTemplateParameter struct {
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/capture_template_test.go b/vendor/github.com/mitchellh/packer/builder/azure/arm/capture_template_test.go
index 6d2e53b1..8c7a7140 100644
--- a/vendor/github.com/mitchellh/packer/builder/azure/arm/capture_template_test.go
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/capture_template_test.go
@@ -1,6 +1,3 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
-
package arm
import (
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/config.go b/vendor/github.com/mitchellh/packer/builder/azure/arm/config.go
index 1d0c98d1..3fc4f13b 100644
--- a/vendor/github.com/mitchellh/packer/builder/azure/arm/config.go
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/config.go
@@ -1,6 +1,3 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
-
package arm
import (
@@ -34,10 +31,11 @@ import (
)
const (
- DefaultCloudEnvironmentName = "Public"
- DefaultImageVersion = "latest"
- DefaultUserName = "packer"
- DefaultVMSize = "Standard_A1"
+ DefaultCloudEnvironmentName = "Public"
+ DefaultImageVersion = "latest"
+ DefaultUserName = "packer"
+ DefaultPrivateVirtualNetworkWithPublicIp = false
+ DefaultVMSize = "Standard_A1"
)
var (
@@ -73,24 +71,27 @@ type Config struct {
Location string `mapstructure:"location"`
VMSize string `mapstructure:"vm_size"`
- ManagedImageResourceGroupName string `mapstructure:"managed_image_resource_group_name"`
- ManagedImageName string `mapstructure:"managed_image_name"`
- manageImageLocation string
+ ManagedImageResourceGroupName string `mapstructure:"managed_image_resource_group_name"`
+ ManagedImageName string `mapstructure:"managed_image_name"`
+ ManagedImageStorageAccountType string `mapstructure:"managed_image_storage_account_type"`
+ managedImageStorageAccountType compute.StorageAccountTypes
+ manageImageLocation string
// Deployment
- AzureTags map[string]*string `mapstructure:"azure_tags"`
- ResourceGroupName string `mapstructure:"resource_group_name"`
- StorageAccount string `mapstructure:"storage_account"`
- TempComputeName string `mapstructure:"temp_compute_name"`
- TempResourceGroupName string `mapstructure:"temp_resource_group_name"`
- storageAccountBlobEndpoint string
- CloudEnvironmentName string `mapstructure:"cloud_environment_name"`
- cloudEnvironment *azure.Environment
- VirtualNetworkName string `mapstructure:"virtual_network_name"`
- VirtualNetworkSubnetName string `mapstructure:"virtual_network_subnet_name"`
- VirtualNetworkResourceGroupName string `mapstructure:"virtual_network_resource_group_name"`
- CustomDataFile string `mapstructure:"custom_data_file"`
- customData string
+ AzureTags map[string]*string `mapstructure:"azure_tags"`
+ ResourceGroupName string `mapstructure:"resource_group_name"`
+ StorageAccount string `mapstructure:"storage_account"`
+ TempComputeName string `mapstructure:"temp_compute_name"`
+ TempResourceGroupName string `mapstructure:"temp_resource_group_name"`
+ storageAccountBlobEndpoint string
+ CloudEnvironmentName string `mapstructure:"cloud_environment_name"`
+ cloudEnvironment *azure.Environment
+ PrivateVirtualNetworkWithPublicIp bool `mapstructure:"private_virtual_network_with_public_ip"`
+ VirtualNetworkName string `mapstructure:"virtual_network_name"`
+ VirtualNetworkSubnetName string `mapstructure:"virtual_network_subnet_name"`
+ VirtualNetworkResourceGroupName string `mapstructure:"virtual_network_resource_group_name"`
+ CustomDataFile string `mapstructure:"custom_data_file"`
+ customData string
// OS
OSType string `mapstructure:"os_type"`
@@ -403,6 +404,10 @@ func provideDefaultValues(c *Config) {
c.VMSize = DefaultVMSize
}
+ if c.ManagedImageStorageAccountType == "" {
+ c.managedImageStorageAccountType = compute.StandardLRS
+ }
+
if c.ImagePublisher != "" && c.ImageVersion == "" {
c.ImageVersion = DefaultImageVersion
}
@@ -526,6 +531,10 @@ func assertRequiredParametersSet(c *Config, errs *packer.MultiError) {
errs = packer.MultiErrorAppend(errs, fmt.Errorf("Specify either a VHD (image_url), Image Reference (image_publisher, image_offer, image_sku) or a Managed Disk (custom_managed_disk_image_name, custom_managed_disk_resource_group_name"))
}
+ if isImageUrl && c.ManagedImageResourceGroupName != "" {
+ errs = packer.MultiErrorAppend(errs, fmt.Errorf("A managed image must be created from a managed image, it cannot be created from a VHD."))
+ }
+
if c.ImageUrl == "" && c.CustomManagedImageName == "" {
if c.ImagePublisher == "" {
errs = packer.MultiErrorAppend(errs, fmt.Errorf("An image_publisher must be specified"))
@@ -596,4 +605,13 @@ func assertRequiredParametersSet(c *Config, errs *packer.MultiError) {
} else {
errs = packer.MultiErrorAppend(errs, fmt.Errorf("The os_type %q is invalid", c.OSType))
}
+
+ switch c.ManagedImageStorageAccountType {
+ case "", string(compute.StandardLRS):
+ c.managedImageStorageAccountType = compute.StandardLRS
+ case string(compute.PremiumLRS):
+ c.managedImageStorageAccountType = compute.PremiumLRS
+ default:
+ errs = packer.MultiErrorAppend(errs, fmt.Errorf("The managed_image_storage_account_type %q is invalid", c.ManagedImageStorageAccountType))
+ }
}
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/config_test.go b/vendor/github.com/mitchellh/packer/builder/azure/arm/config_test.go
index 83545471..b7523f65 100644
--- a/vendor/github.com/mitchellh/packer/builder/azure/arm/config_test.go
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/config_test.go
@@ -1,6 +1,3 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
-
package arm
import (
@@ -9,6 +6,7 @@ import (
"testing"
"time"
+ "github.com/Azure/azure-sdk-for-go/arm/compute"
"github.com/hashicorp/packer/builder/azure/common/constants"
"github.com/hashicorp/packer/packer"
)
@@ -48,6 +46,10 @@ func TestConfigShouldProvideReasonableDefaultValues(t *testing.T) {
if c.ObjectID != "" {
t.Errorf("Expected 'ObjectID' to be nil, but it was '%s'!", c.ObjectID)
}
+
+ if c.managedImageStorageAccountType == "" {
+ t.Errorf("Expected 'managedImageStorageAccountType' to be populated, but it was empty!")
+ }
}
func TestConfigShouldBeAbleToOverrideDefaultedValues(t *testing.T) {
@@ -56,6 +58,7 @@ func TestConfigShouldBeAbleToOverrideDefaultedValues(t *testing.T) {
builderValues["ssh_username"] = "override_username"
builderValues["vm_size"] = "override_vm_size"
builderValues["communicator"] = "ssh"
+ builderValues["managed_image_storage_account_type"] = "Premium_LRS"
c, _, err := newConfig(builderValues, getPackerConfiguration())
@@ -64,23 +67,27 @@ func TestConfigShouldBeAbleToOverrideDefaultedValues(t *testing.T) {
}
if c.Password != "override_password" {
- t.Errorf("Expected 'Password' to be set to 'override_password', but found '%s'!", c.Password)
+ t.Errorf("Expected 'Password' to be set to 'override_password', but found %q!", c.Password)
}
if c.Comm.SSHPassword != "override_password" {
- t.Errorf("Expected 'c.Comm.SSHPassword' to be set to 'override_password', but found '%s'!", c.Comm.SSHPassword)
+ t.Errorf("Expected 'c.Comm.SSHPassword' to be set to 'override_password', but found %q!", c.Comm.SSHPassword)
}
if c.UserName != "override_username" {
- t.Errorf("Expected 'UserName' to be set to 'override_username', but found '%s'!", c.UserName)
+ t.Errorf("Expected 'UserName' to be set to 'override_username', but found %q!", c.UserName)
}
if c.Comm.SSHUsername != "override_username" {
- t.Errorf("Expected 'c.Comm.SSHUsername' to be set to 'override_username', but found '%s'!", c.Comm.SSHUsername)
+ t.Errorf("Expected 'c.Comm.SSHUsername' to be set to 'override_username', but found %q!", c.Comm.SSHUsername)
}
if c.VMSize != "override_vm_size" {
- t.Errorf("Expected 'vm_size' to be set to 'override_vm_size', but found '%s'!", c.VMSize)
+ t.Errorf("Expected 'vm_size' to be set to 'override_vm_size', but found %q!", c.VMSize)
+ }
+
+ if c.managedImageStorageAccountType != compute.PremiumLRS {
+ t.Errorf("Expected 'managed_image_storage_account_type' to be set to 'Premium_LRS', but found %q!", c.managedImageStorageAccountType)
}
}
@@ -782,6 +789,26 @@ func TestConfigShouldRejectVhdAndManagedImageOutput(t *testing.T) {
}
}
+// If the user specified a build of a VHD, but started with a managed image it should be rejected.
+func TestConfigShouldRejectManagedImageSourceAndVhdOutput(t *testing.T) {
+ config := map[string]interface{}{
+ "image_url": "ignore",
+ "location": "ignore",
+ "subscription_id": "ignore",
+ "communicator": "none",
+ "managed_image_resource_group_name": "ignore",
+ "managed_image_name": "ignore",
+
+ // Does not matter for this test case, just pick one.
+ "os_type": constants.Target_Linux,
+ }
+
+ _, _, err := newConfig(config, getPackerConfiguration())
+ if err == nil {
+ t.Fatal("expected config to reject VHD and Managed Image build")
+ }
+}
+
func TestConfigShouldRejectCustomAndPlatformManagedImageBuild(t *testing.T) {
config := map[string]interface{}{
"custom_managed_image_resource_group_name": "ignore",
@@ -826,6 +853,52 @@ func TestConfigShouldRejectCustomAndImageUrlForManagedImageBuild(t *testing.T) {
}
}
+func TestConfigShouldRejectMalformedManageImageStorageAccountTypes(t *testing.T) {
+ config := map[string]interface{}{
+ "custom_managed_image_resource_group_name": "ignore",
+ "custom_managed_image_name": "ignore",
+ "location": "ignore",
+ "subscription_id": "ignore",
+ "communicator": "none",
+ "managed_image_resource_group_name": "ignore",
+ "managed_image_name": "ignore",
+ "managed_image_storage_account_type": "--invalid--",
+
+ // Does not matter for this test case, just pick one.
+ "os_type": constants.Target_Linux,
+ }
+
+ _, _, err := newConfig(config, getPackerConfiguration())
+ if err == nil {
+ t.Fatal("expected config to reject custom and platform input for a managed image build")
+ }
+}
+
+func TestConfigShouldAcceptManagedImageStorageAccountTypes(t *testing.T) {
+ config := map[string]interface{}{
+ "custom_managed_image_resource_group_name": "ignore",
+ "custom_managed_image_name": "ignore",
+ "location": "ignore",
+ "subscription_id": "ignore",
+ "communicator": "none",
+ "managed_image_resource_group_name": "ignore",
+ "managed_image_name": "ignore",
+
+ // Does not matter for this test case, just pick one.
+ "os_type": constants.Target_Linux,
+ }
+
+ storage_account_types := []string{"Premium_LRS", "Standard_LRS"}
+
+ for _, x := range storage_account_types {
+ config["managed_image_storage_account_type"] = x
+ _, _, err := newConfig(config, getPackerConfiguration())
+ if err != nil {
+ t.Fatalf("expected config to accept a managed_image_storage_account_type of %q", x)
+ }
+ }
+}
+
func getArmBuilderConfiguration() map[string]string {
m := make(map[string]string)
for _, v := range requiredConfigValues {
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/openssh_key_pair.go b/vendor/github.com/mitchellh/packer/builder/azure/arm/openssh_key_pair.go
index 4f8c8d22..e3b296f3 100644
--- a/vendor/github.com/mitchellh/packer/builder/azure/arm/openssh_key_pair.go
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/openssh_key_pair.go
@@ -1,6 +1,3 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
-
package arm
import (
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/openssh_key_pair_test.go b/vendor/github.com/mitchellh/packer/builder/azure/arm/openssh_key_pair_test.go
index 7e2f6957..fae03105 100644
--- a/vendor/github.com/mitchellh/packer/builder/azure/arm/openssh_key_pair_test.go
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/openssh_key_pair_test.go
@@ -1,6 +1,3 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
-
package arm
import (
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/step.go b/vendor/github.com/mitchellh/packer/builder/azure/arm/step.go
index 574527f8..707a1a07 100644
--- a/vendor/github.com/mitchellh/packer/builder/azure/arm/step.go
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/step.go
@@ -1,6 +1,3 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
-
package arm
import (
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_capture_image.go b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_capture_image.go
index eac4b5c6..10d29069 100644
--- a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_capture_image.go
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_capture_image.go
@@ -1,6 +1,3 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
-
package arm
import (
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_capture_image_test.go b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_capture_image_test.go
index 24bba776..4527627a 100644
--- a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_capture_image_test.go
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_capture_image_test.go
@@ -1,6 +1,3 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
-
package arm
import (
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_create_resource_group.go b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_create_resource_group.go
index b8e24149..079ad527 100644
--- a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_create_resource_group.go
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_create_resource_group.go
@@ -1,6 +1,3 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
-
package arm
import (
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_create_resource_group_test.go b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_create_resource_group_test.go
index ca0c8f18..4e6b7592 100644
--- a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_create_resource_group_test.go
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_create_resource_group_test.go
@@ -1,6 +1,3 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
-
package arm
import (
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_delete_os_disk.go b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_delete_os_disk.go
index 0041a8ec..1dd28ec8 100644
--- a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_delete_os_disk.go
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_delete_os_disk.go
@@ -1,6 +1,3 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
-
package arm
import (
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_delete_os_disk_test.go b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_delete_os_disk_test.go
index 6e2e2d9a..2724ee61 100644
--- a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_delete_os_disk_test.go
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_delete_os_disk_test.go
@@ -1,6 +1,3 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
-
package arm
import (
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_delete_resource_group.go b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_delete_resource_group.go
index 5a168328..2606b9fc 100644
--- a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_delete_resource_group.go
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_delete_resource_group.go
@@ -1,6 +1,3 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
-
package arm
import (
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_delete_resource_group_test.go b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_delete_resource_group_test.go
index fb2882a4..25ab14e4 100644
--- a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_delete_resource_group_test.go
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_delete_resource_group_test.go
@@ -1,6 +1,3 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
-
package arm
import (
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_deploy_template.go b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_deploy_template.go
index 96248684..8d73402b 100644
--- a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_deploy_template.go
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_deploy_template.go
@@ -1,6 +1,3 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
-
package arm
import (
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_deploy_template_test.go b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_deploy_template_test.go
index 57bfce7d..3a1d0c0b 100644
--- a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_deploy_template_test.go
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_deploy_template_test.go
@@ -1,6 +1,3 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
-
package arm
import (
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_get_certificate.go b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_get_certificate.go
index ffc27b14..b9126da3 100644
--- a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_get_certificate.go
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_get_certificate.go
@@ -1,6 +1,3 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
-
package arm
import (
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_get_certificate_test.go b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_get_certificate_test.go
index 46c921a3..553806c5 100644
--- a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_get_certificate_test.go
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_get_certificate_test.go
@@ -1,6 +1,3 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
-
package arm
import (
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_get_ip_address.go b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_get_ip_address.go
index fed78afb..2c8165b0 100644
--- a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_get_ip_address.go
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_get_ip_address.go
@@ -1,6 +1,3 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
-
package arm
import (
@@ -16,12 +13,14 @@ type EndpointType int
const (
PublicEndpoint EndpointType = iota
PrivateEndpoint
+ PublicEndpointInPrivateNetwork
)
var (
EndpointCommunicationText = map[EndpointType]string{
- PublicEndpoint: "PublicEndpoint",
- PrivateEndpoint: "PrivateEndpoint",
+ PublicEndpoint: "PublicEndpoint",
+ PrivateEndpoint: "PrivateEndpoint",
+ PublicEndpointInPrivateNetwork: "PublicEndpointInPrivateNetwork",
}
)
@@ -46,6 +45,8 @@ func NewStepGetIPAddress(client *AzureClient, ui packer.Ui, endpoint EndpointTyp
step.get = step.getPrivateIP
case PublicEndpoint:
step.get = step.getPublicIP
+ case PublicEndpointInPrivateNetwork:
+ step.get = step.getPublicIPInPrivateNetwork
}
return step
@@ -70,6 +71,11 @@ func (s *StepGetIPAddress) getPublicIP(resourceGroupName string, ipAddressName s
return *resp.IPAddress, nil
}
+func (s *StepGetIPAddress) getPublicIPInPrivateNetwork(resourceGroupName string, ipAddressName string, interfaceName string) (string, error) {
+ s.getPrivateIP(resourceGroupName, ipAddressName, interfaceName)
+ return s.getPublicIP(resourceGroupName, ipAddressName, interfaceName)
+}
+
func (s *StepGetIPAddress) Run(state multistep.StateBag) multistep.StepAction {
s.say("Getting the VM's IP address ...")
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_get_ip_address_test.go b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_get_ip_address_test.go
index a0b854ed..1403e9a5 100644
--- a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_get_ip_address_test.go
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_get_ip_address_test.go
@@ -1,6 +1,3 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
-
package arm
import (
@@ -12,42 +9,50 @@ import (
)
func TestStepGetIPAddressShouldFailIfGetFails(t *testing.T) {
- var testSubject = &StepGetIPAddress{
- get: func(string, string, string) (string, error) { return "", fmt.Errorf("!! Unit Test FAIL !!") },
- endpoint: PublicEndpoint,
- say: func(message string) {},
- error: func(e error) {},
- }
-
- stateBag := createTestStateBagStepGetIPAddress()
-
- var result = testSubject.Run(stateBag)
- if result != multistep.ActionHalt {
- t.Fatalf("Expected the step to return 'ActionHalt', but got '%d'.", result)
- }
-
- if _, ok := stateBag.GetOk(constants.Error); ok == false {
- t.Fatalf("Expected the step to set stateBag['%s'], but it was not.", constants.Error)
+ endpoints := []EndpointType{PublicEndpoint, PublicEndpointInPrivateNetwork}
+
+ for _, endpoint := range endpoints {
+ var testSubject = &StepGetIPAddress{
+ get: func(string, string, string) (string, error) { return "", fmt.Errorf("!! Unit Test FAIL !!") },
+ endpoint: endpoint,
+ say: func(message string) {},
+ error: func(e error) {},
+ }
+
+ stateBag := createTestStateBagStepGetIPAddress()
+
+ var result = testSubject.Run(stateBag)
+ if result != multistep.ActionHalt {
+ t.Fatalf("Expected the step to return 'ActionHalt', but got '%d'.", result)
+ }
+
+ if _, ok := stateBag.GetOk(constants.Error); ok == false {
+ t.Fatalf("Expected the step to set stateBag['%s'], but it was not.", constants.Error)
+ }
}
}
func TestStepGetIPAddressShouldPassIfGetPasses(t *testing.T) {
- var testSubject = &StepGetIPAddress{
- get: func(string, string, string) (string, error) { return "", nil },
- endpoint: PublicEndpoint,
- say: func(message string) {},
- error: func(e error) {},
- }
-
- stateBag := createTestStateBagStepGetIPAddress()
-
- var result = testSubject.Run(stateBag)
- if result != multistep.ActionContinue {
- t.Fatalf("Expected the step to return 'ActionContinue', but got '%d'.", result)
- }
-
- if _, ok := stateBag.GetOk(constants.Error); ok == true {
- t.Fatalf("Expected the step to not set stateBag['%s'], but it was.", constants.Error)
+ endpoints := []EndpointType{PublicEndpoint, PublicEndpointInPrivateNetwork}
+
+ for _, endpoint := range endpoints {
+ var testSubject = &StepGetIPAddress{
+ get: func(string, string, string) (string, error) { return "", nil },
+ endpoint: endpoint,
+ say: func(message string) {},
+ error: func(e error) {},
+ }
+
+ stateBag := createTestStateBagStepGetIPAddress()
+
+ var result = testSubject.Run(stateBag)
+ if result != multistep.ActionContinue {
+ t.Fatalf("Expected the step to return 'ActionContinue', but got '%d'.", result)
+ }
+
+ if _, ok := stateBag.GetOk(constants.Error); ok == true {
+ t.Fatalf("Expected the step to not set stateBag['%s'], but it was.", constants.Error)
+ }
}
}
@@ -55,50 +60,53 @@ func TestStepGetIPAddressShouldTakeStepArgumentsFromStateBag(t *testing.T) {
var actualResourceGroupName string
var actualIPAddressName string
var actualNicName string
-
- var testSubject = &StepGetIPAddress{
- get: func(resourceGroupName string, ipAddressName string, nicName string) (string, error) {
- actualResourceGroupName = resourceGroupName
- actualIPAddressName = ipAddressName
- actualNicName = nicName
-
- return "127.0.0.1", nil
- },
- endpoint: PublicEndpoint,
- say: func(message string) {},
- error: func(e error) {},
- }
-
- stateBag := createTestStateBagStepGetIPAddress()
- var result = testSubject.Run(stateBag)
-
- if result != multistep.ActionContinue {
- t.Fatalf("Expected the step to return 'ActionContinue', but got '%d'.", result)
- }
-
- var expectedResourceGroupName = stateBag.Get(constants.ArmResourceGroupName).(string)
- var expectedIPAddressName = stateBag.Get(constants.ArmPublicIPAddressName).(string)
- var expectedNicName = stateBag.Get(constants.ArmNicName).(string)
-
- if actualIPAddressName != expectedIPAddressName {
- t.Fatal("Expected StepGetIPAddress to source 'constants.ArmIPAddressName' from the state bag, but it did not.")
- }
-
- if actualResourceGroupName != expectedResourceGroupName {
- t.Fatal("Expected StepGetIPAddress to source 'constants.ArmResourceGroupName' from the state bag, but it did not.")
- }
-
- if actualNicName != expectedNicName {
- t.Fatalf("Expected StepGetIPAddress to source 'constants.ArmNetworkInterfaceName' from the state bag, but it did not.")
- }
-
- expectedIPAddress, ok := stateBag.GetOk(constants.SSHHost)
- if !ok {
- t.Fatalf("Expected the state bag to have a value for '%s', but it did not.", constants.SSHHost)
- }
-
- if expectedIPAddress != "127.0.0.1" {
- t.Fatalf("Expected the value of stateBag[%s] to be '127.0.0.1', but got '%s'.", constants.SSHHost, expectedIPAddress)
+ endpoints := []EndpointType{PublicEndpoint, PublicEndpointInPrivateNetwork}
+
+ for _, endpoint := range endpoints {
+ var testSubject = &StepGetIPAddress{
+ get: func(resourceGroupName string, ipAddressName string, nicName string) (string, error) {
+ actualResourceGroupName = resourceGroupName
+ actualIPAddressName = ipAddressName
+ actualNicName = nicName
+
+ return "127.0.0.1", nil
+ },
+ endpoint: endpoint,
+ say: func(message string) {},
+ error: func(e error) {},
+ }
+
+ stateBag := createTestStateBagStepGetIPAddress()
+ var result = testSubject.Run(stateBag)
+
+ if result != multistep.ActionContinue {
+ t.Fatalf("Expected the step to return 'ActionContinue', but got '%d'.", result)
+ }
+
+ var expectedResourceGroupName = stateBag.Get(constants.ArmResourceGroupName).(string)
+ var expectedIPAddressName = stateBag.Get(constants.ArmPublicIPAddressName).(string)
+ var expectedNicName = stateBag.Get(constants.ArmNicName).(string)
+
+ if actualIPAddressName != expectedIPAddressName {
+ t.Fatal("Expected StepGetIPAddress to source 'constants.ArmIPAddressName' from the state bag, but it did not.")
+ }
+
+ if actualResourceGroupName != expectedResourceGroupName {
+ t.Fatal("Expected StepGetIPAddress to source 'constants.ArmResourceGroupName' from the state bag, but it did not.")
+ }
+
+ if actualNicName != expectedNicName {
+ t.Fatalf("Expected StepGetIPAddress to source 'constants.ArmNetworkInterfaceName' from the state bag, but it did not.")
+ }
+
+ expectedIPAddress, ok := stateBag.GetOk(constants.SSHHost)
+ if !ok {
+ t.Fatalf("Expected the state bag to have a value for '%s', but it did not.", constants.SSHHost)
+ }
+
+ if expectedIPAddress != "127.0.0.1" {
+ t.Fatalf("Expected the value of stateBag[%s] to be '127.0.0.1', but got '%s'.", constants.SSHHost, expectedIPAddress)
+ }
}
}
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_get_os_disk.go b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_get_os_disk.go
index 6b21d57d..511ab5c5 100644
--- a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_get_os_disk.go
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_get_os_disk.go
@@ -1,6 +1,3 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
-
package arm
import (
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_get_os_disk_test.go b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_get_os_disk_test.go
index 9b647492..2b3a4d5d 100644
--- a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_get_os_disk_test.go
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_get_os_disk_test.go
@@ -1,6 +1,3 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
-
package arm
import (
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_power_off_compute.go b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_power_off_compute.go
index a1d38f34..931050e0 100644
--- a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_power_off_compute.go
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_power_off_compute.go
@@ -1,6 +1,3 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
-
package arm
import (
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_power_off_compute_test.go b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_power_off_compute_test.go
index 71004256..2dcdac7f 100644
--- a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_power_off_compute_test.go
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_power_off_compute_test.go
@@ -1,6 +1,3 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
-
package arm
import (
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_set_certificate.go b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_set_certificate.go
index a2263d12..5e865b88 100644
--- a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_set_certificate.go
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_set_certificate.go
@@ -1,6 +1,3 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
-
package arm
import (
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_set_certificate_test.go b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_set_certificate_test.go
index 5bcb7dff..1ad9b7db 100644
--- a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_set_certificate_test.go
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_set_certificate_test.go
@@ -1,6 +1,3 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
-
package arm
import (
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_test.go b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_test.go
index 060c1235..2b10c878 100644
--- a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_test.go
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_test.go
@@ -1,6 +1,3 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
-
package arm
import (
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_validate_template.go b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_validate_template.go
index 5a041f91..d2b98638 100644
--- a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_validate_template.go
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_validate_template.go
@@ -1,6 +1,3 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
-
package arm
import (
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_validate_template_test.go b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_validate_template_test.go
index 071d10d8..a5603078 100644
--- a/vendor/github.com/mitchellh/packer/builder/azure/arm/step_validate_template_test.go
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/step_validate_template_test.go
@@ -1,6 +1,3 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
-
package arm
import (
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/template_factory.go b/vendor/github.com/mitchellh/packer/builder/azure/arm/template_factory.go
index 3cd00845..16fe7bf9 100644
--- a/vendor/github.com/mitchellh/packer/builder/azure/arm/template_factory.go
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/template_factory.go
@@ -53,7 +53,7 @@ func GetVirtualMachineDeployment(config *Config) (*resources.Deployment, error)
if config.ImageUrl != "" {
builder.SetImageUrl(config.ImageUrl, osType)
} else if config.CustomManagedImageName != "" {
- builder.SetManagedDiskUrl(config.customManagedImageID)
+ builder.SetManagedDiskUrl(config.customManagedImageID, config.managedImageStorageAccountType)
} else if config.ManagedImageName != "" && config.ImagePublisher != "" {
imageID := fmt.Sprintf("/subscriptions/%s/providers/Microsoft.Compute/locations/%s/publishers/%s/ArtifactTypes/vmimage/offers/%s/skus/%s/versions/%s",
config.SubscriptionID,
@@ -63,7 +63,7 @@ func GetVirtualMachineDeployment(config *Config) (*resources.Deployment, error)
config.ImageSku,
config.ImageVersion)
- builder.SetManagedMarketplaceImage(config.Location, config.ImagePublisher, config.ImageOffer, config.ImageSku, config.ImageVersion, imageID)
+ builder.SetManagedMarketplaceImage(config.Location, config.ImagePublisher, config.ImageOffer, config.ImageSku, config.ImageVersion, imageID, config.managedImageStorageAccountType)
} else {
builder.SetMarketPlaceImage(config.ImagePublisher, config.ImageOffer, config.ImageSku, config.ImageVersion)
}
@@ -76,7 +76,12 @@ func GetVirtualMachineDeployment(config *Config) (*resources.Deployment, error)
builder.SetCustomData(config.customData)
}
- if config.VirtualNetworkName != "" {
+ if config.VirtualNetworkName != "" && DefaultPrivateVirtualNetworkWithPublicIp != config.PrivateVirtualNetworkWithPublicIp {
+ builder.SetPrivateVirtualNetworWithPublicIp(
+ config.VirtualNetworkResourceGroupName,
+ config.VirtualNetworkName,
+ config.VirtualNetworkSubnetName)
+ } else if config.VirtualNetworkName != "" {
builder.SetVirtualNetwork(
config.VirtualNetworkResourceGroupName,
config.VirtualNetworkName,
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment08.approved.json b/vendor/github.com/mitchellh/packer/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment08.approved.json
index 7089ed59..c567b774 100644
--- a/vendor/github.com/mitchellh/packer/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment08.approved.json
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment08.approved.json
@@ -129,6 +129,9 @@
"osDisk": {
"caching": "ReadWrite",
"createOption": "fromImage",
+ "managedDisk": {
+ "storageAccountType": "Standard_LRS"
+ },
"name": "osdisk",
"osType": "Linux"
}
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment09.approved.json b/vendor/github.com/mitchellh/packer/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment09.approved.json
index 03a00fa3..fbbb7384 100644
--- a/vendor/github.com/mitchellh/packer/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment09.approved.json
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment09.approved.json
@@ -132,6 +132,9 @@
"osDisk": {
"caching": "ReadWrite",
"createOption": "fromImage",
+ "managedDisk": {
+ "storageAccountType": "Standard_LRS"
+ },
"name": "osdisk",
"osType": "Linux"
}
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment10.approved.json b/vendor/github.com/mitchellh/packer/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment10.approved.json
new file mode 100644
index 00000000..0eb13013
--- /dev/null
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/template_factory_test.TestVirtualMachineDeployment10.approved.json
@@ -0,0 +1,144 @@
+{
+ "$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json",
+ "contentVersion": "1.0.0.0",
+ "parameters": {
+ "adminPassword": {
+ "type": "string"
+ },
+ "adminUsername": {
+ "type": "string"
+ },
+ "dnsNameForPublicIP": {
+ "type": "string"
+ },
+ "osDiskName": {
+ "type": "string"
+ },
+ "storageAccountBlobEndpoint": {
+ "type": "string"
+ },
+ "vmName": {
+ "type": "string"
+ },
+ "vmSize": {
+ "type": "string"
+ }
+ },
+ "resources": [
+ {
+ "apiVersion": "[variables('publicIPAddressApiVersion')]",
+ "location": "[variables('location')]",
+ "name": "[variables('publicIPAddressName')]",
+ "properties": {
+ "dnsSettings": {
+ "domainNameLabel": "[parameters('dnsNameForPublicIP')]"
+ },
+ "publicIPAllocationMethod": "[variables('publicIPAddressType')]"
+ },
+ "type": "Microsoft.Network/publicIPAddresses"
+ },
+ {
+ "apiVersion": "[variables('networkInterfacesApiVersion')]",
+ "dependsOn": [
+ "[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]"
+ ],
+ "location": "[variables('location')]",
+ "name": "[variables('nicName')]",
+ "properties": {
+ "ipConfigurations": [
+ {
+ "name": "ipconfig",
+ "properties": {
+ "privateIPAllocationMethod": "Dynamic",
+ "publicIPAddress": {
+ "id": "[resourceId('Microsoft.Network/publicIPAddresses', variables('publicIPAddressName'))]"
+ },
+ "subnet": {
+ "id": "[variables('subnetRef')]"
+ }
+ }
+ }
+ ]
+ },
+ "type": "Microsoft.Network/networkInterfaces"
+ },
+ {
+ "apiVersion": "[variables('apiVersion')]",
+ "dependsOn": [
+ "[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
+ ],
+ "location": "[variables('location')]",
+ "name": "[parameters('vmName')]",
+ "properties": {
+ "diagnosticsProfile": {
+ "bootDiagnostics": {
+ "enabled": false
+ }
+ },
+ "hardwareProfile": {
+ "vmSize": "[parameters('vmSize')]"
+ },
+ "networkProfile": {
+ "networkInterfaces": [
+ {
+ "id": "[resourceId('Microsoft.Network/networkInterfaces', variables('nicName'))]"
+ }
+ ]
+ },
+ "osProfile": {
+ "adminPassword": "[parameters('adminPassword')]",
+ "adminUsername": "[parameters('adminUsername')]",
+ "computerName": "[parameters('vmName')]",
+ "linuxConfiguration": {
+ "ssh": {
+ "publicKeys": [
+ {
+ "keyData": "",
+ "path": "[variables('sshKeyPath')]"
+ }
+ ]
+ }
+ }
+ },
+ "storageProfile": {
+ "imageReference": {
+ "offer": "--image-offer--",
+ "publisher": "--image-publisher--",
+ "sku": "--image-sku--",
+ "version": "--version--"
+ },
+ "osDisk": {
+ "caching": "ReadWrite",
+ "createOption": "fromImage",
+ "managedDisk": {
+ "storageAccountType": "Standard_LRS"
+ },
+ "name": "osdisk",
+ "osType": "Linux"
+ }
+ }
+ },
+ "type": "Microsoft.Compute/virtualMachines"
+ }
+ ],
+ "variables": {
+ "addressPrefix": "10.0.0.0/16",
+ "apiVersion": "2017-03-30",
+ "location": "[resourceGroup().location]",
+ "managedDiskApiVersion": "2017-03-30",
+ "networkInterfacesApiVersion": "2017-04-01",
+ "nicName": "packerNic",
+ "publicIPAddressApiVersion": "2017-04-01",
+ "publicIPAddressName": "packerPublicIP",
+ "publicIPAddressType": "Dynamic",
+ "sshKeyPath": "[concat('/home/',parameters('adminUsername'),'/.ssh/authorized_keys')]",
+ "subnetAddressPrefix": "10.0.0.0/24",
+ "subnetName": "--virtual_network_subnet_name--",
+ "subnetRef": "[concat(variables('vnetID'),'/subnets/',variables('subnetName'))]",
+ "virtualNetworkName": "--virtual_network_name--",
+ "virtualNetworkResourceGroup": "--virtual_network_resource_group_name--",
+ "virtualNetworksApiVersion": "2017-04-01",
+ "vmStorageAccountContainerName": "images",
+ "vnetID": "[resourceId(variables('virtualNetworkResourceGroup'), 'Microsoft.Network/virtualNetworks', variables('virtualNetworkName'))]"
+ }
+} \ No newline at end of file
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/template_factory_test.go b/vendor/github.com/mitchellh/packer/builder/azure/arm/template_factory_test.go
index 8a6e0c65..b571871e 100644
--- a/vendor/github.com/mitchellh/packer/builder/azure/arm/template_factory_test.go
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/template_factory_test.go
@@ -318,6 +318,43 @@ func TestVirtualMachineDeployment09(t *testing.T) {
}
}
+// Ensure the VM template is correct when building with PublicIp and connect to Private Network
+func TestVirtualMachineDeployment10(t *testing.T) {
+ config := map[string]interface{}{
+ "location": "ignore",
+ "subscription_id": "ignore",
+ "os_type": constants.Target_Linux,
+ "communicator": "none",
+ "image_publisher": "--image-publisher--",
+ "image_offer": "--image-offer--",
+ "image_sku": "--image-sku--",
+ "image_version": "--version--",
+
+ "virtual_network_resource_group_name": "--virtual_network_resource_group_name--",
+ "virtual_network_name": "--virtual_network_name--",
+ "virtual_network_subnet_name": "--virtual_network_subnet_name--",
+ "private_virtual_network_with_public_ip": true,
+
+ "managed_image_name": "ManagedImageName",
+ "managed_image_resource_group_name": "ManagedImageResourceGroupName",
+ }
+
+ c, _, err := newConfig(config, getPackerConfiguration())
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ deployment, err := GetVirtualMachineDeployment(c)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ err = approvaltests.VerifyJSONStruct(t, deployment.Properties.Template)
+ if err != nil {
+ t.Fatal(err)
+ }
+}
+
// Ensure the link values are not set, and the concrete values are set.
func TestKeyVaultDeployment00(t *testing.T) {
c, _, _ := newConfig(getArmBuilderConfiguration(), getPackerConfiguration())
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/tempname.go b/vendor/github.com/mitchellh/packer/builder/azure/arm/tempname.go
index 22e14097..734cd74a 100644
--- a/vendor/github.com/mitchellh/packer/builder/azure/arm/tempname.go
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/tempname.go
@@ -1,6 +1,3 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
-
package arm
import (
diff --git a/vendor/github.com/mitchellh/packer/builder/azure/arm/tempname_test.go b/vendor/github.com/mitchellh/packer/builder/azure/arm/tempname_test.go
index c812e6c7..e9a49b42 100644
--- a/vendor/github.com/mitchellh/packer/builder/azure/arm/tempname_test.go
+++ b/vendor/github.com/mitchellh/packer/builder/azure/arm/tempname_test.go
@@ -1,6 +1,3 @@
-// Copyright (c) Microsoft Corporation. All rights reserved.
-// Licensed under the MIT License. See the LICENSE file in builder/azure for license information.
-
package arm
import (