556 Commits

Author SHA1 Message Date
Paul Meyer
f601f54d0b Use all disks in managed image 2020-05-28 23:37:43 +00:00
Paul Meyer
de4839b66e Use all snapshots when creating a shared image 2020-05-28 23:37:43 +00:00
Paul Meyer
c6b995a34d create snapshots for all disks in a diskset 2020-05-28 23:37:43 +00:00
Paul Meyer
0ee77f8b0e Add datadisks to disk set when using SIG as source 2020-05-28 23:37:43 +00:00
Paul Meyer
12f746b2b5 Move to using a diskset
Need to store lun numbers for data disks as well
2020-05-28 23:37:43 +00:00
Paul Meyer
3a3e6e525b Shift names to diskset
Instead of one disk, we'll be working with a set of disks.
2020-05-28 23:37:43 +00:00
Paul Meyer
c9284d03aa Add config for data disk/snapshot naming 2020-05-28 23:37:38 +00:00
Adrien Delorme
40947c2bf6
HCL2: generate hcl tags with go-cty tags too (#9306)
This will allow to generate the config files:

```go
package main

import (
	"fmt"

	"github.com/hashicorp/hcl/v2/gohcl"
	"github.com/hashicorp/hcl/v2/hclwrite"
	"github.com/hashicorp/packer/builder/alicloud/ecs"
)

func main() {
	name := "name"
	app := ecs.FlatConfig{
		AlicloudImageName: &name,
		ECSSystemDiskMapping: &ecs.FlatAlicloudDiskDevice{
			DiskName: &name,
		},
	}

	f := hclwrite.NewEmptyFile()
	block := gohcl.EncodeAsBlock(&app, `source "something" "something"`)
	f.Body().AppendBlock(block)
	fmt.Printf("%s", f.Bytes())
}

```

Will output:

```
source "something" "something" {
  packer_user_variables      = null
  packer_sensitive_variables = null
  image_name                 = "name"
  image_share_account        = null
  image_unshare_account      = null
  image_copy_regions         = null
  image_copy_names           = null
  tags                       = null
  tag                        = null
  system_disk_mapping        = { disk_category = null, disk_delete_with_instance = null, disk_descri
ption = null, disk_device = null, disk_encrypted = null, disk_name = "name", disk_size = null, disk_
snapshot_id = null }
  image_disk_mappings        = null
  ssh_remote_tunnels         = null
  ssh_local_tunnels          = null
  ssh_public_key             = null
  ssh_private_key            = null
}
```

This is a good first step for #9015 and #9282 

fix #9304
2020-05-28 11:19:00 +02:00
Feiyu Shi
fdb0b2ab03 Revert "validate if user assigned identity exists"
This reverts commit 9bd19df04095b75517b0858207e941e6b27e4a58.
2020-05-26 17:17:48 -07:00
Feiyu Shi
c016f3752a upgrade SIG source api-version to match identity api-version to avoid potential setback for identity 2020-05-26 16:08:00 -07:00
Feiyu Shi
3fdab998f8 check error 2020-05-25 12:33:33 -07:00
Feiyu Shi
9bd19df040 validate if user assigned identity exists 2020-05-24 19:05:46 -07:00
Feiyu Shi
b334458b91 use empty struct for UserAssignedIdentities map value; omitempty 2020-05-24 19:05:45 -07:00
Feiyu Shi
c5e2eff847 change to []*Resource 2020-05-24 19:05:45 -07:00
Feiyu Shi
3e3fdaa24e make generate 2020-05-24 19:05:45 -07:00
Feiyu Shi
76a7ab25e2 add SetIdentity test 2020-05-24 19:05:45 -07:00
Feiyu Shi
764f99ec7b add correct api-version 2020-05-24 19:05:45 -07:00
Feiyu Shi
f7f033a7fd add config validation test 2020-05-24 19:05:45 -07:00
Feiyu Shi
10b0a4548f add identity resource id validation 2020-05-24 19:05:45 -07:00
Feiyu Shi
7c1a62dfed set identity field in the template 2020-05-24 19:05:45 -07:00
Feiyu Shi
d9c9bfbae8 add identity field to the template 2020-05-24 19:05:45 -07:00
Feiyu Shi
b5b2982772 add user_assigned_managed_identities to the config 2020-05-24 19:05:45 -07:00
Megan Marsh
58b32ebefa
Merge pull request #9251 from hashicorp/fix_9249
builder/azure-arm: Update runtime constants with a valid DataDiskName
2020-05-19 11:00:44 -07:00
Sylvia Moss
1c30a71d09
Replace file shared state by statebag (#9238) 2020-05-19 11:49:48 +02:00
Wilken Rivera
c954831bb2 builder/azure-arm: Update runtime constants with a valid DataDiskName
This change fixes an issue where using the `disk_additional_size` configuration option would cause builds to fail.

Build results before the change
```
==> Builds finished but no artifacts were created.
Build 'azure-arm' errored: Code="DeploymentFailed" Message="At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/DeployOperations for usage details." Details=[{"code":"BadRequest","message":"{\r\n  \"error\": {\r\n    \"code
\": \"InvalidParameter\",\r\n    \"message\": \"The entity name 'dataDisk.name' is invalid according to its validation rule: ^[^_\\\\W][\\\\w-._]{0,79}(?\u003c![-.])$.\",\r\n    \"target\": \"dataDisk.name\"\r\n  }\r\n}"}]

```

Build results after change
```
Build 'azure-arm' finished.

==> Builds finished. The artifacts of successful builds are:
--> azure-arm: Azure.ResourceManagement.VMImage:

OSType: Linux
ManagedImageResourceGroupName: test-pkr
ManagedImageName: wilkenPacker9249
```

Closes #9249
2020-05-18 14:57:20 -04:00
Wilken Rivera
f31f5bc61b docs/builder/azure-arm: Fix a small typo for the custom_managed_image_* config options
Closes #9199
2020-05-14 13:31:40 -04:00
Evan Digby
e4eaff6bba
s/Directoty/Directory (#9221) 2020-05-14 15:00:27 +02:00
Megan Marsh
7e0cfd8b77 add undocumented tag to struct-markdown generator so that we can leave internal-use-only fields out of docs 2020-05-01 10:31:38 -07:00
Wilken Rivera
86ab71f56e
test/azure/arm: Add regression test case for ssh_username overrides (#9136)
This test is for the regression fixed in #9103

Before fix
```
⇶  go test ./builder/azure/arm/... -run=TestConfigUserNameOverride
--- FAIL: TestConfigUserNameOverride (0.42s)
    config_test.go:75: Expected 'c.Comm.SSHPassword' to be set to generated password, but found ""!
    config_test.go💯 Expected 'UserName' to be set to 'override_winrm_username', but found "packer"!
FAIL
FAIL    github.com/hashicorp/packer/builder/azure/arm   0.425s
FAIL

```

After fix
```
⇶  go test ./builder/azure/arm/... -run=TestConfigUserNameOverride
ok      github.com/hashicorp/packer/builder/azure/arm   0.379s
```

* Fix variable names in error messages
2020-04-30 10:49:58 +02:00
Wilken Rivera
e0d2f4fd69
builder/azure-arm: Fix SSH connection for temporary admin users specified in ssh_username (#9103) 2020-04-23 11:04:49 +02:00
Paul Meyer
26d768f429
[builder/azure-chroot] Shared image source (#9070) 2020-04-23 11:03:17 +02:00
Lars Lehtonen
ab119d3270
builder/azure/chroot: fix dropped error (#9106) 2020-04-23 10:53:13 +02:00
Adrien Delorme
da4a5224be
HCL2 singular blocks: use key/value or name/value depending on how the service names things (#9078)
* make sure keyvalue and namevalue filters are using the same naming as the service being used

* make docs a bit more readable for KeyValues too

* Update website/pages/docs/from-1.5/expressions.mdx

Co-Authored-By: Megan Marsh <megan@hashicorp.com>

Co-authored-by: Megan Marsh <megan@hashicorp.com>
2020-04-23 10:46:49 +02:00
Matthew Sanabria
761abdda4e
Updating documentation for azure-arm builder (#9097) 2020-04-21 10:47:48 +02:00
vijayrajah
5d2fee04b2
builder/azure: enable boot Diagnostics (#9053)
* enable boot Diagnostics
2020-04-20 07:29:13 -04:00
Paul Meyer
89f3aa0bd6
[builder/azure-arm] Use VM/build location for image location (#9068)
* [builder/azure-arm] Use VM/build location for image locationThe builder was using the location of the containing resource group asthe image location, but the API call can only create images in the samelocation as the source VM that is being captured.
2020-04-17 05:43:03 -04:00
Megan Marsh
08787ba31f
Merge pull request #9028 from vijayrajah/set_azure_custom_res_names
Set Custom Resource Names for Azure-Arm builds
2020-04-16 15:58:41 -07:00
Vijay Rajah
da7382980a Fix failing test & format code 2020-04-17 00:17:39 +05:30
vijayrajah
fff06353b7
Update builder/azure/arm/tempname.go
refactor the code.. thanks for the suggestion @sylviamoss

Co-Authored-By: Sylvia Moss <sylviamoss.m@gmail.com>
2020-04-17 00:04:39 +05:30
Adrien Delorme
73242e8de4 make sure keyvalue and namevalue filters are using the same naming as the service being used 2020-04-16 17:22:13 +02:00
Adrien Delorme
840e67f775
HCL2: when we see a map generate an attribute spec instead of a block spec (#9035)
* mapstructure-to-hcl2: when we see a map generate an attribute spec and not a block spec

this will alow to do

tags = {
 key = "value"
}

instead of

tags {
  key = "value"
}

This will also enable using variables directly for those tags

* generate code

* update tests
2020-04-14 16:05:13 +02:00
Paul Meyer
621bd8ccac Fix error message grammar 2020-04-09 20:55:10 +00:00
Paul Meyer
89a8238a07 Fix artifact output 2020-04-09 20:54:50 +00:00
Paul Meyer
47107e6355 Default polling delay 5 sec 2020-04-09 20:37:23 +00:00
Vijay Rajah
9209826bfe Update the doc with more info 2020-04-10 00:34:56 +05:30
Paul Meyer
4ffe5611b8 Add more tests 2020-04-08 21:05:26 +00:00
Vijay Rajah
1e66a1b355 Fix linting & code generation 2020-04-09 00:00:13 +05:30
Vijay Rajah
56bf8bd686 Merge branch 'set_azure_custom_res_names' of github.com:vijayrajah/packer into set_azure_custom_res_names 2020-04-08 23:54:21 +05:30
vijayrajah
a3c580f2ac
Merge branch 'master' into set_azure_custom_res_names 2020-04-08 23:51:58 +05:30
Vijay Rajah
53f54000e6 generate spec & fix typo 2020-04-08 23:42:49 +05:30