Skip to content

Commit

Permalink
get rid of null_data_source warning
Browse files Browse the repository at this point in the history
  • Loading branch information
zhelezovartem committed Jun 27, 2024
1 parent 4f9c64c commit 94326f5
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 32 deletions.
17 changes: 6 additions & 11 deletions download_reporter_package.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,14 @@ locals {
downloaded = "downloaded_package_${md5(local.package_url)}.zip"
}

resource "null_resource" "download_package" {
triggers = {
downloaded = local.downloaded
}
resource "terraform_data" "download_package" {
input = local.downloaded

triggers_replace = [
local.downloaded
]

provisioner "local-exec" {
command = "curl -L -o ${local.downloaded} ${local.package_url}"
}
}

data "null_data_source" "downloaded_package" {
inputs = {
id = null_resource.download_package.id
filename = local.downloaded
}
}
10 changes: 5 additions & 5 deletions examples/ecs/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ module "lambda_reporter" {
source = "kosli-dev/kosli-reporter/aws"
version = "0.5.0"

name = local.reporter_name
kosli_environment_type = "ecs"
kosli_cli_version = "v2.7.8"
kosli_environment_name = "staging"
kosli_org = "my_org"
name = local.reporter_name
kosli_environment_type = "ecs"
kosli_cli_version = "v2.7.8"
kosli_environment_name = "staging"
kosli_org = "my_org"
# kosli_host = "https://app.kosli.com" # defaulted to app.kosli.com
reported_aws_resource_name = "my_ecs_cluster"
kosli_command_optional_parameters = "-s my-service"
Expand Down
10 changes: 5 additions & 5 deletions examples/lambda-report-selectively/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ module "lambda_reporter" {
source = "kosli-dev/kosli-reporter/aws"
version = "0.5.0"

name = local.reporter_name
kosli_environment_type = "lambda"
kosli_cli_version = "v2.7.8"
kosli_environment_name = "staging"
kosli_org = "my_org"
name = local.reporter_name
kosli_environment_type = "lambda"
kosli_cli_version = "v2.7.8"
kosli_environment_name = "staging"
kosli_org = "my_org"
# kosli_host = "https://app.kosli.com" # defaulted to app.kosli.com
reported_aws_resource_name = var.my_lambda_functions
use_custom_eventbridge_pattern = true
Expand Down
10 changes: 5 additions & 5 deletions examples/s3/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ module "lambda_reporter" {
source = "kosli-dev/kosli-reporter/aws"
version = "0.5.0"

name = local.reporter_name
kosli_environment_type = "s3"
kosli_cli_version = "v2.7.8"
kosli_environment_name = "staging"
kosli_org = "my_org"
name = local.reporter_name
kosli_environment_type = "s3"
kosli_cli_version = "v2.7.8"
kosli_environment_name = "staging"
kosli_org = "my_org"
# kosli_host = "https://app.kosli.com" # defaulted to app.kosli.com
reported_aws_resource_name = "my_s3_bucket"
}
13 changes: 7 additions & 6 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
module "reporter_lambda" {
source = "terraform-aws-modules/lambda/aws"
version = "4.18.0"
version = "7.7.0"

attach_policy_json = true
policy_json = var.create_role ? data.aws_iam_policy_document.combined[0].json : null

function_name = var.name
description = "Send reports to the Kosli app"
handler = "function.handler"
runtime = "provided.al2"
local_existing_package = data.null_data_source.downloaded_package.outputs["filename"]
function_name = var.name
description = "Send reports to the Kosli app"
handler = "function.handler"
runtime = "provided.al2"
# local_existing_package = data.null_data_source.downloaded_package.outputs["filename"]
local_existing_package = terraform_data.download_package.output

role_name = var.create_role ? var.name : null
timeout = var.lambda_timeout
Expand Down

0 comments on commit 94326f5

Please sign in to comment.