설명
Azure Container Instances에서 다른 Azure 서비스에 접속할 때 컨테이너 그룹의 관리 ID를 사용할 수 있습니다.
잠재적 영향
컨테이너 환경 변수나 배포 상태 파일에 남은 액세스 키가 유출되면 그 키로 다른 리소스에 접근할 수 있습니다.
해결 방법
컨테이너 그룹의 identity에 SystemAssigned를 설정하거나 UserAssigned와 identity_ids를 지정하세요. 대상 리소스에 필요한 역할을 부여하고 컨테이너가 관리 ID로 인증하도록 설정하세요.
예시
두 예제 모두 프라이빗 서브넷을 사용합니다. 대체한 키를 폐기하기 전에 컨테이너에서 대상에 연결해 필요한 작업을 수행할 수 있는지 확인하세요.
변경 전
hcl
resource "azurerm_container_group" "example" {
name = "example-continst"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
ip_address_type = "Private"
subnet_ids = [azurerm_subnet.aci.id]
os_type = "Linux"
container {
name = "app"
image = "nginx:stable"
cpu = "0.5"
memory = "1.5"
}
}
변경 후
hcl
resource "azurerm_container_group" "example" {
name = "example-continst"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
ip_address_type = "Private"
subnet_ids = [azurerm_subnet.aci.id]
os_type = "Linux"
identity {
type = "SystemAssigned"
}
container {
name = "app"
image = "nginx:stable"
cpu = "0.5"
memory = "1.5"
}
}