Skip to content

Commit

Permalink
Fix Terraform outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Rowlandson committed Sep 4, 2020
1 parent 5b0f77c commit a42bf3e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions AzureState/AzureState.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ class AzState {
"Microsoft.Management/managementGroups" {
$private:subscriptions = $this.Children `
| Where-Object { $_.type -match "/subscriptions$" }
$private:dotTf += "resource `"azurerm_management_group`" `"{0}`" {{" -f $this.Id -replace "/", "_"
$private:dotTf += "resource `"azurerm_management_group`" `"{0}`" {{" -f ($this.Id -replace "[^\w]", "_")
$private:dotTf += " display_name = `"{0}`"" -f $this.Name
$private:dotTf += ""
if ($this.Parent.Id) {
Expand All @@ -766,23 +766,23 @@ class AzState {
if ($private:subscriptions) {
$private:dotTf += " subscription_ids = ["
foreach ($private:subscription in $private:subscriptions) {
$private:dotTf += " `"{0}`"" -f $private:subscription.Id
$private:dotTf += " `"{0}`"," -f ($private:subscription.Id -replace "/subscriptions/", "")
}
$private:dotTf += " ]"
}
$private:dotTf += "}"
$private:dotTf += ""
}
"Microsoft.Resources/subscriptions" {
$private:dotTf += "data `"azurerm_subscription`" `"{0}`" {{" -f $this.Id -replace "/", "_"
$private:dotTf += "data `"azurerm_subscription`" `"{0}`" {{" -f ($this.Id -replace "[^\w]", "_")
$private:dotTf += " subscription_id = `"{0}`"" -f $this.Raw.subscriptionId
$private:dotTf += "}"
$private:dotTf += ""
}
"Microsoft.Resources/resourceGroups" {
$private:subscriptions = $this.Children `
| Where-Object { $_.type -match "/subscriptions$" }
$private:dotTf += "resource `"azurerm_resource_group`" `"{0}`" {{" -f $this.Id -replace "/", "_"
$private:dotTf += "resource `"azurerm_resource_group`" `"{0}`" {{" -f ($this.Id -replace "[^\w]", "_")
$private:dotTf += " name = `"{0}`"" -f $this.Name
$private:dotTf += " location = `"{0}`"" -f $this.Raw.Location
if ($this.Raw.Tags.psobject.properties.count -ge 1) {
Expand Down

0 comments on commit a42bf3e

Please sign in to comment.