skip_save_build_region does not work
- Dominant language
- Go
- Stars
- 15.8k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
#### Overview of the Issue
we have one region where default VPC is available, but when we build AMIs we want them to appear at different region. After the build is finished we do not expect/we do not want to keep the original AMI here. From the doc https://developer.hashicorp.com/packer/integrations/hashicorp/amazon/latest/components/builder/ebs it looks like `ami_regions` and `skip_save_build_region` does what we want.
> If true, Packer will not check whether an AMI with the ami_name exists in the region it is building in.
But here is the issue. packer does not check build region it is Ok. But all `ami_regions` should be checked before the build.
It should not create AMIs with the same name:
#### Reproduction Steps
```
source "amazon-ebs" "nomad_ami" {
region = "us-east-1"
ami_regions = "us-west-2"
skip_save_build_region = true
force_deregister = true
force_delete_snapshot = true
...
```
also output should not contain AMI from build VPC, because it was deleted:
```
Build 'amazon-ebs.nomad_ami' finished after 8 minutes 17 seconds.
==> Wait completed after 8 minutes 17 seconds
==> Builds finished. The artifacts of successful builds are:
--> amazon-ebs.nomad_ami: AMIs were created:
us-east-2: ami-XXX
us-west-1: ami-RRR
```
### Packer version
v1.14.2
### Simplified Packer Template
If the file is longer than a few dozen lines, please include the URL to the
[gist](https://gist.github.com/) of the log or use the [Github detailed
format](https://gist.github.com/ericclemmons/b146fe5da72ca1f706b2ef72a20ac39d)
instead of posting it directly in the issue.
### Operating system and Environment details
OS, Architecture, and any other information you can provide about the
environment.
### Log Fragments and crash.log files
Include appropriate log fragments. If the log is longer than a few dozen lines,
please include the URL to the [gist](https://gist.github.com/) of the log or
use the [Github detailed format](https://gist.github.com/ericclemmons/b146fe5da72ca1f706b2ef72a20ac39d) instead of posting it directly in the issue.
Set the env var `PACKER_LOG=1` for maximum log detail.
Contributor guide
Assessment
This issue has not been assessed yet.