Skip to content
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 - support for specifying parameters via parameters_body #404

Merged

Conversation

civascu
Copy link

@civascu civascu commented Oct 6, 2017

Currently, the resource azurerm_template_deployment only supports passing in parameters as a key, value pair. This does not allow the use of parameters that reference a KeyVault that is enabled for template deployment, which is desired in some use-cases.

One such use-case is executing a bootstrap script when a virtual machine (or scale set) comes online - via the Azure extension mechanism - and inject secrets into the script being executed, without the operator that runs terraform to know their value upfront.

This is enabled similar to the template_body parameter, and it passes the JSON string to the Azure Rest API.

@civascu
Copy link
Author

civascu commented Oct 6, 2017

One similar issue I ran into was here: hashicorp/terraform#8331

@tombuildsstuff tombuildsstuff added this to the 1.0.2 milestone Jan 10, 2018
@tombuildsstuff tombuildsstuff modified the milestones: 1.0.2, 1.0.3 Jan 26, 2018
"parameters_body": {
Type: schema.TypeString,
Optional: true,
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you set this as mutually exclusive with parameters (see ConflictsWith) and validate that it is valid JSON?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may also want a StateFunc to normalize the JSON so that things like whitespace don't cause diffs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pushed a commit to add these

@paultyng
Copy link
Contributor

Looks like there is a merge conflict as well, so you should probably rebase.

@tombuildsstuff tombuildsstuff modified the milestones: 1.1.1, 1.1.2 Feb 5, 2018
@tombuildsstuff tombuildsstuff modified the milestones: 1.1.2, 1.1.3 Feb 15, 2018
@tombuildsstuff tombuildsstuff modified the milestones: 1.1.3, 1.1.4 Feb 28, 2018
Cristian Ivascu and others added 2 commits March 14, 2018 12:44
… passed to Azure on the call to deploy an ARM Template. Enables us to use KeyVault secret references for parameters
@tombuildsstuff
Copy link
Contributor

hey @civascu

Apologies for the delayed movement on this PR - I'm going to rebase this and push a commit to fix the issues that @paultyng identified (I hope you don't mind!); then we should be good to run the tests with this.

Thanks!

@tombuildsstuff tombuildsstuff force-pushed the enhancement_arm_template_params branch from ff63b33 to 35b7e68 Compare March 14, 2018 17:54
@tombuildsstuff tombuildsstuff self-assigned this Mar 14, 2018
@tombuildsstuff
Copy link
Contributor

Tests pass:

$ acctests azurerm TestAccAzureRMTemplateDeployment_
=== RUN   TestAccAzureRMTemplateDeployment_basic
--- PASS: TestAccAzureRMTemplateDeployment_basic (218.88s)
=== RUN   TestAccAzureRMTemplateDeployment_disappears
--- PASS: TestAccAzureRMTemplateDeployment_disappears (210.92s)
=== RUN   TestAccAzureRMTemplateDeployment_withParams
--- PASS: TestAccAzureRMTemplateDeployment_withParams (230.95s)
=== RUN   TestAccAzureRMTemplateDeployment_withOutputs
--- PASS: TestAccAzureRMTemplateDeployment_withOutputs (221.63s)
=== RUN   TestAccAzureRMTemplateDeployment_withError
--- PASS: TestAccAzureRMTemplateDeployment_withError (354.04s)
PASS
ok  	github.com/terraform-providers/terraform-provider-azurerm/azurerm	1236.456s

@tombuildsstuff tombuildsstuff dismissed paultyng’s stale review March 14, 2018 18:34

pushed updates to resolve these issues

Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @civascu

Apologies again for the delayed review time here - as I mentioned I've pushed a couple of commits to rebase this & fix the issues that @paultyng identified; and this now LGTM 👍

Thanks!

@tombuildsstuff tombuildsstuff changed the title Enhancement to add parameters_body to azurerm_template_deployment azurerm_template_deployment - support for specifying parameters via parameters_body Mar 14, 2018
@tombuildsstuff tombuildsstuff merged commit 93fad3a into hashicorp:master Mar 14, 2018
tombuildsstuff added a commit that referenced this pull request Mar 14, 2018
@ghost
Copy link

ghost commented Mar 31, 2020

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 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants