https://pulumi.com logo
#general
Title
# general
p

proud-alarm-92546

06/14/2019, 7:34 PM
question: is the terraform
lifecycle
block actually supported? how would it be passed? a lot of docu references it, but I also realize that docu is generated from the tf docs. https://pulumi.io/reference/pkg/nodejs/pulumi/aws/ecs/
Copy code
You can utilize the generic Terraform resource lifecycle configuration block with ignore_changes to create an ECS service with an initial count of running instances, then ignore any changes to that count caused externally
...the example in the tf docs for this section shows the lifecycle block, but the example in the pulumi version lacks it, making me thing it's being excluded in the autogen somewhere.......
w

white-balloon-205

06/14/2019, 7:35 PM
The Terraform lifecycle block is not supported, but the similar Pulumi resource options supports an
ignoreChanges
property.
p

proud-alarm-92546

06/14/2019, 7:37 PM
thanks - an hour of and on google searching didnt turn that up...
might be good to find a way to link to that instead of linking to the tf reference
w

white-balloon-205

06/14/2019, 7:39 PM
Indeed. Opened https://github.com/pulumi/tf2pulumi/issues/104 which might help a bit here.
p

proud-alarm-92546

06/14/2019, 7:39 PM
(and some example of what the structure looks like would be nice. 🙂)
that would definitely help! though if you try to do the tf thing directly, it's
Copy code
lifecycle {
      ignore_changes = ["desired_count"]
    }
which blows up 🙂
should I be adding
ignoreChanges { "desired_count" }
?
(it's friday, so I might be blind too. )
w

white-balloon-205

06/14/2019, 7:43 PM
You can see an example in this issue: https://github.com/pulumi/pulumi-aws/issues/553
p

proud-alarm-92546

06/14/2019, 7:45 PM
thanks, I just found that one.
{ parent: this, ignoreChanges: ['desired_count'] }
on line 139 results in
Copy code
TSError: ⨯ Unable to compile TypeScript:
    index.ts(139,5): error TS1136: Property assignment expected.
    index.ts(140,1): error TS1005: ',' expected.
    index.ts(140,2): error TS1128: Declaration or statement expected.
    index.ts(139,5): error TS2345: Argument of type '{ parent: typeof globalThis; ignoreChanges: string[]; }' is not assignable to parameter of type 'ComponentResourceOptions'.
      Types of property 'parent' are incompatible.
        Type 'typeof globalThis' is missing the following properties from type 'Resource': urn, getProvider
though
w

white-balloon-205

06/14/2019, 7:47 PM
You do not need to provide
parent
- that’s an unrelated other resource option that you probably don’t need in your use case.
p

proud-alarm-92546

06/14/2019, 7:47 PM
oh, I may be to far up in the {}'s
yep, there it goes (at least, no errors)
Copy code
desiredCount: +config.containerCount!,
  }, 
  { ignoreChanges: ['desired_count'] }
);
thanks!
4 Views