-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Added comments and separate example for existing private dns zon…
…e case
- Loading branch information
Showing
6 changed files
with
304 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
88 changes: 88 additions & 0 deletions
88
_example/with_existing_dns_zone/dns_zone_in_diff_resource_grp/example.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
provider "azurerm" { | ||
features {} | ||
} | ||
|
||
##----------------------------------------------------------------------------- | ||
## Virtual Network module call. | ||
## Virtual Network for which subnet will be created for private endpoint and vnet link will be created in private dns zone. | ||
##----------------------------------------------------------------------------- | ||
module "resource_group" { | ||
source = "clouddrove/resource-group/azure" | ||
version = "1.0.2" | ||
|
||
name = "app" | ||
environment = "test" | ||
label_order = ["name", "environment"] | ||
location = "East US" | ||
} | ||
|
||
##----------------------------------------------------------------------------- | ||
## Resource Group module call | ||
## Resource group in which all resources will be deployed. | ||
##----------------------------------------------------------------------------- | ||
module "vnet" { | ||
depends_on = [module.resource_group] | ||
source = "clouddrove/vnet/azure" | ||
version = "1.0.2" | ||
|
||
name = "app" | ||
environment = "test" | ||
resource_group_name = module.resource_group.resource_group_name | ||
location = module.resource_group.resource_group_location | ||
address_space = "10.0.0.0/16" | ||
} | ||
|
||
##----------------------------------------------------------------------------- | ||
## Subnet module call. | ||
## Subnet in which private endpoint will be created. | ||
##----------------------------------------------------------------------------- | ||
module "subnet" { | ||
source = "clouddrove/subnet/azure" | ||
version = "1.0.2" | ||
|
||
name = "app" | ||
environment = "test" | ||
resource_group_name = module.resource_group.resource_group_name | ||
location = module.resource_group.resource_group_location | ||
virtual_network_name = join("", module.vnet.vnet_name) | ||
|
||
#subnet | ||
subnet_names = ["subnet1"] | ||
subnet_prefixes = ["10.0.0.0/20"] | ||
|
||
# route_table | ||
routes = [ | ||
{ | ||
name = "rt-test" | ||
address_prefix = "0.0.0.0/0" | ||
next_hop_type = "Internet" | ||
} | ||
] | ||
} | ||
|
||
|
||
##----------------------------------------------------------------------------- | ||
## ACR module call. | ||
##----------------------------------------------------------------------------- | ||
module "container-registry" { | ||
source = "../" | ||
name = "acr" # Name used for specifying tags and other resources naming.(like private endpoint, vnet-link etc) | ||
environment = "test" | ||
resource_group_name = module.resource_group.resource_group_name | ||
location = module.resource_group.resource_group_location | ||
container_registry_config = { | ||
name = "cdacr1234" # Name of Container Registry | ||
sku = "Premium" | ||
} | ||
##----------------------------------------------------------------------------- | ||
## To be mentioned for private endpoint, because private endpoint is enabled by default. | ||
## To disable private endpoint set 'enable_private_endpoint' variable = false and than no need to specify following variable | ||
##----------------------------------------------------------------------------- | ||
virtual_network_id = join("", module.vnet.vnet_id) | ||
subnet_id = module.subnet.default_subnet_id | ||
##----------------------------------------------------------------------------- | ||
## Specify following variales when private dns zone is in same subscription but in different resource group | ||
##----------------------------------------------------------------------------- | ||
existing_private_dns_zone = "privatelink.azurecr.io" # Name of private dns zone remain same for acr. | ||
existing_private_dns_zone_resource_group_name = "example_test_rg" | ||
} |
93 changes: 93 additions & 0 deletions
93
_example/with_existing_dns_zone/dns_zone_in_diff_subs/example.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
provider "azurerm" { | ||
features {} | ||
} | ||
|
||
|
||
##----------------------------------------------------------------------------- | ||
## Virtual Network module call. | ||
## Virtual Network in which subnet will be created for private endpoint and for which vnet link will be created in private dns zone. | ||
##----------------------------------------------------------------------------- | ||
module "resource_group" { | ||
source = "clouddrove/resource-group/azure" | ||
version = "1.0.2" | ||
|
||
name = "app" | ||
environment = "test" | ||
label_order = ["name", "environment"] | ||
location = "East US" | ||
} | ||
|
||
|
||
##----------------------------------------------------------------------------- | ||
## Resource Group module call | ||
## Resource group in which all resources will be deployed. | ||
##----------------------------------------------------------------------------- | ||
module "vnet" { | ||
depends_on = [module.resource_group] | ||
source = "clouddrove/vnet/azure" | ||
version = "1.0.2" | ||
|
||
name = "app" | ||
environment = "test" | ||
resource_group_name = module.resource_group.resource_group_name | ||
location = module.resource_group.resource_group_location | ||
address_space = "10.0.0.0/16" | ||
} | ||
|
||
|
||
##----------------------------------------------------------------------------- | ||
## Subnet module call. | ||
## Subnet in which private endpoint will be created. | ||
##----------------------------------------------------------------------------- | ||
module "subnet" { | ||
source = "clouddrove/subnet/azure" | ||
version = "1.0.2" | ||
|
||
name = "app" | ||
environment = "test" | ||
resource_group_name = module.resource_group.resource_group_name | ||
location = module.resource_group.resource_group_location | ||
virtual_network_name = join("", module.vnet.vnet_name) | ||
|
||
#subnet | ||
subnet_names = ["subnet1"] | ||
subnet_prefixes = ["10.0.0.0/20"] | ||
|
||
# route_table | ||
routes = [ | ||
{ | ||
name = "rt-test" | ||
address_prefix = "0.0.0.0/0" | ||
next_hop_type = "Internet" | ||
} | ||
] | ||
} | ||
|
||
|
||
##----------------------------------------------------------------------------- | ||
## ACR module call. | ||
##----------------------------------------------------------------------------- | ||
module "container-registry" { | ||
source = "../" | ||
name = "acr" # Name used for specifying tags and other resources naming.(like private endpoint, vnet-link etc) | ||
environment = "test" | ||
resource_group_name = module.resource_group.resource_group_name | ||
location = module.resource_group.resource_group_location | ||
container_registry_config = { | ||
name = "cdacr1234" # Name of Container Registry | ||
sku = "Premium" | ||
} | ||
##----------------------------------------------------------------------------- | ||
## To be mentioned for private endpoint, because private endpoint is enabled by default. | ||
## To disable private endpoint set 'enable_private_endpoint' variable = false and than no need to specify following variable | ||
##----------------------------------------------------------------------------- | ||
virtual_network_id = join("", module.vnet.vnet_id) | ||
subnet_id = module.subnet.default_subnet_id | ||
##----------------------------------------------------------------------------- | ||
## Specify following variales when private dns zone is in different subscription. | ||
##----------------------------------------------------------------------------- | ||
diff_sub = true | ||
alias_sub = "35XXXXXXXXXXXX67" # Subcription id in which dns zone is present. | ||
existing_private_dns_zone = "privatelink.azurecr.io" # Name of private dns zone remain same for acr. | ||
existing_private_dns_zone_resource_group_name = "example_test_rg" | ||
} |
Oops, something went wrong.