-
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 complete example for module and updated basic example
- Loading branch information
Showing
2 changed files
with
85 additions
and
60 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
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,82 @@ | ||
provider "azurerm" { | ||
features {} | ||
} | ||
|
||
locals { | ||
name = "app" | ||
environment = "test" | ||
} | ||
|
||
##----------------------------------------------------------------------------- | ||
## 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 = local.name | ||
environment = local.environment | ||
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 = local.name | ||
environment = local.environment | ||
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 = local.name | ||
environment = local.environment | ||
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 = local.name # Name used for specifying tags and other resources naming.(like private endpoint, vnet-link etc) | ||
environment = local.environment | ||
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 | ||
} |