Skip to content

Instantly share code, notes, and snippets.

@brantb
Last active January 22, 2019 21:43
Show Gist options
  • Save brantb/ba34eaaaf86e1d61eee11556d448e416 to your computer and use it in GitHub Desktop.
Save brantb/ba34eaaaf86e1d61eee11556d448e416 to your computer and use it in GitHub Desktop.
data "azurerm_subscriptions" "available" {}
output "subscriptions" {
value = "${data.azurerm_subscriptions.available.subscriptions}"
}
/*
Sample output:
subscriptions = [
{
display_name = Subscription One
subscription_id = ab400b28-6f92-4fb4-a48b-83810ac2f830
},
{
display_name = Subscription Two
subscription_id = 4e03fb6f-08d7-4793-a863-3e2ac31206df
}
]
*/
resource "azurerm_role_definition" "custom_role" {
# assignable_scopes should be a list of all available subscription IDs.
assignable_scopes = [
"${data.azurerm_subscriptions.available.subscriptions.*.subscription_id}",
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment