Skip to content

Commit 084dc10

Browse files
committed
Merge branch 'main' into feat/gws
2 parents f1a9056 + ad3c1db commit 084dc10

12 files changed

Lines changed: 94 additions & 45 deletions

File tree

m365/README.adoc

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,16 +97,21 @@ Optional::
9797
Advanced::
9898
`create_app` (bool) [default=True]::: If true, the app will be created. If false, the app will be imported
9999
`prefix_override` (string) [default=None]::: Prefix for resource names. If null, one will be generated from app_name
100-
`input_storage_container_url` (string) [default=None]::: If not null, input container to read configs from (must give permissions to service account). Otherwise by default will create storage container. Expect an https url pointing to a container
101-
`output_storage_container_url` (string) [default=None]::: If not null, output container to put results in (must give permissions to service account or use SAS). Otherwise by default will create storage container. Expect an https url pointing to a container
100+
`input_storage_container_url` (string) [default=None]::: If not null, input container to read configs from (must assign blob reader role role to service account `sp_object_id` manually).
101+
Otherwise by default will create storage container.
102+
Expect a container URL like: https://<account>.blob.core.windows.net/<container>
103+
Note that the container must have "adhoc" and "scheduled" directories. These are not created automatically in this case
104+
`output_storage_container_url` (string) [default=None]::: If not null, output container to put results in (must give permissions to service account `sp_object_id` or use SAS).
105+
Otherwise by default will create storage container.
106+
Expect a container URL like: https://<account>.blob.core.windows.net/<container>
102107
`output_storage_container_sas` (string) [default=None]::: If not null, shared access signature token (query string) to use when writing results to the output storage container. Set this when the container is in an external tenant (the owner of that container will provide the value).
103108
`tenants_dir_path` (string) [default=./tenants]::: Relative path to directory containing tenant configuration files in yaml
104109
`container_registry` (object) [default=None]::: Credentials for logging into registry with container image
105110
`container_image` (string) [default=ghcr.io/cisagov/scubaconnect-m365:latest]::: Docker image to use for running ScubaGear.
106111
`container_memory_gb` (number) [default=3]::: Amount of memory to allocate for ScubaGear container. Due to memory leaks in some dependencies, this may need to be increased if running on many tenants
107112
`secondary_app_info` (object) [default=None]::: Information for a secondary app. This can be used for one ScubaConnect instance to handle multiple environments (e.g., GCC and GCC High).
108-
To use, manually create an app in the other environment and add the certificate created for the primary app to it.
109-
Set `environment_to_use` to the environment the manual app is in, either "commericial" or "gcchigh"
113+
To use, manually create an app in the other environment and add the certificate created for the primary app to it.
114+
Set `environment_to_use` to the environment the manual app is in, either "commericial" or "gcchigh"
110115

