Coder Social home page Coder Social logo

Comments (2)

moritzzimmer avatar moritzzimmer commented on May 20, 2024

Hi @ezeql,

you can include the SQS resource directly in your module like this:

resource "aws_sqs_queue" "example" {
  name = "example"
}

module "issue-63" {
  source  = "spring-media/lambda/aws"
  version = "5.2.0"

  filename      = "${path.module}/../bin/issue-63.zip"
  function_name = "tf-issue-63"
  handler       = "issue-63"
  runtime       = "go1.x"

  event = {
    type             = "sqs"
    event_source_arn = aws_sqs_queue.example.arn
  }
}

This module relies heavily on count to determine which resources should be created. So if you just run

$ terraform apply -var region=us-west-2

which works when using a hard-coded ARN or a data source, you'll get those errors:

The "count" value depends on resource attributes that cannot be determined
until apply, so Terraform cannot predict how many instances will be created.
To work around this, use the -target argument to first apply only the
resources that the count depends on.

Like described in the error message, just add an intermediate terraform command:

$ terraform apply -var region=us-west-2 -target aws_sqs_queue.example 
$ terraform apply -var region=us-west-2

Let me know if this answers your question.

from terraform-aws-lambda.

ezeql avatar ezeql commented on May 20, 2024

Thank you @moritzzimmer

from terraform-aws-lambda.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.