Aleksandr Serbin
0cf9b55c5c
amazon-ebs: validate IOPS ratio
2020-11-04 14:37:41 +01:00
Megan Marsh
845a10867e
Merge pull request #10003 from hashicorp/ssm_session_retry
...
Add retry mechanism to retry SSM session creation
2020-10-29 16:02:54 -07:00
Wilken Rivera
01d5e5ca76
test/amazon/ebs: Add acceptance test for Session Manager Interface connectivity
...
Test Results
```
...
2020/10/29 09:35:39 ui: test: Starting session with SessionId: wilken-00bcfae4d314f54e7
2020/10/29 09:35:40 [DEBUG] TCP connection to SSH ip/port failed: dial tcp [::1]:8047: connect: connection refused
2020/10/29 09:35:40 ui: test: Port 8047 opened for sessionId wilken-00bcfae4d314f54e7.
2020/10/29 09:35:45 [INFO] Attempting SSH connection to localhost:8047...
2020/10/29 09:35:45 [DEBUG] reconnecting to TCP connection for SSH
2020/10/29 09:35:45 ui: test: Connection accepted for session wilken-00bcfae4d314f54e7.
2020/10/29 09:35:45 [DEBUG] handshaking with SSH
2020/10/29 09:35:45 [DEBUG] SSH handshake err: ssh: handshake failed: ssh: invalid packet length, packet too large
2020/10/29 09:35:52 [INFO] Attempting SSH connection to localhost:8047...
2020/10/29 09:35:52 [DEBUG] reconnecting to TCP connection for SSH
2020/10/29 09:35:52 [DEBUG] handshaking with SSH
2020/10/29 09:35:52 [DEBUG] handshake complete!
2020/10/29 09:35:52 [DEBUG] Opening new ssh session
2020/10/29 09:35:53 [INFO] agent forwarding enabled
2020/10/29 09:35:53 ui: ==> test: Connected to SSH!
2020/10/29 09:35:53 Running the provision hook
2020/10/29 09:35:53 ui: ==> test: Stopping the source instance...
2020/10/29 09:35:53 ui: test: Stopping instance
2020/10/29 09:35:54 ui: ==> test: Waiting for the instance to stop...
2020/10/29 09:36:25 ui: ==> test: Creating AMI packer-ssm-test-1603978447 from instance i-0853cb6186a3406d5
2020/10/29 09:36:25 ui: test: AMI: ami-0868a41bbb2df77b3
2020/10/29 09:36:25 ui: ==> test: Waiting for AMI to become ready...
2020/10/29 09:37:59 ui: ==> test: Terminating the source AWS instance...
2020/10/29 09:37:59 ui error: ==> test: Bad exit status: -1
2020/10/29 09:38:15 ui: ==> test: Cleaning up any extra volumes...
2020/10/29 09:38:15 ui: ==> test: No volumes to clean up, skipping
2020/10/29 09:38:15 ui: ==> test: Deleting temporary security group...
2020/10/29 09:38:16 ui: ==> test: Deleting temporary keypair...
2020/10/29 09:38:16 Deregistering image ID (ami-0868a41bbb2df77b3) from region (us-east-1)
2020/10/29 09:38:17 Deregistered AMI id: ami-0868a41bbb2df77b3
2020/10/29 09:38:17 Deleted snapshot: snap-09602f15994bc9f51
--- PASS: TestBuilderAcc_SessionManagerInterface (249.87s)
PASS
```
2020-10-29 09:39:19 -04:00
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
Adrien Delorme
f5e037e8b4
Merge remote-tracking branch 'origin/master' into azr_selectable_temp_keygen_type_gcp
2020-10-26 15:47:29 +01:00
Megan Marsh
25f4e24772
Merge pull request #10150 from nshalman/nshalman/tag-snapshots
...
amazon/ebssurrogate: apply snapshot tags right when taking snapshot
2020-10-23 15:57:18 -07:00
Megan Marsh
c0ce8a9414
rework fixer deprecation code so we know what plugins they relate to
2020-10-21 15:28:59 -07:00
Nahum Shalman
83a672f2c9
amazon/ebssurrogate: apply snapshot tags right when taking snapshot
2020-10-21 16:17:37 -04:00
Adrien Delorme
522d122858
regen all code
2020-10-21 12:04:10 +02:00
Adrien Delorme
f51b231c17
Merge remote-tracking branch 'origin/master' into azr_selectable_temp_keygen_type_gcp
2020-10-20 16:39:01 +02: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
Adrien Delorme
54032d6c11
gen code and docs
2020-10-15 16:51:23 +02: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
Anthony Dong
eca9b2f30d
aws ebs_surrogate: fix unhonored kms_key_id ( #9959 )
2020-09-18 12:39:07 +02:00
catsby
7a7d3ff350
Remove comments about sharing with catsby
2020-09-03 09:14:40 -05:00
Rae Krantz
ab23e839c8
update sharing test to req aws account id
2020-09-02 11:44:38 -04: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
8f362656ee
Update builder/amazon/ebs/step_create_ami.go
...
Co-authored-by: Wilken Rivera <dev@wilkenrivera.com>
2020-08-07 08:02:57 -07:00
Megan Marsh
484dbfe6ad
improve error handling when waiting for image so that the resourcenotready error is bubbled up more clearly without verbose logging turned on
2020-08-06 14:58:05 -07:00
Etan Reisner
a28edbaa0b
Fix skip_save_build_region in the ebssurrogate builder. ( #9666 )
2020-07-31 16:01:46 -04:00