111116
[#onboard]
112117
=== Onboarding a Tenant

m365/image/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ SHELL ["powershell"]
33

44

55
ARG SCUBAGEAR_VERSION=1.7.1
6-
ARG OPA_VERSION=1.9.0
6+
ARG OPA_VERSION=1.14.1
77
# Get static URL for current version: curl -s -D- https://aka.ms/downloadazcopy-v10-windows | grep ^Location
88
# https://learn.microsoft.com/en-us/azure/storage/common/storage-use-azcopy-v10?tabs=dnf#obtain-a-static-download-link
9-
ARG AZCOPY_URL=https://github.com/Azure/azure-storage-azcopy/releases/download/v10.30.1/azcopy_windows_amd64_10.30.1.zip
9+
ARG AZCOPY_URL=https://github.com/Azure/azure-storage-azcopy/releases/download/v10.32.2/azcopy_windows_amd64_10.32.2.zip
1010

1111
LABEL scubagear_version=${SCUBAGEAR_VERSION}
1212

m365/terraform/env/example/main.tf

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,25 @@
11
module "scuba_connect" {
22
source = "../.."
3-
app_name = var.app_name
4-
app_multi_tenant = var.app_multi_tenant
5-
image_path = var.image_path
63
contact_emails = var.contact_emails
74
resource_group_name = var.resource_group_name
8-
serial_number = var.serial_number
95
location = var.location
106
schedule_interval = var.schedule_interval
11-
tenants_dir_path = var.tenants_dir_path
7+
app_name = var.app_name
8+
app_multi_tenant = var.app_multi_tenant
129
vnet = var.vnet
13-
container_image = var.container_image
14-
container_registry = var.container_registry
10+
firewall = var.firewall
11+
tags = var.tags
12+
serial_number = var.serial_number
13+
image_path = var.image_path
14+
output_all_files = var.output_all_files
15+
create_app = var.create_app
16+
prefix_override = var.prefix_override
1517
input_storage_container_url = var.input_storage_container_url
1618
output_storage_container_url = var.output_storage_container_url
17-
output_all_files = var.output_all_files
18-
tags = var.tags
19+
output_storage_container_sas = var.output_storage_container_sas
20+
tenants_dir_path = var.tenants_dir_path
21+
container_registry = var.container_registry
22+
container_image = var.container_image
23+
container_memory_gb = var.container_memory_gb
1924
secondary_app_info = var.secondary_app_info
2025
}

m365/terraform/env/example/outputs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ output "output_storage_container_url" {
1010

1111
output "input_storage_container_url" {
1212
description = "URL of the input storage account configs are read from"
13-
value = module.scuba_connect.output_storage_container_url
13+
value = module.scuba_connect.input_storage_container_url
1414
}
1515

1616
output "sp_object_id" {

m365/terraform/env/example/variables.tf

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,29 @@ variable "prefix_override" {
102102
variable "input_storage_container_url" {
103103
default = null
104104
type = string
105-
description = "If not null, input container to read configs from (must give permissions to service account). Otherwise by default will create storage container. Expect an https url pointing to a container"
105+
description = <<-EOT
106+
If not null, input container to read configs from (must assign blob reader role role to service account `sp_object_id` manually).
107+
Otherwise by default will create storage container.
108+
Expect a container URL like: https://<account>.blob.core.windows.net/<container>
109+
Note that the container must have "adhoc" and "scheduled" directories. These are not created automatically in this case
110+
EOT
106111
}
107112

108113
variable "output_storage_container_url" {
109114
default = null
110115
type = string
111-
description = "If not null, output container to put results in (must give permissions to service account). Otherwise by default will create storage container. Expect an https url pointing to a container"
116+
description = <<-EOT
117+
If not null, output container to put results in (must give permissions to service account `sp_object_id` or use SAS).
118+
Otherwise by default will create storage container.
119+
Expect a container URL like: https://<account>.blob.core.windows.net/<container>
120+
EOT
121+
}
122+
123+
variable "output_storage_container_sas" {
124+
default = null
125+
type = string
126+
description = "If not null, shared access signature token (query string) to use when writing results to the output storage container. Set this when the container is in an external tenant (the owner of that container will provide the value)."
127+
sensitive = true
112128
}
113129

114130
variable "tenants_dir_path" {
@@ -142,12 +158,13 @@ variable "container_memory_gb" {
142158
error_message = "Container memory must be between 2GB and 16GB"
143159
}
144160
}
161+
145162
variable "secondary_app_info" {
146-
description = <<EOF
163+
description = <<-EOT
147164
Information for a secondary app. This can be used for one ScubaConnect instance to handle multiple environments (e.g., GCC and GCC High).
148165
To use, manually create an app in the other environment and add the certificate created for the primary app to it.
149166
Set `environment_to_use` to the environment the manual app is in, either "commericial" or "gcchigh"
150-
EOF
167+
EOT
151168
type = object({
152169
app_id = string
153170
environment_to_use = string
@@ -157,4 +174,4 @@ variable "secondary_app_info" {
157174
condition = var.secondary_app_info == null ? true : contains(["commercial", "gcchigh"], var.secondary_app_info.environment_to_use)
158175
error_message = "Valid values for create_mode are (Default, PointInTimeRestore, Replica)"
159176
}
160-
}
177+
}

m365/terraform/main.tf

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@ locals {
1616
}
1717

1818
resource "azurerm_log_analytics_workspace" "monitor_law" {
19-
name = "${local.name}-monitor-loganalytics"
20-
location = var.location
21-
resource_group_name = azurerm_resource_group.rg.name
22-
sku = "PerGB2018"
23-
retention_in_days = 90
19+
name = "${local.name}-monitor-loganalytics"
20+
location = var.location
21+
resource_group_name = azurerm_resource_group.rg.name
22+
sku = "PerGB2018"
23+
retention_in_days = 90
24+
local_authentication_enabled = true
2425

2526
lifecycle {
2627
ignore_changes = [tags]

m365/terraform/modules/container/storage.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ resource "azurerm_storage_container" "input" {
6161
}
6262

6363
resource "azurerm_storage_blob" "keep_files" {
64-
for_each = local.container_types
64+
for_each = toset([for l in local.container_types : l if var.input_storage_container_url == null])
6565
name = "${each.key}/.keep"
6666
storage_account_name = azurerm_storage_account.storage[0].name
6767
storage_container_name = azurerm_storage_container.input[0].name
@@ -78,7 +78,7 @@ resource "azurerm_storage_blob" "keep_files" {
7878

7979
# Blobs containing configuration for each tenant
8080
resource "azurerm_storage_blob" "tenants" {
81-
for_each = { for typeFile in setproduct(local.container_types, fileset(var.tenants_dir_path, "*")): "${typeFile[0]}/${typeFile[1]}" => typeFile[1] }
81+
for_each = { for typeFile in setproduct(local.container_types, fileset(var.tenants_dir_path, "*")) : "${typeFile[0]}/${typeFile[1]}" => typeFile[1] if var.input_storage_container_url == null }
8282
name = each.key
8383
storage_account_name = azurerm_storage_account.storage[0].name
8484
storage_container_name = azurerm_storage_container.input[0].name
@@ -95,4 +95,4 @@ resource "azurerm_storage_blob" "tenants" {
9595
locals {
9696
input_storage_container_url = var.input_storage_container_url == null ? "${azurerm_storage_account.storage[0].primary_blob_endpoint}${azurerm_storage_container.input[0].name}" : var.input_storage_container_url
9797
output_storage_container_url = var.output_storage_container_url == null ? "${azurerm_storage_account.storage[0].primary_blob_endpoint}${azurerm_storage_container.output[0].name}" : var.output_storage_container_url
98-
}
98+
}

m365/terraform/modules/container/variables.tf

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,22 @@ variable "schedule_interval" {
2525
variable "input_storage_container_url" {
2626
default = null
2727
type = string
28-
description = "If not null, input container to read configs from (must give permissions to service account). Otherwise by default will create storage container. Expect an https url pointing to a container"
28+
description = <<-EOT
29+
If not null, input container to read configs from (must assign blob reader role role to service account `sp_object_id` manually).
30+
Otherwise by default will create storage container.
31+
Expect a container URL like: https://<account>.blob.core.windows.net/<container>
32+
Note that the container must have "adhoc" and "scheduled" directories. These are not created automatically in this case
33+
EOT
2934
}
3035

3136
variable "output_storage_container_url" {
3237
default = null
3338
type = string
34-
description = "If not null, output container to put results in (must give permissions to service account or use SAS). Otherwise by default will create storage container. Expect an https url pointing to a container"
39+
description = <<-EOT
40+
If not null, output container to put results in (must give permissions to service account `sp_object_id` or use SAS).
41+
Otherwise by default will create storage container.
42+
Expect a container URL like: https://<account>.blob.core.windows.net/<container>
43+
EOT
3544
}
3645

3746
variable "output_storage_container_sas" {
@@ -123,11 +132,11 @@ variable "cert_info" {
123132
}
124133

125134
variable "secondary_app_info" {
126-
description = <<EOF
135+
description = <<-EOT
127136
Information for a secondary app. This can be used for one ScubaConnect instance to handle multiple environments (e.g., GCC and GCC High).
128137
To use, manually create an app in the other environment and add the certificate created for the primary app to it.
129138
Set `environment_to_use` to the environment the manual app is in, either "commericial" or "gcchigh"
130-
EOF
139+
EOT
131140
type = object({
132141
app_id = string
133142
environment_to_use = string

m365/terraform/outputs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ output "output_storage_container_url" {
1010

1111
output "input_storage_container_url" {
1212
description = "URL of the input storage account configs are read from"
13-
value = module.container.output_storage_container_url
13+
value = module.container.input_storage_container_url
1414
}
1515

1616
output "sp_object_id" {

m365/terraform/variables.tf

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,22 @@ variable "prefix_override" {
102102
variable "input_storage_container_url" {
103103
default = null
104104
type = string
105-
description = "If not null, input container to read configs from (must give permissions to service account). Otherwise by default will create storage container. Expect an https url pointing to a container"
105+
description = <<-EOT
106+
If not null, input container to read configs from (must assign blob reader role role to service account `sp_object_id` manually).
107+
Otherwise by default will create storage container.
108+
Expect a container URL like: https://<account>.blob.core.windows.net/<container>
109+
Note that the container must have "adhoc" and "scheduled" directories. These are not created automatically in this case
110+
EOT
106111
}
107112

108113
variable "output_storage_container_url" {
109114
default = null
110115
type = string
111-
description = "If not null, output container to put results in (must give permissions to service account or use SAS). Otherwise by default will create storage container. Expect an https url pointing to a container"
116+
description = <<-EOT
117+
If not null, output container to put results in (must give permissions to service account `sp_object_id` or use SAS).
118+
Otherwise by default will create storage container.
119+
Expect a container URL like: https://<account>.blob.core.windows.net/<container>
120+
EOT
112121
}
113122

114123
variable "output_storage_container_sas" {
@@ -151,11 +160,11 @@ variable "container_memory_gb" {
151160
}
152161

153162
variable "secondary_app_info" {
154-
description = <<EOF
163+
description = <<-EOT
155164
Information for a secondary app. This can be used for one ScubaConnect instance to handle multiple environments (e.g., GCC and GCC High).
156165
To use, manually create an app in the other environment and add the certificate created for the primary app to it.
157166
Set `environment_to_use` to the environment the manual app is in, either "commericial" or "gcchigh"
158-
EOF
167+
EOT
159168
type = object({
160169
app_id = string
161170
environment_to_use = string
@@ -165,4 +174,4 @@ variable "secondary_app_info" {
165174
condition = var.secondary_app_info == null ? true : contains(["commercial", "gcchigh"], var.secondary_app_info.environment_to_use)
166175
error_message = "Valid values for create_mode are (Default, PointInTimeRestore, Replica)"
167176
}
168-
}
177+
}

0 commit comments

Comments
 (0)