Lucas Abreu
Lucas Abreu

Reputation: 475

Deploying inter dependent stacks at once with CDKTF

I'm using CDKTF version 0.9.4 to deploy two stacks associated with an app. The docs says I have to simply list'em all or use '*'.

Running cdktf deploy '*' I get: Can't find the given stack *. I then listed all of'em and received Unable to find remote state, what me think whether cross-dependency is available only for cloud usage.

On the other hand, this tells me that multiple deployment stack isn't available, even though this dude does it.

I'm using Python, so maybe that's the problem ?

Any help is appreciated.

The cross-stack dependency was declared in two ways (errors were the same):

  1. Exposing the objects as property of the stack
first_stack = Lambda(app, "my-lambda")
second_stack = ApiGateway(app, "api_gateway", first_stack.lambda_function)
  1. Using add_dependency() method. Not sure I'm doing this right, the former seems more appropriate
first_stack = Lambda(app, "my-lambda")
second_stack = ApiGateway(app, "api_gateway", first_stack.lambda_function)
second_stack.add_dependency(first_stack)

Upvotes: 0

Views: 1374

Answers (1)

Daniel Schmidt
Daniel Schmidt

Reputation: 11921

As kornshell93 already said, you need to update your cdktf version to 0.10 or higher since the feature was just recently introduced. In 0.9 you should be able to run cdktf deploy first-stack && cdktf deploy second-stack though, since cross stack references were in place already.

Upvotes: 1

Related Questions