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

remove admin_enabled #131

Merged
merged 8 commits into from
Aug 26, 2024
Merged
Changes from all commits
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
17 changes: 11 additions & 6 deletions operations/template/app.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ resource "azurerm_container_registry" "registry" {
resource_group_name = data.azurerm_resource_group.group.name
location = data.azurerm_resource_group.group.location
sku = "Standard"
admin_enabled = true

lifecycle {
ignore_changes = [
Expand All @@ -14,6 +13,12 @@ resource "azurerm_container_registry" "registry" {
}
}

resource "azurerm_role_assignment" "allow_app_to_pull_from_registry" {
principal_id = azurerm_linux_web_app.sftp.identity.0.principal_id
role_definition_name = "AcrPull"
scope = azurerm_container_registry.registry.id
}

# Create the staging service plan
resource "azurerm_service_plan" "plan" {
name = "cdc-rs-sftp-${var.environment}-service-plan"
Expand Down Expand Up @@ -53,6 +58,8 @@ resource "azurerm_linux_web_app" "sftp" {
health_check_path = "/health"
health_check_eviction_time_in_min = 5

container_registry_use_managed_identity = true
Copy link
Member

Choose a reason for hiding this comment

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

Down below on what is currently line 84 and 85, we have...

DOCKER_REGISTRY_SERVER_USERNAME = azurerm_container_registry.registry.admin_username
DOCKER_REGISTRY_SERVER_PASSWORD = azurerm_container_registry.registry.admin_password

Can we remove those lines and this continues to work?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can try it and find out 😅


scm_use_main_ip_restriction = local.cdc_domain_environment ? true : null

dynamic "ip_restriction" {
Expand All @@ -79,11 +86,9 @@ resource "azurerm_linux_web_app" "sftp" {
}

app_settings = {
DOCKER_REGISTRY_SERVER_URL = "https://${azurerm_container_registry.registry.login_server}"
DOCKER_REGISTRY_SERVER_USERNAME = azurerm_container_registry.registry.admin_username
DOCKER_REGISTRY_SERVER_PASSWORD = azurerm_container_registry.registry.admin_password
WEBSITES_PORT = 8080
PORT = 8080
DOCKER_REGISTRY_SERVER_URL = "https://${azurerm_container_registry.registry.login_server}"
WEBSITES_PORT = 8080
PORT = 8080

ENV = var.environment
AZURE_STORAGE_CONNECTION_STRING = azurerm_storage_account.storage.primary_blob_connection_string
Expand Down
Loading