Commit Graph

331 Commits

Author SHA1 Message Date
Wilken Rivera 8d209caf34 Fix spacing and line endings 2020-06-24 09:20:32 -04:00
Arsenii Petrovich f3c33f9a27 remove spaces 2020-06-24 16:08:48 +03:00
Arsenii Petrovich c2f352ee6e Update JSONs to fix tests and make them work with the latest URL changes 2020-06-24 01:35:35 +03:00
Megan Marsh 4f77bb0c4a add new ssh_ciphers option 2020-06-17 16:48:23 -07:00
Megan Marsh 4178625afb re-add winrm_no_proxy option. Winrm code needs to be modified in order to read no_proxy env var when client is created rather than when net/http library is instantiated. 2020-06-16 10:27:30 -07:00
Jeff Escalante 9a38fbe2c7
patch source for a couple code block changes 2020-05-29 17:22:16 -04:00
Feiyu Shi 1c1991c073 fix a bug 2020-05-28 19:17:22 -07:00
Feiyu Shi f86f5b958a Merge remote-tracking branch 'origin/master' into identity 2020-05-28 19:03:44 -07: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 9bd19df040.
2020-05-26 17:17:48 -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 3e3fdaa24e make generate 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 b5b2982772 add user_assigned_managed_identities to the config 2020-05-24 19:05:45 -07: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
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
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
Vijay Rajah 9209826bfe Update the doc with more info 2020-04-10 00:34:56 +05:30
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
Jeff Escalante 9165be87da
packer.io prefix removal, html extension remove for in-code errors 2020-04-07 17:53:22 -04:00
Jeff Escalante 4afd107eeb
patch source files for extensions changes 2020-04-07 17:50:51 -04:00
Vijay Rajah cd41ad1a40 change resource names 2020-04-07 02:17:50 +05:30
Vijay Rajah 1314d69b51 fix typo (add missing ')]' ) 2020-04-06 11:40:05 +05:30
Vijay Rajah 0589f57d4d Update tests for datadisk name change 2020-04-05 01:16:24 +05:30
vijayrajah aba9797730
Fix :: allow Managed data disks to be used with azure shared image gallery image Sources (#8912) 2020-04-03 10:18:02 +02:00
Vijay Rajah 5340af4d49 Merge remote-tracking branch 'upstream/master' into feature/datadisk-change_name 2020-04-02 21:53:47 +05:30
Vijay Rajah d82475566a change datadisk names -- WIP 2020-04-02 21:28:38 +05:30
Sylvia Moss e6368b9246
Fix azure winrm_password attribution and allow to set winrm_username (#8928) 2020-03-24 14:43:24 +01:00
Vijay Rajah dd04108ac8 Fix :: allow Managed data disks to be used with azure shared image gallery image Sources 2020-03-19 12:11:34 +05:30
Megan Marsh 28797dd709 replace the homegrown vault delete functions in azure with the sdk ones. 2020-03-18 13:48:54 -07:00
Megan Marsh e7dba3e55e fix error cleaning up existing keyvault 2020-03-18 13:48:54 -07:00
Adrien Delorme 88297c796d Merge branch 'master' into hcl2_singular_blocks 2020-03-17 14:47:17 +01:00
Adrien Delorme b5e8750f5f Change key/value to name/value to remain consistent with Terraform 2020-03-17 11:23:11 +01:00