Skip to content
This repository was archived by the owner on Jun 8, 2022. It is now read-only.

Commit e2ec709

Browse files
Rafael Felix Correarafaelfelix
authored andcommitted
s3_key and bucket needs to have default values
so they're not considered mandatory even when is
1 parent f581401 commit e2ec709

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

archive.tf

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ locals {
55
# Generates a filename for the zip archive based on the contents of the files
66
# in source_path. The filename will change when the source code changes.
77
data "external" "archive" {
8-
count = "${var.source_from_s3 ? 0 : 1}"
9-
program = ["python", "${path.module}/hash.py"]
8+
count = "${var.source_from_s3 ? 0 : 1}"
9+
program = ["${path.module}/hash.py"]
1010

1111
query = {
1212
build_command = "${var.build_command}"
@@ -36,12 +36,8 @@ resource "null_resource" "archive" {
3636
# deletes the Lambda function. If the file is rebuilt here, the build
3737
# output is unfortunately invisible.
3838
data "external" "built" {
39-
<<<<<<< HEAD
40-
program = ["python", "${path.module}/built.py"]
41-
=======
42-
count = "${var.source_from_s3 ? 0 : 1}"
39+
count = "${var.source_from_s3 ? 0 : 1}"
4340
program = ["${path.module}/built.py"]
44-
>>>>>>> Support for lambda source from S3
4541

4642
query = {
4743
build_command = "${lookup(data.external.archive.result, "build_command")}"

lambda.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ resource "aws_lambda_function" "lambda_s3" {
4646
timeout = "${var.timeout}"
4747
tags = "${var.tags}"
4848

49-
s3_bucket = "${var.s3_bucket}"
50-
s3_key = "${var.s3_key}"
49+
s3_bucket = "${var.s3_bucket}"
50+
s3_key = "${var.s3_key}"
5151

5252
# The aws_lambda_function resource has a schema for the environment
5353
# variable, where the only acceptable values are:

variables.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,13 @@ variable "source_from_s3" {
9494
variable "s3_bucket" {
9595
description = "The S3 bucket location containing the function's deployment package. Required when `source_from_s3` = `true`. This bucket must reside in the same AWS region where you are creating the Lambda function."
9696
type = "string"
97+
default = ""
9798
}
9899

99100
variable "s3_key" {
100101
description = "The S3 key of an object containing the function's deployment package. Required when `source_from_s3` = `true`"
101102
type = "string"
103+
default = ""
102104
}
103105

104106
variable "tags" {

0 commit comments

Comments
 (0)