diff --git a/examples/alias/main.tf b/examples/alias/main.tf index 5a37e057..1dc58511 100644 --- a/examples/alias/main.tf +++ b/examples/alias/main.tf @@ -5,7 +5,6 @@ provider "aws" { skip_metadata_api_check = true skip_region_validation = true skip_credentials_validation = true - skip_requesting_account_id = true } data "aws_organizations_organization" "this" {} diff --git a/examples/async/main.tf b/examples/async/main.tf index 095b249d..8c234026 100644 --- a/examples/async/main.tf +++ b/examples/async/main.tf @@ -5,7 +5,6 @@ provider "aws" { skip_metadata_api_check = true skip_region_validation = true skip_credentials_validation = true - skip_requesting_account_id = true } resource "random_pet" "this" { diff --git a/examples/build-package/main.tf b/examples/build-package/main.tf index 11c1ce06..ddee6eb8 100644 --- a/examples/build-package/main.tf +++ b/examples/build-package/main.tf @@ -5,7 +5,6 @@ provider "aws" { skip_metadata_api_check = true skip_region_validation = true skip_credentials_validation = true - skip_requesting_account_id = true } resource "random_pet" "this" { diff --git a/examples/code-signing/main.tf b/examples/code-signing/main.tf index ba8bc6b1..7ce74e1b 100644 --- a/examples/code-signing/main.tf +++ b/examples/code-signing/main.tf @@ -5,7 +5,6 @@ provider "aws" { skip_metadata_api_check = true skip_region_validation = true skip_credentials_validation = true - skip_requesting_account_id = true } ################################################################################ diff --git a/examples/complete/main.tf b/examples/complete/main.tf index ef487199..0f2d0a8c 100644 --- a/examples/complete/main.tf +++ b/examples/complete/main.tf @@ -5,7 +5,6 @@ provider "aws" { skip_metadata_api_check = true skip_region_validation = true skip_credentials_validation = true - skip_requesting_account_id = true } data "aws_caller_identity" "current" {} diff --git a/examples/container-image/main.tf b/examples/container-image/main.tf index 9cc6e411..d19be410 100644 --- a/examples/container-image/main.tf +++ b/examples/container-image/main.tf @@ -11,7 +11,6 @@ provider "aws" { skip_metadata_api_check = true skip_region_validation = true skip_credentials_validation = true - skip_requesting_account_id = true } provider "docker" { diff --git a/examples/deploy/main.tf b/examples/deploy/main.tf index d356b500..96269036 100644 --- a/examples/deploy/main.tf +++ b/examples/deploy/main.tf @@ -5,7 +5,6 @@ provider "aws" { skip_metadata_api_check = true skip_region_validation = true skip_credentials_validation = true - skip_requesting_account_id = true } resource "random_pet" "this" { diff --git a/examples/event-source-mapping/main.tf b/examples/event-source-mapping/main.tf index 46253c35..977ace23 100644 --- a/examples/event-source-mapping/main.tf +++ b/examples/event-source-mapping/main.tf @@ -6,7 +6,6 @@ provider "aws" { skip_metadata_api_check = true skip_region_validation = true skip_credentials_validation = true - skip_requesting_account_id = true } data "aws_availability_zones" "available" {} diff --git a/examples/multiple-regions/main.tf b/examples/multiple-regions/main.tf index 4406c0c2..dd2e229c 100644 --- a/examples/multiple-regions/main.tf +++ b/examples/multiple-regions/main.tf @@ -5,7 +5,6 @@ provider "aws" { skip_metadata_api_check = true skip_region_validation = true skip_credentials_validation = true - skip_requesting_account_id = true } provider "aws" { @@ -16,7 +15,6 @@ provider "aws" { skip_metadata_api_check = true skip_region_validation = true skip_credentials_validation = true - skip_requesting_account_id = true } ################################ diff --git a/examples/simple/main.tf b/examples/simple/main.tf index 010f7c76..ab9aba1a 100644 --- a/examples/simple/main.tf +++ b/examples/simple/main.tf @@ -6,7 +6,6 @@ provider "aws" { skip_metadata_api_check = true skip_region_validation = true skip_credentials_validation = true - skip_requesting_account_id = true } resource "random_pet" "this" { diff --git a/examples/triggers/main.tf b/examples/triggers/main.tf index 9e9171ef..06627afd 100644 --- a/examples/triggers/main.tf +++ b/examples/triggers/main.tf @@ -5,7 +5,6 @@ provider "aws" { skip_metadata_api_check = true skip_region_validation = true skip_credentials_validation = true - skip_requesting_account_id = true } ########################################## diff --git a/examples/with-efs/main.tf b/examples/with-efs/main.tf index 97c12569..8fcd8787 100644 --- a/examples/with-efs/main.tf +++ b/examples/with-efs/main.tf @@ -5,7 +5,6 @@ provider "aws" { skip_metadata_api_check = true skip_region_validation = true skip_credentials_validation = true - skip_requesting_account_id = true } resource "random_pet" "this" { diff --git a/examples/with-vpc-s3-endpoint/main.tf b/examples/with-vpc-s3-endpoint/main.tf index 939dc5ee..3c37db51 100644 --- a/examples/with-vpc-s3-endpoint/main.tf +++ b/examples/with-vpc-s3-endpoint/main.tf @@ -5,7 +5,6 @@ provider "aws" { skip_metadata_api_check = true skip_region_validation = true skip_credentials_validation = true - skip_requesting_account_id = true } data "aws_region" "current" {} diff --git a/examples/with-vpc/main.tf b/examples/with-vpc/main.tf index 42cde394..1d4b6179 100644 --- a/examples/with-vpc/main.tf +++ b/examples/with-vpc/main.tf @@ -5,7 +5,6 @@ provider "aws" { skip_metadata_api_check = true skip_region_validation = true skip_credentials_validation = true - skip_requesting_account_id = true } resource "random_pet" "this" { diff --git a/modules/docker-build/README.md b/modules/docker-build/README.md index bfd753bb..0cf1cc81 100644 --- a/modules/docker-build/README.md +++ b/modules/docker-build/README.md @@ -87,6 +87,7 @@ No modules. |------|-------------|------|---------|:--------:| | [build\_args](#input\_build\_args) | A map of Docker build arguments. | `map(string)` | `{}` | no | | [create\_ecr\_repo](#input\_create\_ecr\_repo) | Controls whether ECR repository for Lambda image should be created | `bool` | `false` | no | +| [create\_sam\_metadata](#input\_create\_sam\_metadata) | Controls whether the SAM metadata null resource should be created | `bool` | `false` | no | | [docker\_file\_path](#input\_docker\_file\_path) | Path to Dockerfile in source package | `string` | `"Dockerfile"` | no | | [ecr\_address](#input\_ecr\_address) | Address of ECR repository for cross-account container image pulling (optional). Option `create_ecr_repo` must be `false` | `string` | `null` | no | | [ecr\_force\_delete](#input\_ecr\_force\_delete) | If true, will delete the repository even if it contains images. | `bool` | `true` | no | diff --git a/modules/docker-build/main.tf b/modules/docker-build/main.tf index b02e094b..dc9ad310 100644 --- a/modules/docker-build/main.tf +++ b/modules/docker-build/main.tf @@ -51,6 +51,8 @@ resource "aws_ecr_lifecycle_policy" "this" { # to the TF application. This resource will maintain the metadata information about the image type lambda # functions. It will contain the information required to build the docker image locally. resource "null_resource" "sam_metadata_docker_registry_image" { + count = var.create_sam_metadata ? 1 : 0 + triggers = { resource_type = "IMAGE_LAMBDA_FUNCTION" docker_context = var.source_path diff --git a/modules/docker-build/variables.tf b/modules/docker-build/variables.tf index 9b8843f3..a59548a8 100644 --- a/modules/docker-build/variables.tf +++ b/modules/docker-build/variables.tf @@ -4,6 +4,12 @@ variable "create_ecr_repo" { default = false } +variable "create_sam_metadata" { + description = "Controls whether the SAM metadata null resource should be created" + type = bool + default = false +} + variable "ecr_address" { description = "Address of ECR repository for cross-account container image pulling (optional). Option `create_ecr_repo` must be `false`" type = string diff --git a/wrappers/docker-build/main.tf b/wrappers/docker-build/main.tf index e92cd2b6..c53be636 100644 --- a/wrappers/docker-build/main.tf +++ b/wrappers/docker-build/main.tf @@ -4,6 +4,7 @@ module "wrapper" { for_each = var.items create_ecr_repo = try(each.value.create_ecr_repo, var.defaults.create_ecr_repo, false) + create_sam_metadata = try(each.value.create_sam_metadata, var.defaults.create_sam_metadata, false) ecr_address = try(each.value.ecr_address, var.defaults.ecr_address, null) ecr_repo = try(each.value.ecr_repo, var.defaults.ecr_repo, null) image_tag = try(each.value.image_tag, var.defaults.image_tag, null)