Mastercard / terraform-provider-restapi

A terraform provider to manage objects in a RESTful API
Other
808 stars 217 forks source link

Allow restapi object to modify the headers #138

Open vpitest11 opened 3 years ago

vpitest11 commented 3 years ago

I would like to dynamically add headers relative to attributes of other resources defined in the code, like adding a header with an api key that's not known until after apply, etc.

DRuggeri commented 3 years ago

Thanks for the idea @vpitest11 - can you say more about what you'd like to do? Are you thinking that per-resource headers should be supported such that:

... that is, you're only seeking addition/modification of headers rather than deletes/changes/etc to headers, right?

Note: the idea makes sense, but adding this is a technical challenge because the base set of headers is set on the underlying api_client which is an object shared across the whole provider (the provider's principles generally says that these kinds of config attributes ought to stay consistent across all requests). This would require a structural change that needs some noodling.

vpitest11 commented 2 years ago

Correct. I only need to add/change additional headers. I don’t need to modify any of the default headers.

For example, adding a header for a resource key or secret, or reusing the same provider and adding/modifying additional headers based on resource properties.

From: Daniel Ruggeri @.> Sent: Monday, September 6, 2021 11:43 AM To: Mastercard/terraform-provider-restapi @.> Cc: Charlotte Murphy @.>; Mention @.> Subject: Re: [Mastercard/terraform-provider-restapi] Allow restapi object to modify the headers (#138)

Thanks for the idea @vpitest11https://github.com/vpitest11 - can you say more about what you'd like to do? Are you thinking that per-resource headers should be supported such that:

... that is, you're only seeking addition/modification of headers rather than deletes/changes/etc to headers, right?

Note: the idea makes sense, but adding this is a technical challenge because the base set of headers is set on the underlying api_clienthttps://github.com/Mastercard/terraform-provider-restapi/blob/298e1d56e4a61f2897f81ce499aaee255424efda/restapi/api_client.go#L57 which is an object shared across the whole provider (the provider's principles generally says that these kinds of config attributes ought to stay consistent across all requests). This would require a structural change that needs some noodling.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/Mastercard/terraform-provider-restapi/issues/138#issuecomment-913788391, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AUK6NXWMBOLE4ZCSRJZL2TTUAT4Q5ANCNFSM46BXNKIQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.