Commit Graph

1256 Commits

Author SHA1 Message Date
Etan Reisner a28edbaa0b
Fix skip_save_build_region in the ebssurrogate builder. (#9666) 2020-07-31 16:01:46 -04:00
Megan Marsh a687d6fe12
ci/tech-debt: Fix vmware acceptance tests (#9636)
* add kex algorithm option to ssh config

* regenerate code

* This commit fixes old vmware acceptance tests that have not been run in some time. It does this in two parts:
1) It modifies the minimal vmware build configuration to use a custom kex algorithm, which enables the ssh connection to succeed.
2) It modifies logic in reading and defaulting hardware config values, which was crashing.
3) It adds a new acceptance test with a preseed file to test loading from an http directory.
2020-07-23 09:40:57 +02:00
Megan Marsh f9df185ef1
Merge pull request #9579 from hashicorp/fix_9562
wrap CreateImage call in a retry to account for eventual consistencey…
2020-07-22 08:43:10 -07:00
Megan Marsh 1f3b3f8fd9 change retry func to a 15 min timeout 2020-07-21 15:55:39 -07:00
Megan Marsh a56942d3c7 change isAwsErr to an exported func so I can use it in other aws modules. 2020-07-21 15:30:45 -07:00
Megan Marsh 036ea238bf wrap CreateImage call in a retry to account for eventual consistencey issues with image state 2020-07-21 15:30:45 -07:00
Adrien Delorme 810f161d22 builder/amazon/common/block_device.go: replace tabs with words 2020-07-20 16:34:13 +02:00
Adrien Delorme 966b17d2b5 builder/amazon/common/access_config.go: replace tabs with words 2020-07-20 16:31:23 +02:00
Adrien Delorme 5c4901c2c2 builder/amazon/common/run_config.go: replace tabs with words 2020-07-20 16:28:14 +02:00
Adrien Delorme 1455a29f2b remove tabs for security_group_filter too 2020-07-20 16:24:47 +02:00
Adrien Delorme 191094edcc better `disable_stop_instance` docs 2020-07-20 16:21:43 +02:00
Megan Marsh 530f5e3f63 more additions to partials 2020-07-17 15:52:11 -07:00
Megan Marsh a1651977b3 add tabs to generated docs from access_config and run_config structs 2020-07-17 15:10:55 -07:00
Roger Hu 28f8241a05 update generated files 2020-07-10 16:58:06 -07:00
Megan Marsh 4d3b2cea96
Merge pull request #9480 from adongy/master
aws: retry fetching blockdevicemapping if empty
2020-07-08 12:32:12 -07:00
Megan Marsh a885e620ee don't error for no mappings if no mappings were set. 2020-07-08 11:55:56 -07:00
Moss 8ea64c5b35 undocument ssh_keypair_name and ssh_agent_auth 2020-07-02 14:55:58 +02:00
Moss 41edd09d3c undocument temporary_key_pair_name and ssh_private_key_file 2020-07-01 16:33:18 +02:00
Megan Marsh 122e80f591 generated code 2020-06-30 10:12:50 -07:00
Megan Marsh 0122530a07 make statement an array of strings 2020-06-30 10:01:49 -07:00
Anthony Dong 2322d3ae6b aws: retry fetching blockdevicemapping if empty 2020-06-25 10:48:24 +02:00
Wilken Rivera a8dfb66d6c docs/builder/amazon: Add WinRM unsupported note to Session Manager docs
Closes #9451

