Before change
```
⇶ packer build amazon-ebs_secretsmanager_shell-local.json
Error:
template: root:1:3: executing "root" at <aws_secretsmanager `packer/test/keys`
`shell`>: error calling aws_secretsmanager: ResourceNotFoundException: Secrets
Manager can't find the specified secret value for staging label: shell
2020/10/30 12:53:40 [INFO] (telemetry) Finalizing.
template: root:1:3: executing "root" at <aws_secretsmanager `packer/test/keys`
`shell`>: error calling aws_secretsmanager: ResourceNotFoundException: Secrets
Manager can't find the specified secret value for staging label: shell
⇶ packer build amazon-ebs_secretsmanager_shell-local.json.pkr.hcl
Error: Error in function call
on amazon-ebs_secretsmanager_shell-local.json.pkr.hcl line 28:
(source code not available)
Call to function "aws_secretsmanager" failed: ResourceNotFoundException: Secrets
Manager can't find the specified secret value for staging label: home.
```
After change
```
⇶ packer.test build amazon-ebs_secretsmanager_shell-local.json
null: output will be in this color.
==> null: Running local shell script: /tmp/packer-shell463393820
null: boo
null: keys:powershell
Build 'null' finished after 8 milliseconds 225 microseconds.
==> Wait completed after 8 milliseconds 319 microseconds
==> Builds finished. The artifacts of successful builds are:
--> null: Did not export anything. This is the null builder
⇶ packer.test build amazon-ebs_secretsmanager_shell-local.json.pkr.hcl
null.autogenerated_1: output will be in this color.
==> null.autogenerated_1: Running local shell script: /tmp/packer-shell834410761
null.autogenerated_1: boo
null.autogenerated_1: keys:powershell
Build 'null.autogenerated_1' finished after 18 milliseconds 834 microseconds.
==> Wait completed after 18 milliseconds 954 microseconds
==> Builds finished. The artifacts of successful builds are:
--> null.autogenerated_1: Did not export anything. This is the null builder
```
* hcl2template/addrs.ParseRef will parse a reference and tell for example if we
are referring to a variable and its name, for now it can only do that and in
the future it improved when we need to most of it is from the TF code. This
is used to tell wether a variable vas referenced in a variable validation
condition; for now.
* Added Validations blocks to the hcl2 Variable struct and code to
parse/validate that.
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.
* respect the destroy flag in content library config
* Make vsphere-clone respect delete_vm state tag; use a common delete func to prevent future drift
* add the possibility to set the packer.required_version field; to make sure the template file works with that version of Packer
* add tests
* add documentation on packer.required_version
Example:
packer {
required_version = ">= 1.2.0, < 2.0.0"
}