terraform-provider-dominos icon indicating copy to clipboard operation
terraform-provider-dominos copied to clipboard

Request: terraform plan output the total price

Open lamroger opened this issue 5 years ago • 8 comments

Once coupon codes are supported, it'll be nice to confirm they're applied before the order is placed.

lamroger avatar May 03 '19 18:05 lamroger

I don't think it's possible. dominos_order can have a property like price but it would only exist after creating the resource (that is, placing the order). I don't see how this request could be implemented but maybe @ndmckinley has an idea.

Nowaker avatar May 04 '19 06:05 Nowaker

Ooh, I do actually! :) There's a special API called price_order you can hit to get the price out. I could add a price_only boolean to the order object, which wouldn't really create the order, just get the price. How's that?

nat-henderson avatar May 07 '19 09:05 nat-henderson

Awesome! Would it be possible to add a hook to the end of a terraform plan instead? Makes more sense to me for it to be in plan since an apply should attempt to change state imo

lamroger avatar May 07 '19 15:05 lamroger

I don't know, actually. I think no matter what I do, the plan output will say price: "" -> "<COMPUTED>", right? Can you point to any other provider that does what you're looking for? Maybe I misunderstand.

nat-henderson avatar May 07 '19 16:05 nat-henderson

Oh bummer. No, I was just wondering and I've never seen anything like it haha Thanks for looking into it!

lamroger avatar May 07 '19 17:05 lamroger

Hey can someone take a look at #7? I'm actually in Ireland right now and I can't hit dominos API from here, so I could use some help testing.

nat-henderson avatar May 07 '19 20:05 nat-henderson

@ndmckinley Looking at the code from my phone, shouldn't this price only field also have something like IgnoreChanges on it? Just to make sure a different price reported via API won't trigger a new resource (therefore, a new order). The goal is, once a pizza is order, the order will never happen again.

Nowaker avatar May 07 '19 21:05 Nowaker

Heh, technically yes, if this were a real, good provider. It only gets updated during Create, though, so it won't cause changes.

nat-henderson avatar May 08 '19 09:05 nat-henderson