Reputation: 35
I want to pass the variables inside my terraform script when I call the PowerShell script inside "provisioner". I have used the following code.
resource "null_resource" "example2" {
provisioner "local-exec" {
command= "-azureAplicationId 0000 -azureTenantId 0000 -azureSecret 000 > C:\\Users\\Boopathi Kumar\\Downloads\\poscript1.ps1"
interpreter = ["powershell.exe", "-File"]
}
}
Upvotes: 0
Views: 2148
Reputation: 41
Just to be clear on the solution to the issue with passing parameters into Powershell script, important bits is to add the .\ to the relative path (with an additiona \ for escape special character as well as using -Command (and not -File):
resource "null_resource" "share_integrationruntime" {
provisioner "local-exec" {
command = ".\\Share-ADF-IntegrationRuntime.ps1 ${var.resource_group_name} ${var.data_factory_service_name}"
interpreter = ["PowerShell", "-Command" ]
}
}
Upvotes: 0
Reputation: 2175
You can do the following:
resource "null_resource" "example2" {
provisioner "local-exec" {
command= "C:\\Users\\Boopathi Kumar\\Downloads\\poscript1.ps1 -azureAplicationId ${var.appId} -azureTenantId ${var.tenantId} -azureSecret ${var.secret}"
interpreter = ["powershell.exe", "-File"]
}
}
Upvotes: 1