diff --git a/examples/container-image/main.tf b/examples/container-image/main.tf index f00c7c12..670c6212 100644 --- a/examples/container-image/main.tf +++ b/examples/container-image/main.tf @@ -66,6 +66,7 @@ module "docker_image" { build_args = { FOO = "bar" } + platform = "linux/amd64" } resource "random_pet" "this" { diff --git a/modules/docker-build/README.md b/modules/docker-build/README.md index b835a325..9c87603a 100644 --- a/modules/docker-build/README.md +++ b/modules/docker-build/README.md @@ -95,6 +95,7 @@ No modules. | [image\_tag](#input\_image\_tag) | Image tag to use. If not specified current timestamp in format 'YYYYMMDDhhmmss' will be used. This can lead to unnecessary rebuilds. | `string` | `null` | no | | [image\_tag\_mutability](#input\_image\_tag\_mutability) | The tag mutability setting for the repository. Must be one of: `MUTABLE` or `IMMUTABLE` | `string` | `"MUTABLE"` | no | | [keep\_remotely](#input\_keep\_remotely) | Whether to keep Docker image in the remote registry on destroy operation. | `bool` | `false` | no | +| [platform](#input\_platform) | The target architecture platform to build the image for. | `string` | `null` | no | | [scan\_on\_push](#input\_scan\_on\_push) | Indicates whether images are scanned after being pushed to the repository | `bool` | `false` | no | | [source\_path](#input\_source\_path) | Path to folder containing application code | `string` | `null` | no | diff --git a/modules/docker-build/main.tf b/modules/docker-build/main.tf index c96cfbee..3883314e 100644 --- a/modules/docker-build/main.tf +++ b/modules/docker-build/main.tf @@ -16,6 +16,7 @@ resource "docker_registry_image" "this" { context = var.source_path dockerfile = var.docker_file_path build_args = var.build_args + platform = var.platform } keep_remotely = var.keep_remotely diff --git a/modules/docker-build/variables.tf b/modules/docker-build/variables.tf index 4fadbff1..9b8843f3 100644 --- a/modules/docker-build/variables.tf +++ b/modules/docker-build/variables.tf @@ -76,3 +76,9 @@ variable "keep_remotely" { type = bool default = false } + +variable "platform" { + description = "The target architecture platform to build the image for." + type = string + default = null +}