Adrien Delorme
aae1992649
remove default PauseBeforeSSM, this will have to be set manually
2020-10-29 13:38:03 +01:00
Adrien Delorme
6c45f04467
Delete ssm_mock_funcs.go
2020-10-29 13:37:44 +01:00
Adrien Delorme
5d06a6e6df
rename file correctly
2020-10-29 13:26:09 +01:00
Adrien Delorme
c6e2dd5538
remove unit test file for now, I think that an acceptance test will be easier here
2020-10-29 13:22:17 +01:00
Adrien Delorme
a4bd744955
simplify things a bit more
2020-10-29 13:11:07 +01:00
Adrien Delorme
aef3d24213
Update step_create_ssm_tunnel.go
2020-10-29 12:31:01 +01:00
Adrien Delorme
f329cb5b93
simplify code
2020-10-29 12:18:41 +01:00
Adrien Delorme
b058de072a
move packer/builder/amazon/common.IsAWSErr to builder/amazon/common/awserrors.Matches
...
to avoid cyclic dependency issues
2020-10-29 12:02:41 +01:00
Adrien Delorme
8e355d0fe7
Move ssm code to its own ssm package and make it singlethreaded
2020-10-29 11:57:29 +01:00
Wilken Rivera
646b973bd3
Remove logic to retry a connection that reuses an existing SSM Session
...
After testing it was found that once an session is terminated via an
instance restart, console termination, or SSM agent restart. Any active
session will essentially be terminated and unusable. So knowing that it
is always best to start a new session and let the old one timeout get
terminated.
2020-10-28 06:36:23 -04:00
Wilken Rivera
dff9cde775
Remove waitgroups
2020-10-28 06:36:23 -04:00
Wilken Rivera
eb11009e2a
Check for closed channels as opposed to using a separate closeRetry channel
2020-10-28 06:36:23 -04:00
sylviamoss
aa73cc7d7e
add close chan to avoid unwanted retries
2020-10-27 16:32:20 -04:00
sylviamoss
1f62249097
add retry terminated session chan
2020-10-27 16:32:20 -04:00
sylviamoss
8e3f3e514c
improve logs
2020-10-27 16:32:20 -04:00
sylviamoss
b2c7897f58
add WaitGroup to avoid data race
2020-10-27 16:32:20 -04:00
sylviamoss
1c2b469acd
add retry channel to ssm driver
2020-10-27 16:32:19 -04:00
Megan Marsh
b8e6e2c081
Merge pull request #10085 from 10000coins/f-aws-tenancy
...
builder/amazon: Support for source instance tenancy
2020-10-19 12:49:07 -07:00
Evan Pipho
608307cd1e
Re-allow spot + tenancy. Validate tenancy is set to a usable value
2020-10-16 21:43:22 +00:00
Evan Pipho
d5d1a8708e
Add tests for Tenancy vs Spot Price
2020-10-16 21:43:22 +00:00
Evan Pipho
6967e02103
Add support for source instance tenancy to amazon builders
2020-10-16 21:43:22 +00:00
Matt Rogers
15f97421e2
builder/amazon: Add io2 as a supported volume type
...
io2 volumes are new as of 2020-08-24. This adds support for specifying
them in a packer template and having the iops value specified take
effect.
2020-10-14 09:01:17 -05:00
Megan Marsh
4c0ac6917e
switch to using aws base config, which means we're using code tested and maitnained by the terraform crowd.
2020-09-29 14:26:38 -07:00
Sylvia Moss
96e3def294
Add pause_before_ssm config to pause before establishing the Session Manager session ( #9988 )
2020-09-25 10:19:19 +02:00
Megan Marsh
d66b358100
Merge pull request #9991 from hashicorp/b-amazon-ssm-infinite-loop
...
amazon/ssm_driver: Update log polling logic
2020-09-24 09:55:39 -07:00
Wilken Rivera
2f2b5683a2
amazon/ssm_driver: Update log polling logic
...
This change checks for closed iochans related to the log polling
function and will break out of the loop when both channels are closed.
Which is an indicator that the SSM session has been terminated by some
external process. This fixes an issue where Packer hangs, due to the
infinite loop, when an SSM session is killed outside of Packer.
Related to #9442
2020-09-24 10:19:37 -04:00
Megan Marsh
429d431365
Implement assume_role for Packer. This functionality is copied shamelessly
...
from the Terraform AWS provider
2020-09-23 13:18:26 -07:00
Sylvia Moss
d347bbec4c
Retry fleet creating only on invalid IAM instance profile ( #9946 )
2020-09-18 17:05:36 +02:00
Adrien Delorme
0d0bd9ce75
name fields of PolicyDocument correctly in HCL ( #9812 )
...
withouth this fix we would have had to do
```hcl
temporary_iam_instance_profile_policy_document {
statement {
action = ["*"]
effect = "Allow"
resource = ["*"]
}
version = "2012-10-17"
}
```
instead of the same document but with capitalised fields
2020-08-25 10:53:56 +02:00
Adrien Delorme
a0c09e85df
retry spot instance creation when an "Invalid IAM Instance Profile name" error pops up ( #9810 )
...
PutRolePolicy & AddRoleToInstanceProfile are eventually consistent but it is not possible to wait for them to be done here: 0785c2f6fc/builder/amazon/common/step_iam_instance_profile.go (L117-L134)
which was causing the `CreateFleet` to fail (100% for me). So for now we retry a bit later. Waiting 5 seconds after the previously linked code also fixed this.
Test file:
```json
{
"builders": [
{
"type": "amazon-ebs",
"region": "eu-west-1",
"ami_name": "ubuntu-16.04 test {{timestamp}}",
"ami_description": "Ubuntu 16.04 LTS - expand root partition",
"source_ami_filter": {
"filters": {
"virtualization-type": "hvm",
"name": "ubuntu/images/*/ubuntu-xenial-16.04-amd64-server-*",
"root-device-type": "ebs"
},
"owners": [
"099720109477"
],
"most_recent": true
},
"spot_price": "0.03",
"spot_instance_types": [
"t2.small"
],
"encrypt_boot": true,
"ssh_username": "ubuntu",
"ssh_interface": "session_manager",
"temporary_iam_instance_profile_policy_document": {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"*"
],
"Resource": "*"
}
]
},
"communicator": "ssh"
}
]}
```
2020-08-25 10:10:32 +02:00
sylviamoss
1a0d5a93ee
fix max_attempts typo
2020-08-17 17:58:22 +02:00
sylviamoss
788dc32598
add aws_polling config option to override env variables
2020-08-17 17:15:32 +02:00
Megan Marsh
8b4993e44c
fix docs for kms key ids ( #9766 )
2020-08-14 11:35:35 +02:00
Megan Marsh
54469c4728
Add all of the custom AWS template engines to GeneratedData for use b… ( #9751 )
2020-08-12 10:43:15 +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
a56942d3c7
change isAwsErr to an exported func so I can use it in other aws modules.
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
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
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
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