Skip to content

Commit

Permalink
Add support for arm64_mac architecture
Browse files Browse the repository at this point in the history
  • Loading branch information
jaysoffian authored and lbajolet-hashicorp committed Jun 20, 2024
1 parent dae26ee commit 3c9034f
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .web-docs/components/builder/chroot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ necessary for this build to succeed and can be found further down the page.
prefix `kms_key_id` with `alias/`.

- `ami_architecture` (string) - what architecture to use when registering the final AMI; valid options
are "arm64", "i386", "x86_64", or "x86_64_mac". Defaults to "x86_64".
are "arm64", "arm64_mac", "i386", "x86_64", or "x86_64_mac". Defaults to "x86_64".

- `boot_mode` (string) - The boot mode. Valid options are `legacy-bios` and `uefi`. See the documentation on
[boot modes](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ami-boot.html) for
Expand Down
2 changes: 1 addition & 1 deletion .web-docs/components/builder/ebssurrogate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ necessary for this build to succeed and can be found further down the page.
will allow you to create those programatically.

- `ami_architecture` (string) - what architecture to use when registering the final AMI; valid options
are "arm64", "i386", "x86_64", or "x86_64_mac". Defaults to "x86_64".
are "arm64", "arm64_mac", "i386", "x86_64", or "x86_64_mac". Defaults to "x86_64".

- `boot_mode` (string) - The boot mode. Valid options are `legacy-bios` and `uefi`. See the documentation on
[boot modes](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ami-boot.html) for
Expand Down
6 changes: 3 additions & 3 deletions builder/chroot/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ type Config struct {
// prefix `kms_key_id` with `alias/`.
RootVolumeKmsKeyId string `mapstructure:"root_volume_kms_key_id" required:"false"`
// what architecture to use when registering the final AMI; valid options
// are "arm64", "i386", "x86_64", or "x86_64_mac". Defaults to "x86_64".
// are "arm64", "arm64_mac", "i386", "x86_64", or "x86_64_mac". Defaults to "x86_64".
Architecture string `mapstructure:"ami_architecture" required:"false"`
// The boot mode. Valid options are `legacy-bios` and `uefi`. See the documentation on
// [boot modes](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ami-boot.html) for
Expand Down Expand Up @@ -370,14 +370,14 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {

}
valid := false
for _, validArch := range []string{"arm64", "i386", "x86_64", "x86_64_mac"} {
for _, validArch := range []string{"arm64", "arm64_mac", "i386", "x86_64", "x86_64_mac"} {
if validArch == b.config.Architecture {
valid = true
break
}
}
if !valid {
errs = packersdk.MultiErrorAppend(errs, errors.New(`The only valid ami_architecture values are "arm64", "i386", "x86_64", or "x86_64_mac"`))
errs = packersdk.MultiErrorAppend(errs, errors.New(`The only valid ami_architecture values are "arm64", "arm64_mac", "i386", "x86_64", or "x86_64_mac"`))
}

if b.config.TpmSupport != "" && b.config.TpmSupport != ec2.TpmSupportValuesV20 {
Expand Down
6 changes: 3 additions & 3 deletions builder/ebssurrogate/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ type Config struct {
// will allow you to create those programatically.
VolumeRunTag config.NameValues `mapstructure:"run_volume_tag" required:"false"`
// what architecture to use when registering the final AMI; valid options
// are "arm64", "i386", "x86_64", or "x86_64_mac". Defaults to "x86_64".
// are "arm64", "arm64_mac", "i386", "x86_64", or "x86_64_mac". Defaults to "x86_64".
Architecture string `mapstructure:"ami_architecture" required:"false"`
// The boot mode. Valid options are `legacy-bios` and `uefi`. See the documentation on
// [boot modes](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ami-boot.html) for
Expand Down Expand Up @@ -186,14 +186,14 @@ func (b *Builder) Prepare(raws ...interface{}) ([]string, []string, error) {
b.config.Architecture = "x86_64"
}
valid := false
for _, validArch := range []string{"arm64", "i386", "x86_64", "x86_64_mac"} {
for _, validArch := range []string{"arm64", "arm64_mac", "i386", "x86_64", "x86_64_mac"} {
if validArch == b.config.Architecture {
valid = true
break
}
}
if !valid {
errs = packersdk.MultiErrorAppend(errs, errors.New(`The only valid ami_architecture values are "arm64", "i386", "x86_64", or "x86_64_mac"`))
errs = packersdk.MultiErrorAppend(errs, errors.New(`The only valid ami_architecture values are "arm64", "arm64_mac", "i386", "x86_64", or "x86_64_mac"`))
}

if b.config.TpmSupport != "" && b.config.TpmSupport != ec2.TpmSupportValuesV20 {
Expand Down
2 changes: 1 addition & 1 deletion docs-partials/builder/chroot/Config-not-required.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
prefix `kms_key_id` with `alias/`.

- `ami_architecture` (string) - what architecture to use when registering the final AMI; valid options
are "arm64", "i386", "x86_64", or "x86_64_mac". Defaults to "x86_64".
are "arm64", "arm64_mac", "i386", "x86_64", or "x86_64_mac". Defaults to "x86_64".

- `boot_mode` (string) - The boot mode. Valid options are `legacy-bios` and `uefi`. See the documentation on
[boot modes](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ami-boot.html) for
Expand Down
2 changes: 1 addition & 1 deletion docs-partials/builder/ebssurrogate/Config-not-required.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
will allow you to create those programatically.

- `ami_architecture` (string) - what architecture to use when registering the final AMI; valid options
are "arm64", "i386", "x86_64", or "x86_64_mac". Defaults to "x86_64".
are "arm64", "arm64_mac", "i386", "x86_64", or "x86_64_mac". Defaults to "x86_64".

- `boot_mode` (string) - The boot mode. Valid options are `legacy-bios` and `uefi`. See the documentation on
[boot modes](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ami-boot.html) for
Expand Down

0 comments on commit 3c9034f

Please sign in to comment.