Co-authored-by: Adrien Delorme <azr@users.noreply.github.com>
2020-06-23 07:41:21 -04:00
Adrien Delorme b2320ca911
HCL2: add singular run_volume_tag block to ebs & ebssurrogate builders (#9457)
close #9280
related to #8889
2020-06-23 10:49:50 +02: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
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
nitrocode 6d29ec956b Added SourceAMICreationDate 2020-05-26 15:04:03 -04:00
Wilken Rivera b5639d4697
tests/builder/amazon: Enhance the test coverage for SSM Tunnel related steps (#9213)
* test/builder/amazon: Update mocks to properly test SSM tunnel and driver code base

* Update mod files
2020-05-13 10:10:55 -04:00
Wilken Rivera 6f5f6bf999 builder/amazon Fix invalid pointer issue for non SSMAgengtEnabled builds
Tests before change
```
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1392ca2]

goroutine 299 [running]:
github.com/hashicorp/packer/builder/amazon/common.(*StepCreateSSMTunnel).Cleanup(0xc0003dc460, 0x4d1a4c0, 0xc0006e9800)
        /home/wilken/Development/packer/builder/amazon/common/step_create_ssm_tunnel.go:95 +0xf2
github.com/hashicorp/packer/helper/multistep.(*BasicRunner).Run(0xc0006e98f0, 0x4d408c0, 0xc00065fcc0, 0x4d1a4c0, 0xc0006e9800)
        /home/wilken/Development/packer/helper/multistep/basic_runner.go:79 +0x2c6
github.com/hashicorp/packer/builder/amazon/ebs.(*Builder).Run(0xc000726800, 0x4d408c0, 0xc00065fcc0, 0x4d5e300, 0xc0006e8d80, 0x4cc7220, 0xc000434120, 0x0, 0x0, 0x0, ...)
        /home/wilken/Development/packer/builder/amazon/ebs/builder.go:330 +0x17e2
github.com/hashicorp/packer/packer.(*CoreBuild).Run(0xc000720500, 0x4d408c0, 0xc00065fcc0, 0x4d5e180, 0xc0006fe510, 0x0, 0x0, 0x0, 0x0, 0x0)
        /home/wilken/Development/packer/packer/build.go:287 +0x7ef
github.com/hashicorp/packer/command.(*BuildCommand).RunContext.func1(0xc0004d14d0, 0xc0003dc3c0, 0xc000441500, 0xa, 0x4d5e1e0, 0xc000720500, 0x4d408c0, 0xc00065fcc0, 0x4d5e180, 0xc0006fe510, ...)
        /home/wilken/Development/packer/command/build.go:290 +0x189
created by github.com/hashicorp/packer/command.(*BuildCommand).RunContext
        /home/wilken/Development/packer/command/build.go:284 +0xd5a
FAIL    github.com/hashicorp/packer/provisioner/shell   188.335s
FAIL
```

Test After change
```
--- PASS: TestShellProvisioner (212.39s)
    --- PASS: TestShellProvisioner/testing_amazon-ebs_builder_against_shell_provisioner (212.39s)
PASS

```
2020-05-12 14:49:57 -04:00
Wilken Rivera 89fb7bb080 Apply suggestions from code review
Co-authored-by: Megan Marsh <megan@hashicorp.com>
2020-05-08 09:36:43 -04:00
Wilken Rivera 056f1f6e76 docs/amazon/builder: Add not about using a temporary_iam_instance_profile_policy_document 2020-05-08 09:32:54 -04:00
Wilken Rivera bf1da57a05 Update address to localhost to be consistent with other proxies 2020-05-08 09:32:54 -04:00
Wilken Rivera 7cea7466ba buider/amazon: Add `session_manager_port` option for setting a custom local port 2020-05-08 09:32:54 -04:00
Wilken Rivera 0d13c634b7 Update logging constructs for Session Manger driver 2020-05-08 09:32:49 -04:00
Wilken Rivera 81c40b8d08 Add section to docs about the session-manager-plugin tunnel 2020-05-08 09:32:49 -04:00
Wilken Rivera 5f68303504 Remove no longer needed port check
The communicator code base will default to the correct port settings for
valid communicators and fail the build for non valid communicators.
2020-05-08 09:32:49 -04:00
Wilken Rivera 3ae7ab994b step_create_ssm_tunnel: Add port availability check for LocalPortNumber 2020-05-08 09:32:49 -04:00
Wilken Rivera 08dc2cb847 Remove call to unstubbed session start 2020-05-08 09:32:49 -04:00
Wilken Rivera f498866c3a Update validation for session_manager connectivity
Validation will now check that either a IamInstanceProfile or a TemporaryIamInstanceProfilePolicyDocument is set
2020-05-08 09:32:49 -04:00
Wilken Rivera 2f09b74587 amazon/builder: Move port validation for security group into RunConfig.Prepare 2020-05-08 09:32:48 -04:00
Wilken Rivera 3f6b28b70c Add SSMTunnel step to other amazon builders, minus chroot 2020-05-08 09:32:48 -04:00
Wilken Rivera 743df19af2 Add tests for driver and ssm tunnel step 2020-05-08 09:32:48 -04:00
Wilken Rivera e53d6aea66 amazon/ssm_driver: Update to support command context
* Defer the release of the found port to prevent possible Packer build collisions.
2020-05-08 09:32:48 -04:00
Wilken Rivera 5e14089851 tests/builder/amazon: Add basic testing for session_manager
* Add a test to ensure the proper host is returned when using session_manager
* Add a basic driver test for the validating that the SSMDriver will fail if the plugin is not in the path.
2020-05-08 09:32:48 -04:00
Wilken Rivera 60e0ba7e68 Update iam instance profile name 2020-05-08 09:32:48 -04:00
Wilken Rivera d5a0262d6c builder/amazon/instance: Add session manager support 2020-05-08 09:32:48 -04:00
Wilken Rivera e515aefee3 Add validation checks for session_manager
* Session manager connectivity only supported via SSH
* Session manager requires the use of an iam instance profile with system manager permissions
2020-05-08 09:32:48 -04:00
Wilken Rivera c1d2477d18 builder/amzon: Update port configuration for WinRM
Connectivity for WinRM works for the initial connection, but fails to upload any provisioning scripts - need to dive in deeper.
For now connectivity over SSH works as expected.
2020-05-08 09:32:48 -04:00
Wilken Rivera fbffbd1899 docs/builder/amazon: Add short blurb for connecting via the AWS session_manager interface 2020-05-08 09:32:48 -04:00
Wilken Rivera 520061dee6 builder/amazon: Update Session Manger connectivity
* Update security group creation step skip ingress rules if using session manager
* Update create ssm tunnel step to dynamically set a session port
* Add SSHPort function to common to return session-manager tunnel port
* Update SSHHost to return proper host for session-manager
2020-05-08 09:32:48 -04:00