diff --git a/examples/lambda/README.md b/examples/lambda/README.md index 17c95f5..f8dee15 100644 --- a/examples/lambda/README.md +++ b/examples/lambda/README.md @@ -69,7 +69,7 @@ This example Terraform workspace will use the zip package to deploy the `consul- add it to the `lambda-app-2` function so that it can call services within the Consul service mesh. ```shell -curl -o consul-lambda-extension.zip https://releases.hashicorp.com/consul-lambda-extension/${VERSION}/consul-lambda-extension_${VERSION}_linux_amd64.zip +curl -o consul-lambda-extension.zip "https://releases.hashicorp.com/consul-lambda-extension/${VERSION}-beta4/consul-lambda-extension_${VERSION}-beta4_linux_amd64.zip" ``` ## Build the example Lambda function diff --git a/examples/lambda/lambda/variables.tf b/examples/lambda/lambda/variables.tf index 1285fb7..fcc823b 100644 --- a/examples/lambda/lambda/variables.tf +++ b/examples/lambda/lambda/variables.tf @@ -94,7 +94,7 @@ variable "invocation_mode" { default = "SYNCHRONOUS" validation { condition = contains(["SYNCHRONOUS", "ASYNCHRONOUS"], var.invocation_mode) - error_message = "invocation_mode must be one of SYNCHRONOUS or ASYNCHRONOUS" + error_message = "Invocation_mode must be one of SYNCHRONOUS or ASYNCHRONOUS." } } diff --git a/examples/lambda/providers.tf b/examples/lambda/providers.tf index 274639b..07cac4a 100644 --- a/examples/lambda/providers.tf +++ b/examples/lambda/providers.tf @@ -16,10 +16,6 @@ terraform { version = "4.0.3" } - docker = { - source = "kreuzwerker/docker" - version = "3.0.2" - } } } @@ -27,14 +23,3 @@ provider "aws" { region = var.region } -# Equivalent of aws ecr get-login -data "aws_ecr_authorization_token" "ecr_auth" {} - -provider "docker" { - host = "unix:///var/run/docker.sock" # Use the appropriate Docker socket for your system - registry_auth { - username = data.aws_ecr_authorization_token.ecr_auth.user_name - password = data.aws_ecr_authorization_token.ecr_auth.password - address = "${data.aws_caller_identity.current.account_id}.dkr.ecr.${var.region}.amazonaws.com" - } -} diff --git a/modules/lambda-registrator/main.tf b/modules/lambda-registrator/main.tf index 3e16f07..3cd23d2 100644 --- a/modules/lambda-registrator/main.tf +++ b/modules/lambda-registrator/main.tf @@ -1,5 +1,14 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: MPL-2.0 + +terraform { + required_providers { + docker = { + source = "kreuzwerker/docker" + version = "3.0.2" + } + } +} locals { on_vpc = length(var.subnet_ids) > 0 && length(var.security_group_ids) > 0 vpc_config = local.on_vpc ? [{ @@ -13,6 +22,18 @@ locals { ecr_image_uri_pull-through = "${data.aws_caller_identity.current.account_id}.dkr.ecr.${var.region}.amazonaws.com/ecr-public/hashicorp/${var.private_repo_name}:${local.image_tag}" } +# Equivalent of aws ecr get-login +data "aws_ecr_authorization_token" "ecr_auth" {} + +provider "docker" { + host = "unix:///var/run/docker.sock" # Use the appropriate Docker socket for your system + registry_auth { + username = data.aws_ecr_authorization_token.ecr_auth.user_name + password = data.aws_ecr_authorization_token.ecr_auth.password + address = "${data.aws_caller_identity.current.account_id}.dkr.ecr.${var.region}.amazonaws.com" + } +} + data "aws_caller_identity" "current" {} resource "aws_iam_role" "registration" {