Skip to content

Commit

Permalink
Merge pull request #31 from clouddrove/fix/provider
Browse files Browse the repository at this point in the history
Fix/provider
  • Loading branch information
d4kverma authored Jul 29, 2024
2 parents b799ed5 + 3349c74 commit b0da5ab
Show file tree
Hide file tree
Showing 11 changed files with 123 additions and 40 deletions.
15 changes: 14 additions & 1 deletion _example/basic/example.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
provider "azurerm" {
features {}
subscription_id = "01111111111110-11-11-11-11"
skip_provider_registration = "true"
}

provider "azurerm" {
features {}
alias = "peer"
subscription_id = "01111111111110-11-11-11-11"
skip_provider_registration = "true"
}

locals {
Expand All @@ -11,6 +20,10 @@ locals {
## ACR module call.
##-----------------------------------------------------------------------------
module "container-registry" {
providers = {
azurerm.dns_sub = azurerm.peer,
azurerm.main_sub = azurerm
}
source = "../../"
name = local.name # Name used for specifying tags and other resources naming.(like private endpoint, vnet-link etc)
environment = local.environment
Expand All @@ -27,4 +40,4 @@ module "container-registry" {
virtual_network_id = "vnet_id"
subnet_id = "subnet_id"
enable_diagnostic = false
}
}
44 changes: 40 additions & 4 deletions _example/complete/example.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
provider "azurerm" {
features {}
subscription_id = "01111111111110-11-11-11-11"
skip_provider_registration = "true"
}

provider "azurerm" {
features {}
alias = "peer"
subscription_id = "01111111111110-11-11-11-11"
skip_provider_registration = "true"
}


data "azurerm_client_config" "current_client_config" {}

locals {
Expand Down Expand Up @@ -43,7 +53,7 @@ module "vnet" {
##-----------------------------------------------------------------------------
module "subnet" {
source = "clouddrove/subnet/azure"
version = "1.1.0"
version = "1.2.0"
name = local.name
environment = local.environment
resource_group_name = module.resource_group.resource_group_name
Expand Down Expand Up @@ -77,10 +87,18 @@ module "log-analytics" {
log_analytics_workspace_location = module.resource_group.resource_group_location
}


#########Following to be uncommnented only when using DNS Zone from different subscription along with existing DNS zone.
# data "azurerm_private_dns_zone" "existing_dns_zone" {
# name = "privatelink.azurecr.io" # The name of your DNS Zone
# resource_group_name = "dns-rg" # The resource group where existing the DNS Zone is located
# }


module "vault" {
source = "clouddrove/key-vault/azure"
version = "1.1.0"
name = "apptest4rds3474"
name = "apptest4rds3477"
environment = local.environment
resource_group_name = module.resource_group.resource_group_name
location = module.resource_group.resource_group_location
Expand All @@ -104,29 +122,47 @@ module "vault" {
log_analytics_workspace_id = module.log-analytics.workspace_id ## when diagnostic_setting_enable = true, need to add log analytics workspace id
}


##-----------------------------------------------------------------------------
## ACR module call.
##-----------------------------------------------------------------------------
module "container-registry" {
providers = {
azurerm.dns_sub = azurerm.peer,
azurerm.main_sub = azurerm
}
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 = "Basic"
name = "cdacr1232" # Name of Container Registry
sku = "Premium"
}
log_analytics_workspace_id = module.log-analytics.workspace_id

##-----------------------------------------------------------------------------
## 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 = module.vnet.vnet_id
subnet_id = module.subnet.default_subnet_id[0]
########Following to be uncommnented only when using DNS Zone from different subscription along with existing DNS zone.

# diff_sub = true
# alias = ""


#########Following to be uncommmented when using DNS zone from different resource group or different subscription.
#existing_private_dns_zone = "privatelink.azurecr.io"
#existing_private_dns_zone_resource_group_name = "dns-rg"
#existing_private_dns_zone_id = [data.azurerm_private_dns_zone.existing_dns_zone.id]

##if encryption is enabled.
encryption = true
enable_content_trust = false
key_vault_rbac_auth_enabled = true
key_vault_id = module.vault.id
}

4 changes: 2 additions & 2 deletions _example/complete/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">=3.85.0"
version = ">=3.102.0"
}
}
}
}
25 changes: 23 additions & 2 deletions _example/with_existing_dns_zone_in_diff_rg/example.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
provider "azurerm" {
features {}
subscription_id = "01111111111110-11-11-11-11"
skip_provider_registration = "true"
}

provider "azurerm" {
features {}
alias = "peer"
subscription_id = "01111111111110-11-11-11-11"
skip_provider_registration = "true"
}

locals {
Expand Down Expand Up @@ -41,7 +50,7 @@ module "vnet" {
##-----------------------------------------------------------------------------
module "subnet" {
source = "clouddrove/subnet/azure"
version = "1.1.0"
version = "1.2.0"
name = local.name
environment = local.environment
resource_group_name = module.resource_group.resource_group_name
Expand Down Expand Up @@ -77,10 +86,21 @@ module "log-analytics" {
log_analytics_workspace_location = module.resource_group.resource_group_location
}


#########Following to be uncommnented only when using DNS Zone from different subscription along with existing DNS zone.
data "azurerm_private_dns_zone" "existing_dns_zone" {
name = "privatelink.azurecr.io" # The name of your DNS Zone
resource_group_name = "example-rg" # The resource group where existing the DNS Zone is located
}

##-----------------------------------------------------------------------------
## ACR module call.
##-----------------------------------------------------------------------------
module "container-registry" {
providers = {
azurerm.dns_sub = azurerm.peer,
azurerm.main_sub = azurerm
}
source = "../../"
name = local.name # Name used for specifying tags and other resources naming.(like private endpoint, vnet-link etc)
environment = local.environment
Expand All @@ -101,5 +121,6 @@ module "container-registry" {
## 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"
existing_private_dns_zone_resource_group_name = "example-rg"
existing_private_dns_zone_id = [data.azurerm_private_dns_zone.existing_dns_zone.id]
}
4 changes: 2 additions & 2 deletions _example/with_existing_dns_zone_in_diff_rg/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">=3.85.0"
version = ">=3.102.0"
}
}
}
}
25 changes: 23 additions & 2 deletions _example/with_existing_dns_zone_in_diff_subs/example.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
provider "azurerm" {
features {}
subscription_id = "01111111111110-11-11-11-11"
skip_provider_registration = "true"
}

provider "azurerm" {
features {}
alias = "peer"
subscription_id = "01111111111110-11-11-11-11"
skip_provider_registration = "true"
}
locals {
name = "app"
environment = "test"
Expand Down Expand Up @@ -42,7 +50,7 @@ module "vnet" {
##-----------------------------------------------------------------------------
module "subnet" {
source = "clouddrove/subnet/azure"
version = "1.1.0"
version = "1.2.0"
name = local.name
environment = local.environment
resource_group_name = module.resource_group.resource_group_name
Expand Down Expand Up @@ -76,10 +84,23 @@ module "log-analytics" {
log_analytics_workspace_location = module.resource_group.resource_group_location
}

##----------------------------------------------------------------------------
## Existing DNS zone
#-----------------------------------------------------------------------------
data "azurerm_private_dns_zone" "existing_dns_zone" {
name = "privatelink.azurecr.io" # The name of your DNS Zone
resource_group_name = "dns-rg" # The resource group where existing the DNS Zone is located
}


##-----------------------------------------------------------------------------
## ACR module call.
##-----------------------------------------------------------------------------
module "container-registry" {
providers = {
azurerm.dns_sub = azurerm.peer,
azurerm.main_sub = azurerm
}
source = "../../"
name = local.name # Name used for specifying tags and other resources naming.(like private endpoint, vnet-link etc)
environment = local.environment
Expand All @@ -100,7 +121,7 @@ module "container-registry" {
## 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"
existing_private_dns_zone_id = [data.azurerm_private_dns_zone.existing_dns_zone.id]
}
2 changes: 1 addition & 1 deletion _example/with_existing_dns_zone_in_diff_subs/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">=3.85.0"
version = ">=3.102.0"
}
}
}
Loading

0 comments on commit b0da5ab

Please sign in to comment.