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

Add support to query identity settings in App Service > Web App. closes #54 #90

Merged
merged 5 commits into from
May 4, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
"enabled": true,
"https_only": false,
"id": "{{ output.resource_id.value }}",
"identity_type": "SystemAssigned",
"kind": "app",
"name": "{{resourceName}}",
"region": "East US",
"region": "east us",
"reserved": false,
"resource_group": "{{resourceName}}"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
select name, id, kind, region, client_affinity_enabled, enabled, https_only, reserved, resource_group
select name, id, kind, region, client_affinity_enabled, enabled, https_only, reserved, resource_group, identity_type
from azure.azure_app_service_web_app
where name = '{{resourceName}}' and resource_group = '{{resourceName}}'
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"id": "{{ output.resource_id.value }}",
"kind": "app",
"name": "{{resourceName}}",
"region": "East US",
"region": "east us",
"resource_group": "{{resourceName}}"
}
]
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[
{
"id": "{{ output.resource_id.value }}",
"identity_type": "SystemAssigned",
"name": "{{resourceName}}"
}
]
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
select id, name
select id, name, identity_type
from azure.azure_app_service_web_app
where name = '{{resourceName}}'
5 changes: 4 additions & 1 deletion azure-test/tests/azure_app_service_web_app/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ variable "azure_environment" {

variable "azure_subscription" {
type = string
default = "3510ae4d-530b-497d-8f30-53b9616fc6c1"
default = "cd4401c4-3cc8-4565-a594-839c1e345f1e"
Subhajit97 marked this conversation as resolved.
Show resolved Hide resolved
description = "Azure subscription used for the test."
}

Expand Down Expand Up @@ -62,6 +62,9 @@ resource "azurerm_app_service" "named_test_resource" {
location = azurerm_resource_group.named_test_resource.location
resource_group_name = azurerm_resource_group.named_test_resource.name
app_service_plan_id = azurerm_app_service_plan.named_test_resource.id
identity {
type = "SystemAssigned"
}

tags = {
name = var.resource_name
Expand Down
18 changes: 18 additions & 0 deletions azure/table_azure_app_service_web_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,24 @@ func tableAzureAppServiceWebApp(_ context.Context) *plugin.Table {
Type: proto.ColumnType_BOOL,
Transform: transform.FromField("SiteProperties.HTTPSOnly"),
},
{
Name: "identity_type",
Copy link
Contributor

Choose a reason for hiding this comment

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

@Paulami30 Since there aren't that many fields here, and identity information is easy to find, would this work if we just had an identity column with the JSON type?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If we fetch the whole identity column, we do not get the data. That is why I had to fetch the keys from the object.

Description: "Type of managed service identity.",
Type: proto.ColumnType_STRING,
Transform: transform.FromField("Identity.Type"),
},
{
Name: "identity_tenant_id",
Description: "Tenant of managed service identity.",
Type: proto.ColumnType_STRING,
Transform: transform.FromField("Identity.TenantID"),
},
{
Name: "identity_principal_id",
Description: "Principal Id of managed service identity.",
Type: proto.ColumnType_STRING,
Transform: transform.FromField("Identity.PrincipalID"),
},
{
Name: "outbound_ip_addresses",
Description: "List of IP addresses that the app uses for outbound connections (e.g. database access).",
Expand Down