nat-henderson / terraform-provider-dominos

The Terraform plugin for the Dominos Pizza provider.
MIT License
1.12k stars 86 forks source link

Request: terraform plan output the total price #6

Open lamroger opened 5 years ago

lamroger commented 5 years ago

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

Nowaker commented 5 years ago

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.

nat-henderson commented 5 years ago

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?

lamroger commented 5 years ago

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

nat-henderson commented 5 years ago

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.

lamroger commented 5 years ago

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

nat-henderson commented 5 years ago

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.

Nowaker commented 5 years ago

@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.

nat-henderson commented 5 years ago

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