-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
azurerm_template_deployment fails to pass "array" type parameters properly #34
Comments
It also doesn't pass "type": "int" params either. Testing on 0.9.8. ex. test.tf
which results in:
Supposedly that was fixed in 0.9.5 provider/azurerm: azurerm_template_deployment now supports String/Int/Boolean outputs (#13670) ??? |
"type": "object" also does not work |
@StephenWeatherford can you take a look when you have a minute please? |
@smooth-alg, #13670 dealt with outputs, not parameters (it was an incremental improvement - note that outputs still don't support arrays or objects). It looks like parameters need to be fixed, too. Have you found a way to work around this? Does passing strings work for you? |
That's my current workaround, but it requires that the ARM template use string types everywhere for its parameters. It does not work for objects/arrays. It's a complete hack, but I'm using terraform's template provider combined with a partial ARM template to create ARM templates with object/array parameters baked in. |
I'm currently using templates for:
|
Thanks! That's a useful list. I will note that a lot of these are already in the pipeline. |
Thanks Stephen. Re: Resources Mostly general fill in as you have alluded to. Autoscale in Azure: which is in the pipeline. Even cloud provider templates often lag behind the full feature set available, much less third party orchestration tools, but in some cases have features not even avail in the api. Access to their native orchestration api is like backdoor to their full feature set (similar to the shell provisioner :-). Re: strings. Yes, they work. However, some vendors/projects are providing (and even recommend) solutions encapsulated in templates (which may not always have control of parameter types): ex. object which don't necessarily want to build from scratch and as I use terraform to deploy a lot of my other infrastructure, like to keep everything in one place. |
Hi, please consider to support all template inputs types :
I don't know the expected implementation but integers and bool in terraform are not "truly" supported (they are string encoded) so they need to be converted somehow. Secure* types are a bit out of the scope for parameters they don't differ from normal types "typewise". |
@m4h3 I'm no longer working terraform. Perhaps @tombuildsstuff can comment on future plans. |
hey @rtyler @smooth-alg @phekmat @m4h3 Apologies for the delayed response to this issue. To provide some background on why this is implemented this way: in HCL all values in a Map needs to be of the same type - in the case of the Output field, this is a Map/Dictionary of Strings:Strings. hashicorp/terraform#13670 updated the Output field to cast Boolean and Integer values returned from the Azure API's to Strings based on the return type - meaning that they could be represented correctly in the Schema/State as Strings - however this didn't handle Arrays, Objects or the 'Secure' prefixed types since they're more complex problems. Whilst we updated the Outputs (since we can guarantee the return type) - Inputs are more complicated since all values coming in are going to be Strings, we have no guarantee on what the types are. We could probably attempt to cast around this - however it's not ideal and it'd be better to be explicit. To achieve this we could adapt the Parameters value to take an additional
However this would mean that it's no longer a Map but a Set - which means that we'd not be able to validate the
Whilst this isn't ideal, unfortunately I think this may be the best route forward until these resources are supported natively in Terraform, if you need to make use of these parameters. That said, looking at the list above most of those are now either supported (App Service / Key Vault etc) or planned for the future. Given I don't believe there's a route forward for this issue (at least, in the short/medium term) - I'm going to close it for the moment. Thanks! |
Terraform has the ability to deploy Azure ARM templates and AWS Cloudformation stacks, and therefore it can glue things together without rewriting everything. I'm wondering how cloudformation stacks parameters behave here: https://www.terraform.io/docs/providers/aws/r/cloudformation_stack.html Casting or Parameter Set solution are both fine as templates/stacks won't ever be perfect solutions, but pragmatic ones waiting for native terraform implementations. |
@m4h3 it looks like CloudFormation parameters are treated the same: https://github.com/terraform-providers/terraform-provider-aws/blob/84dcbf9ebf36414a932af5dcd2b7b3b871baeac3/aws/resource_aws_cloudformation_stack.go#L145 |
Hi @tombuildsstuff E.g.
During apply:
and it fails, however it would be trivial to convert "2" to 2.
|
this is enough of a reason to completely stop using terraform for deploying Azure. Terraform great concept, but when an abstraction starts to leak all over you, it's time to reconsider its value (or completely change your requirements to work within the abstraction and not have Azure Functions in your ecosystem I guess...) Azure RM Templates (while clunky to write) are great in that almost every Azure portal operation generates an ARM template that runs against the resource group. Considering the documentation on the Azure APIs (and ARM templates themselves) is terrible, the best way to automate against Azure is often to check out the Deployments tab of a resource group and capture that template (which obviously often has arrays and objects as parameters). Having to start hacking at these templates makes such an approach much less viable. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks! |
This issue was originally opened by @rtyler as hashicorp/terraform#11085. It was migrated here as part of the provider split. The original body of the issue is below.
Terraform Version
v0.8.0
Affected Resource(s)
Terraform Configuration Files
Consider the an ARM template with an "array" parameter, e.g.:
Output
Expected Behavior
I would have expected the array to be marshalled through to the template properly.
What should have happened?
The text was updated successfully, but these errors were encountered: