Skip to content

Commit ec90047

Browse files
committed
feat: acr with pre created vnet
1 parent f15f313 commit ec90047

File tree

5 files changed

+584
-127
lines changed

5 files changed

+584
-127
lines changed

modules/azure/container-registry/buildingblock/APP_TEAM_README.md

Lines changed: 113 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -104,36 +104,35 @@ This building block is for application teams that need a secure and reliable con
104104

105105
## Deployment Scenarios
106106

107-
### Public ACR (Default)
108-
```hcl
109-
module "acr" {
110-
source = "./buildingblock"
107+
### Scenario Matrix
111108

112-
acr_name = "mycompanyacr"
113-
resource_group_name = "acr-rg"
114-
location = "West Europe"
115-
sku = "Standard"
116-
admin_enabled = false
109+
This building block supports 4 deployment scenarios based on your networking and security requirements:
117110

118-
# Optional: IP allowlist
119-
allowed_ip_ranges = [
120-
"203.0.113.0/24", # Office network
121-
"198.51.100.5/32" # CI/CD runner
122-
]
111+
| # | Scenario | Private Endpoint | VNet Type | Hub Peering | Use Case |
112+
|---|----------|-----------------|-----------|-------------|----------|
113+
| **1** | **New VNet + Hub Peering** || New (created) | ✅ Created | Isolated workload needing hub/on-prem access |
114+
| **2** | **Existing Shared VNet** || Existing (shared) | ❌ Skipped | Multi-tenant with shared connectivity |
115+
| **3** | **Private Isolated** || New or Existing | ❌ None | Secure workload, same-VNet access only |
116+
| **4** | **Completely Public** || Not applicable | ❌ None | Dev/test, public CI/CD access |
123117

124-
tags = {
125-
Environment = "Production"
126-
CostCenter = "Engineering"
127-
}
128-
}
129-
```
118+
**Configuration Quick Reference:**
119+
120+
| Scenario | `private_endpoint_enabled` | `vnet_name` | `hub_vnet_name` |
121+
|----------|---------------------------|-------------|-----------------|
122+
| **1 - New VNet + Hub** | `true` | `null` | Set (creates peering) |
123+
| **2 - Existing Shared VNet** | `true` | Set (existing) | Omit/null (no peering) |
124+
| **3 - Private Isolated** | `true` | `null` or Set | `null` |
125+
| **4 - Public** | `false` | Any | Any |
126+
127+
---
128+
129+
### Scenario 1: New VNet + Hub Peering
130+
Ideal for isolated workloads that need connectivity to hub network and on-premises resources.
130131

131-
### Private ACR with Hub Connectivity
132132
```hcl
133133
provider "azurerm" {
134134
alias = "hub"
135135
subscription_id = "hub-subscription-id"
136-
# hub credentials
137136
}
138137
139138
module "acr" {
@@ -151,18 +150,17 @@ module "acr" {
151150
admin_enabled = false
152151
public_network_access_enabled = false
153152
154-
# Private endpoint settings
153+
# Private endpoint - creates new VNet
155154
private_endpoint_enabled = true
156155
private_dns_zone_id = "System"
157156
vnet_address_space = "10.250.0.0/16"
158157
subnet_address_prefix = "10.250.1.0/24"
159158
160-
# Hub connectivity
159+
# Hub connectivity - peering created automatically
161160
hub_subscription_id = "hub-subscription-id"
162161
hub_resource_group_name = "hub-network-rg"
163162
hub_vnet_name = "hub-vnet"
164163
165-
# Retention policy
166164
retention_days = 30
167165
trust_policy_enabled = true
168166
@@ -172,6 +170,96 @@ module "acr" {
172170
}
173171
```
174172

173+
### Scenario 2: Existing Shared Connectivity VNet
174+
Ideal for multi-tenant environments with a shared connectivity VNet already peered to hub.
175+
176+
```hcl
177+
module "acr" {
178+
source = "./buildingblock"
179+
180+
acr_name = "mycompanyacr"
181+
resource_group_name = "acr-rg"
182+
location = "West Europe"
183+
sku = "Premium"
184+
admin_enabled = false
185+
public_network_access_enabled = false
186+
187+
# Private endpoint in existing shared VNet
188+
private_endpoint_enabled = true
189+
private_dns_zone_id = "System"
190+
vnet_name = "shared-connectivity-vnet"
191+
existing_vnet_resource_group_name = "connectivity-rg"
192+
subnet_name = "acr-subnet"
193+
194+
# No hub peering - VNet already connected to hub
195+
# hub variables omitted
196+
197+
tags = {
198+
Environment = "Production"
199+
}
200+
}
201+
```
202+
203+
### Scenario 3: Private Isolated (No Hub)
204+
Ideal for secure workloads that only need access within the same VNet (e.g., AKS in same VNet).
205+
206+
```hcl
207+
module "acr" {
208+
source = "./buildingblock"
209+
210+
acr_name = "mycompanyacr"
211+
resource_group_name = "acr-rg"
212+
location = "West Europe"
213+
sku = "Premium"
214+
admin_enabled = false
215+
public_network_access_enabled = false
216+
217+
# Private endpoint - new isolated VNet
218+
private_endpoint_enabled = true
219+
private_dns_zone_id = "System"
220+
vnet_address_space = "10.250.0.0/16"
221+
subnet_address_prefix = "10.250.1.0/24"
222+
223+
# No hub connectivity
224+
# hub variables omitted
225+
226+
tags = {
227+
Environment = "Production"
228+
}
229+
}
230+
```
231+
232+
### Scenario 4: Completely Public ACR
233+
Ideal for development/test environments or public CI/CD pipelines.
234+
235+
```hcl
236+
module "acr" {
237+
source = "./buildingblock"
238+
239+
acr_name = "mycompanyacr"
240+
resource_group_name = "acr-rg"
241+
location = "West Europe"
242+
sku = "Standard" # Can use cheaper SKU
243+
admin_enabled = false
244+
public_network_access_enabled = true
245+
246+
# No private endpoint
247+
private_endpoint_enabled = false
248+
249+
# Optional: IP allowlist for security
250+
allowed_ip_ranges = [
251+
"203.0.113.0/24", # Office network
252+
"198.51.100.5/32" # CI/CD runner
253+
]
254+
255+
tags = {
256+
Environment = "Development"
257+
}
258+
}
259+
```
260+
261+
---
262+
175263
### Private ACR with AKS Integration
176264
```hcl
177265
module "aks" {

0 commit comments

Comments
 (0)