Merge pull request #9251 from hashicorp/fix_9249

builder/azure-arm: Update runtime constants with a valid DataDiskName
pull/9258/head
Megan Marsh 6 years ago committed by GitHub
commit 58b32ebefa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -394,7 +394,7 @@ type Config struct {
// see [here](https://docs.microsoft.com/en-us/azure/virtual-machines/troubleshooting/boot-diagnostics) for more info // see [here](https://docs.microsoft.com/en-us/azure/virtual-machines/troubleshooting/boot-diagnostics) for more info
BootDiagSTGAccount string `mapstructure:"boot_diag_storage_account" required:"false"` BootDiagSTGAccount string `mapstructure:"boot_diag_storage_account" required:"false"`
// specify custom azure resource names during build limited to max 10 charcters // specify custom azure resource names during build limited to max 10 characters
// this will set the prefix for the resources. The actuall resource names will be // this will set the prefix for the resources. The actuall resource names will be
// `custom_resource_build_prefix` + resourcetype + 5 character random alphanumeric string // `custom_resource_build_prefix` + resourcetype + 5 character random alphanumeric string
CustomResourcePrefix string `mapstructure:"custom_resource_build_prefix" required:"false"` CustomResourcePrefix string `mapstructure:"custom_resource_build_prefix" required:"false"`
@ -668,7 +668,7 @@ func setRuntimeValues(c *Config) {
c.tmpNicName = tempName.NicName c.tmpNicName = tempName.NicName
c.tmpPublicIPAddressName = tempName.PublicIPAddressName c.tmpPublicIPAddressName = tempName.PublicIPAddressName
c.tmpOSDiskName = tempName.OSDiskName c.tmpOSDiskName = tempName.OSDiskName
c.tmpDataDiskName = tempName.DataDiskname c.tmpDataDiskName = tempName.DataDiskName
c.tmpSubnetName = tempName.SubnetName c.tmpSubnetName = tempName.SubnetName
c.tmpVirtualNetworkName = tempName.VirtualNetworkName c.tmpVirtualNetworkName = tempName.VirtualNetworkName
c.tmpNsgName = tempName.NsgName c.tmpNsgName = tempName.NsgName

@ -596,6 +596,10 @@ func TestSystemShouldDefineRuntimeValues(t *testing.T) {
t.Errorf("Expected tmpOSDiskName to not be empty, but it was '%s'!", c.tmpOSDiskName) t.Errorf("Expected tmpOSDiskName to not be empty, but it was '%s'!", c.tmpOSDiskName)
} }
if c.tmpDataDiskName == "" {
t.Errorf("Expected tmpDataDiskName to not be empty, but it was '%s'!", c.tmpDataDiskName)
}
if c.tmpNsgName == "" { if c.tmpNsgName == "" {
t.Errorf("Expected tmpNsgName to not be empty, but it was '%s'!", c.tmpNsgName) t.Errorf("Expected tmpNsgName to not be empty, but it was '%s'!", c.tmpNsgName)
} }

@ -15,7 +15,7 @@ type TempName struct {
KeyVaultName string KeyVaultName string
ResourceGroupName string ResourceGroupName string
OSDiskName string OSDiskName string
DataDiskname string DataDiskName string
NicName string NicName string
SubnetName string SubnetName string
PublicIPAddressName string PublicIPAddressName string
@ -36,6 +36,7 @@ func NewTempName(p string) *TempName {
tempName.DeploymentName = fmt.Sprintf("%sdp%s", p, suffix) tempName.DeploymentName = fmt.Sprintf("%sdp%s", p, suffix)
tempName.KeyVaultName = fmt.Sprintf("%skv%s", p, suffix) tempName.KeyVaultName = fmt.Sprintf("%skv%s", p, suffix)
tempName.OSDiskName = fmt.Sprintf("%sos%s", p, suffix) tempName.OSDiskName = fmt.Sprintf("%sos%s", p, suffix)
tempName.DataDiskName = fmt.Sprintf("%sdd%s", p, suffix)
tempName.NicName = fmt.Sprintf("%sni%s", p, suffix) tempName.NicName = fmt.Sprintf("%sni%s", p, suffix)
tempName.PublicIPAddressName = fmt.Sprintf("%sip%s", p, suffix) tempName.PublicIPAddressName = fmt.Sprintf("%sip%s", p, suffix)
tempName.SubnetName = fmt.Sprintf("%ssn%s", p, suffix) tempName.SubnetName = fmt.Sprintf("%ssn%s", p, suffix)

@ -367,6 +367,7 @@ The Azure builder creates the following random values at runtime.
- NIC Name: a random 15-character name prefixed with pkrni. - NIC Name: a random 15-character name prefixed with pkrni.
- Public IP Name: a random 15-character name prefixed with pkrip. - Public IP Name: a random 15-character name prefixed with pkrip.
- OS Disk Name: a random 15-character name prefixed with pkros. - OS Disk Name: a random 15-character name prefixed with pkros.
- Data Disk Name: a random 15-character name prefixed with pkrdd.
- Resource Group Name: a random 33-character name prefixed with - Resource Group Name: a random 33-character name prefixed with
packer-Resource-Group-. packer-Resource-Group-.
- Subnet Name: a random 15-character name prefixed with pkrsn. - Subnet Name: a random 15-character name prefixed with pkrsn.

@ -243,7 +243,7 @@
once the build is completed, it has to be removed manually. once the build is completed, it has to be removed manually.
see [here](https://docs.microsoft.com/en-us/azure/virtual-machines/troubleshooting/boot-diagnostics) for more info see [here](https://docs.microsoft.com/en-us/azure/virtual-machines/troubleshooting/boot-diagnostics) for more info
- `custom_resource_build_prefix` (string) - specify custom azure resource names during build limited to max 10 charcters - `custom_resource_build_prefix` (string) - specify custom azure resource names during build limited to max 10 characters
this will set the prefix for the resources. The actuall resource names will be this will set the prefix for the resources. The actuall resource names will be
`custom_resource_build_prefix` + resourcetype + 5 character random alphanumeric string `custom_resource_build_prefix` + resourcetype + 5 character random alphanumeric string

Loading…
Cancel
Save