From 8e838a6790f9bd3bd6ab054f2d233b35b988c102 Mon Sep 17 00:00:00 2001 From: Aitor Murguzur Date: Wed, 23 Nov 2022 17:52:30 +0100 Subject: [PATCH] Make tests self-contained (#17) remove data dependencies --- .github/workflows/aks-cluster.yml | 2 +- .../workflows/analysis-services-server.yml | 2 +- .github/workflows/application-insights.yml | 2 +- .github/workflows/bastion-host.yml | 2 +- .github/workflows/cognitive-search.yml | 2 +- .github/workflows/cognitive-services.yml | 2 +- .github/workflows/container-registry.yml | 2 +- .github/workflows/cosmosdb-account.yml | 2 +- .github/workflows/data-factory.yml | 2 +- .github/workflows/event-hubs-namespace.yml | 2 +- .github/workflows/key-vault.yml | 2 +- .../machine-learning-compute-instance.yml | 2 +- .../machine-learning-synapse-spark.yml | 2 +- .../workflows/machine-learning-workspace.yml | 2 +- .github/workflows/mariadb-database.yml | 2 +- .github/workflows/mysql-database.yml | 2 +- .github/workflows/network-security-group.yml | 2 +- .github/workflows/network-security-rule.yml | 2 +- .github/workflows/postgresql-database.yml | 2 +- .github/workflows/private-dns-zone.yml | 2 +- .github/workflows/resource-group.yml | 2 +- .github/workflows/route-table.yml | 2 +- .github/workflows/route.yml | 2 +- .github/workflows/sql-database-server.yml | 2 +- .github/workflows/sql-database.yml | 2 +- .github/workflows/storage-account.yml | 2 +- ...net-network-security-group-association.yml | 2 +- .../subnet-route-table-association.yml | 2 +- .github/workflows/subnet.yml | 2 +- .../workflows/synapse-private-link-hub.yml | 2 +- .github/workflows/synapse-spark-pool.yml | 2 +- .github/workflows/synapse-sql-pool.yml | 2 +- .github/workflows/user-assigned-identity.yml | 2 +- .github/workflows/virtual-machine.yml | 2 +- .github/workflows/virtual-network.yml | 2 +- terraform/aks-cluster/main.tf | 3 +- terraform/aks-cluster/test/aks.tf | 13 +- terraform/aks-cluster/test/locals.tf | 7 + terraform/aks-cluster/test/outputs.tf | 1 - .../test/{main.tf => providers.tf} | 2 +- terraform/aks-cluster/test/unit_test.go | 1 - terraform/aks-cluster/test/variables.tf | 7 +- .../test/analysis_services_server.tf | 15 ++- .../analysis-services-server/test/locals.tf | 7 + .../test/{main.tf => providers.tf} | 2 +- .../test/variables.tf | 5 - .../analysis-services-server/variables.tf | 1 + .../test/application_insights.tf | 13 +- terraform/application-insights/test/locals.tf | 7 + .../test/{main.tf => providers.tf} | 2 +- .../application-insights/test/variables.tf | 5 - terraform/bastion-host/test/bastion_host.tf | 38 ++++-- terraform/bastion-host/test/locals.tf | 6 + .../test/{main.tf => providers.tf} | 2 +- terraform/bastion-host/test/variables.tf | 5 - terraform/bastion-host/variables.tf | 1 + .../cognitive-search/test/cognitive_search.tf | 49 +++++-- terraform/cognitive-search/test/locals.tf | 8 +- .../test/{main.tf => providers.tf} | 2 +- terraform/cognitive-search/test/variables.tf | 10 -- terraform/cognitive-search/variables.tf | 2 + .../test/cognitive_services.tf | 49 +++++-- terraform/cognitive-services/test/locals.tf | 10 +- .../test/{main.tf => providers.tf} | 2 +- .../cognitive-services/test/variables.tf | 10 -- terraform/cognitive-services/variables.tf | 2 + .../test/container_registry.tf | 49 +++++-- terraform/container-registry/test/locals.tf | 10 +- .../test/{main.tf => providers.tf} | 2 +- .../container-registry/test/variables.tf | 10 -- terraform/container-registry/variables.tf | 2 + terraform/cosmosdb/cosmosdb-account/main.tf | 2 +- .../cosmosdb-account/test/cosmosdb_account.tf | 15 ++- .../cosmosdb/cosmosdb-account/test/locals.tf | 5 + .../test/{main.tf => providers.tf} | 2 +- .../cosmosdb-account/test/variables.tf | 5 - .../cosmosdb/cosmosdb-account/variables.tf | 2 +- .../test/cosmosdb_cassandra_keyspace.tf | 60 ++++++--- .../test/locals.tf | 8 +- .../test/{main.tf => providers.tf} | 2 +- .../test/variables.tf | 12 +- .../cosmosdb-cassandra-keyspace/variables.tf | 6 +- .../test/cosmosdb_gremlin_database.tf | 60 ++++++--- .../cosmosdb-gremlin-database/test/locals.tf | 6 + .../test/{main.tf => providers.tf} | 2 +- .../test/variables.tf | 12 +- .../cosmosdb-gremlin-database/variables.tf | 6 +- .../test/cosmosdb_mongo_database.tf | 60 ++++++--- .../cosmosdb-mongo-database/test/locals.tf | 8 +- .../test/{main.tf => providers.tf} | 2 +- .../cosmosdb-mongo-database/test/variables.tf | 12 +- .../cosmosdb-mongo-database/variables.tf | 6 +- .../test/cosmosdb_sql_database.tf | 60 ++++++--- .../cosmosdb-sql-database/test/locals.tf | 6 + .../test/{main.tf => providers.tf} | 2 +- .../cosmosdb-sql-database/test/variables.tf | 12 +- .../cosmosdb-sql-database/variables.tf | 6 +- .../cosmosdb-table/test/cosmosdb_table.tf | 60 ++++++--- .../cosmosdb/cosmosdb-table/test/locals.tf | 8 +- .../test/{main.tf => providers.tf} | 2 +- .../cosmosdb/cosmosdb-table/test/variables.tf | 12 +- .../cosmosdb/cosmosdb-table/variables.tf | 6 +- .../kusto-cluster/test/kusto_cluster.tf | 49 +++++-- .../kusto-cluster/test/locals.tf | 8 +- .../test/providers.tf} | 4 +- .../kusto-cluster/test/variables.tf | 10 -- .../data-explorer/kusto-cluster/variables.tf | 2 + .../kusto-database/test/kusto_database.tf | 49 ++++++- .../kusto-database/test/locals.tf | 10 +- .../test/providers.tf} | 4 +- .../kusto-database/test/variables.tf | 5 - terraform/data-factory/test/data_factory.tf | 62 ++++++--- terraform/data-factory/test/locals.tf | 8 +- .../test/{main.tf => providers.tf} | 2 +- terraform/data-factory/test/variables.tf | 10 -- terraform/data-factory/variables.tf | 4 + terraform/databricks/main.tf | 122 +++-------------- terraform/databricks/test/databricks.tf | 124 ++++++++++++++++-- terraform/databricks/test/locals.tf | 8 +- .../databricks/test/{main.tf => providers.tf} | 3 +- terraform/databricks/test/variables.tf | 12 +- terraform/databricks/variables.tf | 51 +++++++ .../test/event_grid_domain.tf | 49 +++++-- .../event-grid-domain/test/locals.tf | 8 +- .../test/{main.tf => providers.tf} | 2 +- .../event-grid-domain/test/variables.tf | 10 -- .../event-grid/event-grid-domain/variables.tf | 2 + .../event-grid-topic/test/event_grid_topic.tf | 49 +++++-- .../event-grid-topic/test/locals.tf | 8 +- .../test/{main.tf => providers.tf} | 2 +- .../event-grid-topic/test/variables.tf | 10 -- .../event-grid/event-grid-topic/variables.tf | 2 + .../test/event_hubs_namespace.tf | 51 +++++-- .../event-hubs-namespace/test/locals.tf | 8 +- .../test/{main.tf => providers.tf} | 2 +- .../event-hubs-namespace/test/variables.tf | 10 -- .../event-hubs-namespace/variables.tf | 2 + .../hdinsight-hadoop/test/hdinsight_hadoop.tf | 121 ++++++++++++----- .../hdinsight/hdinsight-hadoop/test/locals.tf | 7 +- .../test/{main.tf => providers.tf} | 2 +- .../hdinsight-hadoop/test/variables.tf | 10 -- .../hdinsight-hbase/test/hdinsight_hbase.tf | 123 ++++++++++++----- .../hdinsight/hdinsight-hbase/test/locals.tf | 7 +- .../test/{main.tf => providers.tf} | 38 +++--- .../test/hdinsight_interactive.tf | 123 ++++++++++++----- .../hdinsight-interactive/test/locals.tf | 7 +- .../test/{main.tf => providers.tf} | 2 +- .../hdinsight-kafka/test/hdinsight_kafka.tf | 121 ++++++++++++----- .../hdinsight/hdinsight-kafka/test/locals.tf | 7 +- .../test/{main.tf => providers.tf} | 2 +- .../hdinsight-spark/test/hdinsight_spark.tf | 121 ++++++++++++----- .../hdinsight/hdinsight-spark/test/locals.tf | 7 +- .../test/{main.tf => providers.tf} | 2 +- terraform/key-vault/test/key_vault.tf | 52 ++++++-- terraform/key-vault/test/locals.tf | 8 +- .../key-vault/test/{main.tf => providers.tf} | 2 +- terraform/key-vault/test/variables.tf | 10 -- terraform/key-vault/variables.tf | 2 + .../log-analytics-workspace/test/locals.tf | 5 + .../test/log_analytics_workspace.tf | 13 +- .../test/{main.tf => providers.tf} | 2 +- .../log-analytics-workspace/test/variables.tf | 5 - .../outputs.tf | 10 +- .../test/locals.tf | 8 +- .../test/machine_learning_compute_cluster.tf | 104 +++++++++++++-- .../test/{main.tf => providers.tf} | 2 +- .../outputs.tf | 5 +- .../test/locals.tf | 8 +- .../test/machine_learning_compute_instance.tf | 103 +++++++++++++-- .../test/{main.tf => providers.tf} | 2 +- .../variables.tf | 2 +- .../test/locals.tf | 8 +- .../machine_learning_inference_cluster.tf | 121 +++++++++++------ .../test/{main.tf => providers.tf} | 2 +- .../variables.tf | 2 +- .../test/locals.tf | 8 +- .../test/machine_learning_synapse_spark.tf | 120 +++++++++++++++-- .../test/{main.tf => providers.tf} | 2 +- .../test/variables.tf | 9 +- .../variables.tf | 2 +- .../machine-learning-workspace/test/locals.tf | 8 +- .../test/machine_learning_workspace.tf | 71 ++++++---- .../test/{main.tf => providers.tf} | 2 +- .../machine-learning-workspace/variables.tf | 2 + terraform/mariadb-database/test/locals.tf | 8 +- .../mariadb-database/test/mariadb_database.tf | 52 ++++++-- .../test/{main.tf => providers.tf} | 2 +- terraform/mariadb-database/test/variables.tf | 10 -- terraform/mariadb-database/variables.tf | 3 + terraform/mysql-database/test/locals.tf | 8 +- .../mysql-database/test/mysql_database.tf | 52 ++++++-- .../test/{main.tf => providers.tf} | 2 +- terraform/mysql-database/test/variables.tf | 10 -- terraform/mysql-database/variables.tf | 3 + .../network-security-group/test/locals.tf | 5 + .../test/network_security_group.tf | 13 +- .../test/{main.tf => providers.tf} | 2 +- .../network-security-group/test/variables.tf | 5 - .../network-security-rule/test/locals.tf | 5 + .../test/network_security_rule.tf | 19 ++- .../test/{main.tf => providers.tf} | 2 +- .../network-security-rule/test/variables.tf | 10 +- terraform/postgresql-database/test/locals.tf | 8 +- .../test/postgresql_database.tf | 52 ++++++-- .../test/{main.tf => providers.tf} | 2 +- .../postgresql-database/test/variables.tf | 10 -- terraform/postgresql-database/variables.tf | 3 + terraform/private-dns-zone/test/locals.tf | 7 + .../private-dns-zone/test/private_dns_zone.tf | 24 +++- .../test/{main.tf => providers.tf} | 2 +- terraform/private-dns-zone/test/variables.tf | 17 +-- terraform/purview/main.tf | 6 + terraform/purview/test/locals.tf | 8 +- .../purview/test/{main.tf => providers.tf} | 2 +- terraform/purview/test/purview.tf | 60 ++++++--- terraform/purview/test/variables.tf | 12 +- terraform/purview/variables.tf | 3 + terraform/redis-cache/test/locals.tf | 8 +- .../test/{main.tf => providers.tf} | 2 +- terraform/redis-cache/test/redis_cache.tf | 52 ++++++-- terraform/redis-cache/test/variables.tf | 10 -- terraform/redis-cache/variables.tf | 3 + terraform/resource-group/test/locals.tf | 7 + .../test/{main.tf => providers.tf} | 2 +- .../resource-group/test/resource_group.tf | 2 +- terraform/route-table/test/locals.tf | 5 + .../test/{main.tf => providers.tf} | 2 +- terraform/route-table/test/route_table.tf | 13 +- terraform/route-table/test/variables.tf | 5 - terraform/route/test/locals.tf | 5 + .../route/test/{main.tf => providers.tf} | 2 +- terraform/route/test/route.tf | 19 ++- terraform/route/test/variables.tf | 11 +- .../service-bus-namespace/test/locals.tf | 8 +- .../test/{main.tf => providers.tf} | 2 +- .../test/service_bus_namespace.tf | 49 +++++-- .../service-bus-namespace/test/variables.tf | 10 -- .../service-bus-namespace/variables.tf | 2 + .../service-bus-queue/test/locals.tf | 5 + .../test/{main.tf => providers.tf} | 2 +- .../service-bus-subscription/test/locals.tf | 5 + .../test/{main.tf => providers.tf} | 2 +- .../service-bus-topic/test/locals.tf | 5 + .../test/{main.tf => providers.tf} | 2 +- terraform/sql-database-server/test/locals.tf | 8 +- .../test/{main.tf => providers.tf} | 2 +- .../test/sql_database_server.tf | 52 ++++++-- .../sql-database-server/test/variables.tf | 7 +- terraform/sql-database-server/variables.tf | 3 + terraform/sql-database/test/locals.tf | 7 + .../test/{main.tf => providers.tf} | 2 +- terraform/sql-database/test/sql_database.tf | 63 +++++++-- terraform/sql-database/test/variables.tf | 10 -- terraform/sql-database/variables.tf | 1 + terraform/storage-account/main.tf | 6 +- terraform/storage-account/test/locals.tf | 8 +- .../test/{main.tf => providers.tf} | 2 +- .../storage-account/test/storage_account.tf | 76 +++++++---- terraform/storage-account/test/variables.tf | 10 -- terraform/storage-account/variables.tf | 5 + .../test/locals.tf | 5 + .../test/{main.tf => providers.tf} | 2 +- ...bnet_network_security_group_association.tf | 38 +++++- .../test/variables.tf | 10 ++ .../variables.tf | 2 +- .../test/locals.tf | 5 + .../test/{main.tf => providers.tf} | 2 +- .../test/subnet_route_table_association.tf | 38 +++++- .../test/variables.tf | 10 ++ terraform/subnet/main.tf | 4 +- terraform/subnet/outputs.tf | 4 + terraform/subnet/test/locals.tf | 6 +- .../subnet/test/{main.tf => providers.tf} | 2 +- terraform/subnet/test/subnet.tf | 28 +++- terraform/subnet/test/variables.tf | 10 +- terraform/subnet/variables.tf | 4 +- .../synapse-private-link-hub/test/locals.tf | 8 +- .../test/{main.tf => providers.tf} | 2 +- .../test/synapse_private_link_hub.tf | 51 +++++-- .../test/variables.tf | 10 -- .../synapse-private-link-hub/variables.tf | 1 + .../synapse/synapse-spark-pool/test/locals.tf | 6 +- .../test/{main.tf => providers.tf} | 2 +- .../test/synapse_spark_pool.tf | 49 ++++++- .../synapse-spark-pool/test/variables.tf | 14 +- .../synapse/synapse-spark-pool/variables.tf | 1 + .../synapse/synapse-sql-pool/test/locals.tf | 6 +- .../test/{main.tf => providers.tf} | 2 +- .../synapse-sql-pool/test/synapse_sql_pool.tf | 49 ++++++- .../synapse-sql-pool/test/variables.tf | 14 +- .../synapse/synapse-sql-pool/variables.tf | 2 +- terraform/synapse/synapse-workspace/main.tf | 25 ++-- .../synapse/synapse-workspace/test/locals.tf | 10 +- .../test/{main.tf => providers.tf} | 2 +- .../test/synapse_workspace.tf | 116 +++++++++++----- .../synapse-workspace/test/variables.tf | 23 ---- .../synapse/synapse-workspace/variables.tf | 19 ++- .../user-assigned-identity/test/locals.tf | 7 + .../test/{main.tf => providers.tf} | 2 +- .../test/user_assigned_identity.tf | 13 +- .../user-assigned-identity/test/variables.tf | 5 - terraform/virtual-machine/test/locals.tf | 7 +- .../test/{main.tf => providers.tf} | 2 +- terraform/virtual-machine/test/variables.tf | 5 - .../virtual-machine/test/virtual_machine.tf | 37 ++++-- terraform/virtual-machine/variables.tf | 1 + terraform/virtual-network/main.tf | 12 +- terraform/virtual-network/test/locals.tf | 7 + .../test/{main.tf => providers.tf} | 3 +- terraform/virtual-network/test/variables.tf | 5 - .../virtual-network/test/virtual_network.tf | 15 ++- terraform/virtual-network/variables.tf | 12 ++ 312 files changed, 3279 insertions(+), 1424 deletions(-) create mode 100644 terraform/aks-cluster/test/locals.tf rename terraform/aks-cluster/test/{main.tf => providers.tf} (92%) create mode 100644 terraform/analysis-services-server/test/locals.tf rename terraform/analysis-services-server/test/{main.tf => providers.tf} (93%) create mode 100644 terraform/application-insights/test/locals.tf rename terraform/application-insights/test/{main.tf => providers.tf} (93%) rename terraform/bastion-host/test/{main.tf => providers.tf} (93%) rename terraform/cognitive-search/test/{main.tf => providers.tf} (93%) rename terraform/cognitive-services/test/{main.tf => providers.tf} (93%) rename terraform/container-registry/test/{main.tf => providers.tf} (93%) rename terraform/cosmosdb/cosmosdb-account/test/{main.tf => providers.tf} (93%) rename terraform/cosmosdb/cosmosdb-cassandra-keyspace/test/{main.tf => providers.tf} (93%) rename terraform/cosmosdb/cosmosdb-gremlin-database/test/{main.tf => providers.tf} (93%) rename terraform/cosmosdb/cosmosdb-mongo-database/test/{main.tf => providers.tf} (93%) rename terraform/cosmosdb/cosmosdb-sql-database/test/{main.tf => providers.tf} (93%) rename terraform/cosmosdb/cosmosdb-table/test/{main.tf => providers.tf} (93%) rename terraform/data-explorer/{kusto-database/test/main.tf => kusto-cluster/test/providers.tf} (77%) rename terraform/data-explorer/{kusto-cluster/test/main.tf => kusto-database/test/providers.tf} (77%) rename terraform/data-factory/test/{main.tf => providers.tf} (93%) rename terraform/databricks/test/{main.tf => providers.tf} (92%) rename terraform/event-grid/event-grid-domain/test/{main.tf => providers.tf} (93%) rename terraform/event-grid/event-grid-topic/test/{main.tf => providers.tf} (93%) rename terraform/event-hubs/event-hubs-namespace/test/{main.tf => providers.tf} (93%) rename terraform/hdinsight/hdinsight-hadoop/test/{main.tf => providers.tf} (93%) rename terraform/hdinsight/hdinsight-hbase/test/{main.tf => providers.tf} (88%) rename terraform/hdinsight/hdinsight-interactive/test/{main.tf => providers.tf} (93%) rename terraform/hdinsight/hdinsight-kafka/test/{main.tf => providers.tf} (93%) rename terraform/hdinsight/hdinsight-spark/test/{main.tf => providers.tf} (93%) rename terraform/key-vault/test/{main.tf => providers.tf} (92%) rename terraform/log-analytics/log-analytics-workspace/test/{main.tf => providers.tf} (93%) rename terraform/machine-learning/machine-learning-compute-cluster/test/{main.tf => providers.tf} (93%) rename terraform/machine-learning/machine-learning-compute-instance/test/{main.tf => providers.tf} (93%) rename terraform/machine-learning/machine-learning-inference-cluster/test/{main.tf => providers.tf} (93%) rename terraform/machine-learning/machine-learning-synapse-spark/test/{main.tf => providers.tf} (93%) rename terraform/machine-learning/machine-learning-workspace/test/{main.tf => providers.tf} (93%) rename terraform/mariadb-database/test/{main.tf => providers.tf} (93%) rename terraform/mysql-database/test/{main.tf => providers.tf} (93%) rename terraform/network-security-group/test/{main.tf => providers.tf} (93%) rename terraform/network-security-rule/test/{main.tf => providers.tf} (93%) rename terraform/postgresql-database/test/{main.tf => providers.tf} (93%) create mode 100644 terraform/private-dns-zone/test/locals.tf rename terraform/private-dns-zone/test/{main.tf => providers.tf} (93%) rename terraform/purview/test/{main.tf => providers.tf} (92%) rename terraform/redis-cache/test/{main.tf => providers.tf} (93%) create mode 100644 terraform/resource-group/test/locals.tf rename terraform/resource-group/test/{main.tf => providers.tf} (93%) rename terraform/route-table/test/{main.tf => providers.tf} (93%) rename terraform/route/test/{main.tf => providers.tf} (92%) rename terraform/service-bus/service-bus-namespace/test/{main.tf => providers.tf} (93%) rename terraform/service-bus/service-bus-queue/test/{main.tf => providers.tf} (93%) rename terraform/service-bus/service-bus-subscription/test/{main.tf => providers.tf} (93%) rename terraform/service-bus/service-bus-topic/test/{main.tf => providers.tf} (93%) rename terraform/sql-database-server/test/{main.tf => providers.tf} (93%) rename terraform/sql-database/test/{main.tf => providers.tf} (93%) rename terraform/storage-account/test/{main.tf => providers.tf} (93%) rename terraform/subnet-network-security-group-association/test/{main.tf => providers.tf} (93%) create mode 100644 terraform/subnet-network-security-group-association/test/variables.tf rename terraform/subnet-route-table-association/test/{main.tf => providers.tf} (93%) create mode 100644 terraform/subnet-route-table-association/test/variables.tf rename terraform/subnet/test/{main.tf => providers.tf} (92%) rename terraform/synapse/synapse-private-link-hub/test/{main.tf => providers.tf} (93%) rename terraform/synapse/synapse-spark-pool/test/{main.tf => providers.tf} (93%) rename terraform/synapse/synapse-sql-pool/test/{main.tf => providers.tf} (93%) rename terraform/synapse/synapse-workspace/test/{main.tf => providers.tf} (93%) create mode 100644 terraform/user-assigned-identity/test/locals.tf rename terraform/user-assigned-identity/test/{main.tf => providers.tf} (93%) rename terraform/virtual-machine/test/{main.tf => providers.tf} (93%) create mode 100644 terraform/virtual-network/test/locals.tf rename terraform/virtual-network/test/{main.tf => providers.tf} (92%) diff --git a/.github/workflows/aks-cluster.yml b/.github/workflows/aks-cluster.yml index c0d428d6..147c7207 100644 --- a/.github/workflows/aks-cluster.yml +++ b/.github/workflows/aks-cluster.yml @@ -72,6 +72,6 @@ jobs: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" - name: Unit-test - run: go test -v + run: go test -v -timeout 45m env: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" \ No newline at end of file diff --git a/.github/workflows/analysis-services-server.yml b/.github/workflows/analysis-services-server.yml index 45febdd7..1ffa94a1 100644 --- a/.github/workflows/analysis-services-server.yml +++ b/.github/workflows/analysis-services-server.yml @@ -72,6 +72,6 @@ jobs: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" - name: Unit-test - run: go test -v + run: go test -v -timeout 45m env: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" \ No newline at end of file diff --git a/.github/workflows/application-insights.yml b/.github/workflows/application-insights.yml index d713c456..20568af4 100644 --- a/.github/workflows/application-insights.yml +++ b/.github/workflows/application-insights.yml @@ -72,6 +72,6 @@ jobs: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" - name: Unit-test - run: go test -v + run: go test -v -timeout 45m env: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" \ No newline at end of file diff --git a/.github/workflows/bastion-host.yml b/.github/workflows/bastion-host.yml index f3741a82..77e179a5 100644 --- a/.github/workflows/bastion-host.yml +++ b/.github/workflows/bastion-host.yml @@ -72,6 +72,6 @@ jobs: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" - name: Unit-test - run: go test -v -timeout 30m + run: go test -v -timeout 45m env: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" \ No newline at end of file diff --git a/.github/workflows/cognitive-search.yml b/.github/workflows/cognitive-search.yml index 183ff177..0d30ef7b 100644 --- a/.github/workflows/cognitive-search.yml +++ b/.github/workflows/cognitive-search.yml @@ -72,6 +72,6 @@ jobs: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" - name: Unit-test - run: go test -v -timeout 30m + run: go test -v -timeout 45m env: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" \ No newline at end of file diff --git a/.github/workflows/cognitive-services.yml b/.github/workflows/cognitive-services.yml index 3b13291f..f6863e64 100644 --- a/.github/workflows/cognitive-services.yml +++ b/.github/workflows/cognitive-services.yml @@ -72,6 +72,6 @@ jobs: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" - name: Unit-test - run: go test -v + run: go test -v -timeout 45m env: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" \ No newline at end of file diff --git a/.github/workflows/container-registry.yml b/.github/workflows/container-registry.yml index 426e9cd1..8d2ad170 100644 --- a/.github/workflows/container-registry.yml +++ b/.github/workflows/container-registry.yml @@ -72,6 +72,6 @@ jobs: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" - name: Unit-test - run: go test -v + run: go test -v -timeout 45m env: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" \ No newline at end of file diff --git a/.github/workflows/cosmosdb-account.yml b/.github/workflows/cosmosdb-account.yml index 7be6963f..698068e3 100644 --- a/.github/workflows/cosmosdb-account.yml +++ b/.github/workflows/cosmosdb-account.yml @@ -72,6 +72,6 @@ jobs: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" - name: Unit-test - run: go test -v -timeout 30m + run: go test -v -timeout 45m env: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" \ No newline at end of file diff --git a/.github/workflows/data-factory.yml b/.github/workflows/data-factory.yml index 7663654c..5a3bb63d 100644 --- a/.github/workflows/data-factory.yml +++ b/.github/workflows/data-factory.yml @@ -73,6 +73,6 @@ jobs: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" - name: Unit-test - run: go test -v + run: go test -v -timeout 45m env: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" \ No newline at end of file diff --git a/.github/workflows/event-hubs-namespace.yml b/.github/workflows/event-hubs-namespace.yml index 6c8bfc71..9f50c2a3 100644 --- a/.github/workflows/event-hubs-namespace.yml +++ b/.github/workflows/event-hubs-namespace.yml @@ -72,6 +72,6 @@ jobs: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" - name: Unit-test - run: go test -v + run: go test -v -timeout 45m env: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" \ No newline at end of file diff --git a/.github/workflows/key-vault.yml b/.github/workflows/key-vault.yml index b605f684..724165ac 100644 --- a/.github/workflows/key-vault.yml +++ b/.github/workflows/key-vault.yml @@ -72,6 +72,6 @@ jobs: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" - name: Unit-test - run: go test -v + run: go test -v -timeout 45m env: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" \ No newline at end of file diff --git a/.github/workflows/machine-learning-compute-instance.yml b/.github/workflows/machine-learning-compute-instance.yml index c1a18db2..93e4acee 100644 --- a/.github/workflows/machine-learning-compute-instance.yml +++ b/.github/workflows/machine-learning-compute-instance.yml @@ -71,6 +71,6 @@ jobs: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" - name: Unit-test - run: go test -v + run: go test -v -timeout 45m env: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" \ No newline at end of file diff --git a/.github/workflows/machine-learning-synapse-spark.yml b/.github/workflows/machine-learning-synapse-spark.yml index 69b8c797..8cdbc805 100644 --- a/.github/workflows/machine-learning-synapse-spark.yml +++ b/.github/workflows/machine-learning-synapse-spark.yml @@ -72,6 +72,6 @@ jobs: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" - name: Unit-test - run: go test -v + run: go test -v -timeout 45m env: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" \ No newline at end of file diff --git a/.github/workflows/machine-learning-workspace.yml b/.github/workflows/machine-learning-workspace.yml index 4656bb60..d922c57b 100644 --- a/.github/workflows/machine-learning-workspace.yml +++ b/.github/workflows/machine-learning-workspace.yml @@ -72,6 +72,6 @@ jobs: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" - name: Unit-test - run: go test -v + run: go test -v -timeout 45m env: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" \ No newline at end of file diff --git a/.github/workflows/mariadb-database.yml b/.github/workflows/mariadb-database.yml index 1d6e2e88..1d6d70a7 100644 --- a/.github/workflows/mariadb-database.yml +++ b/.github/workflows/mariadb-database.yml @@ -72,6 +72,6 @@ jobs: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" - name: Unit-test - run: go test -v + run: go test -v -timeout 45m env: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" \ No newline at end of file diff --git a/.github/workflows/mysql-database.yml b/.github/workflows/mysql-database.yml index 32a97c45..53ed94ff 100644 --- a/.github/workflows/mysql-database.yml +++ b/.github/workflows/mysql-database.yml @@ -72,6 +72,6 @@ jobs: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" - name: Unit-test - run: go test -v + run: go test -v -timeout 45m env: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" \ No newline at end of file diff --git a/.github/workflows/network-security-group.yml b/.github/workflows/network-security-group.yml index 38ac7f94..60f5c29a 100644 --- a/.github/workflows/network-security-group.yml +++ b/.github/workflows/network-security-group.yml @@ -72,6 +72,6 @@ jobs: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" - name: Unit-test - run: go test -v + run: go test -v -timeout 45m env: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" \ No newline at end of file diff --git a/.github/workflows/network-security-rule.yml b/.github/workflows/network-security-rule.yml index ed26f823..5ffeb260 100644 --- a/.github/workflows/network-security-rule.yml +++ b/.github/workflows/network-security-rule.yml @@ -72,6 +72,6 @@ jobs: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" - name: Unit-test - run: go test -v + run: go test -v -timeout 45m env: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" \ No newline at end of file diff --git a/.github/workflows/postgresql-database.yml b/.github/workflows/postgresql-database.yml index b68f9753..366fccd6 100644 --- a/.github/workflows/postgresql-database.yml +++ b/.github/workflows/postgresql-database.yml @@ -72,6 +72,6 @@ jobs: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" - name: Unit-test - run: go test -v + run: go test -v -timeout 45m env: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" \ No newline at end of file diff --git a/.github/workflows/private-dns-zone.yml b/.github/workflows/private-dns-zone.yml index 2c0bc6d7..737ccf69 100644 --- a/.github/workflows/private-dns-zone.yml +++ b/.github/workflows/private-dns-zone.yml @@ -72,6 +72,6 @@ jobs: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" - name: Unit-test - run: go test -v + run: go test -v -timeout 45m env: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" \ No newline at end of file diff --git a/.github/workflows/resource-group.yml b/.github/workflows/resource-group.yml index 8216a361..85466590 100644 --- a/.github/workflows/resource-group.yml +++ b/.github/workflows/resource-group.yml @@ -72,6 +72,6 @@ jobs: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" - name: Unit-test - run: go test -v + run: go test -v -timeout 45m env: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" \ No newline at end of file diff --git a/.github/workflows/route-table.yml b/.github/workflows/route-table.yml index 71c836c9..cf8e44fa 100644 --- a/.github/workflows/route-table.yml +++ b/.github/workflows/route-table.yml @@ -72,6 +72,6 @@ jobs: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" - name: Unit-test - run: go test -v + run: go test -v -timeout 45m env: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" \ No newline at end of file diff --git a/.github/workflows/route.yml b/.github/workflows/route.yml index 3589126e..4dac2ba0 100644 --- a/.github/workflows/route.yml +++ b/.github/workflows/route.yml @@ -72,6 +72,6 @@ jobs: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" - name: Unit-test - run: go test -v + run: go test -v -timeout 45m env: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" \ No newline at end of file diff --git a/.github/workflows/sql-database-server.yml b/.github/workflows/sql-database-server.yml index 6c387218..c00bc36a 100644 --- a/.github/workflows/sql-database-server.yml +++ b/.github/workflows/sql-database-server.yml @@ -72,6 +72,6 @@ jobs: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" - name: Unit-test - run: go test -v + run: go test -v -timeout 45m env: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" \ No newline at end of file diff --git a/.github/workflows/sql-database.yml b/.github/workflows/sql-database.yml index 35f17295..283d096b 100644 --- a/.github/workflows/sql-database.yml +++ b/.github/workflows/sql-database.yml @@ -72,6 +72,6 @@ jobs: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" - name: Unit-test - run: go test -v + run: go test -v -timeout 45m env: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" \ No newline at end of file diff --git a/.github/workflows/storage-account.yml b/.github/workflows/storage-account.yml index b64775c5..c44df89f 100644 --- a/.github/workflows/storage-account.yml +++ b/.github/workflows/storage-account.yml @@ -72,6 +72,6 @@ jobs: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" - name: Unit-test - run: go test -v + run: go test -v -timeout 45m env: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" \ No newline at end of file diff --git a/.github/workflows/subnet-network-security-group-association.yml b/.github/workflows/subnet-network-security-group-association.yml index 7f24a858..91af1aff 100644 --- a/.github/workflows/subnet-network-security-group-association.yml +++ b/.github/workflows/subnet-network-security-group-association.yml @@ -72,6 +72,6 @@ jobs: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" - name: Unit-test - run: go test -v + run: go test -v -timeout 45m env: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" \ No newline at end of file diff --git a/.github/workflows/subnet-route-table-association.yml b/.github/workflows/subnet-route-table-association.yml index d5f763e2..ea941efa 100644 --- a/.github/workflows/subnet-route-table-association.yml +++ b/.github/workflows/subnet-route-table-association.yml @@ -72,6 +72,6 @@ jobs: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" - name: Unit-test - run: go test -v + run: go test -v -timeout 45m env: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" \ No newline at end of file diff --git a/.github/workflows/subnet.yml b/.github/workflows/subnet.yml index fd1d9829..7499dd74 100644 --- a/.github/workflows/subnet.yml +++ b/.github/workflows/subnet.yml @@ -72,6 +72,6 @@ jobs: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" - name: Unit-test - run: go test -v + run: go test -v -timeout 45m env: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" \ No newline at end of file diff --git a/.github/workflows/synapse-private-link-hub.yml b/.github/workflows/synapse-private-link-hub.yml index 4ee673b2..8f91632c 100644 --- a/.github/workflows/synapse-private-link-hub.yml +++ b/.github/workflows/synapse-private-link-hub.yml @@ -72,6 +72,6 @@ jobs: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" - name: Unit-test - run: go test -v + run: go test -v -timeout 45m env: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" \ No newline at end of file diff --git a/.github/workflows/synapse-spark-pool.yml b/.github/workflows/synapse-spark-pool.yml index e85b5cd5..3aae5f3b 100644 --- a/.github/workflows/synapse-spark-pool.yml +++ b/.github/workflows/synapse-spark-pool.yml @@ -72,6 +72,6 @@ jobs: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" - name: Unit-test - run: go test -v + run: go test -v -timeout 45m env: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" \ No newline at end of file diff --git a/.github/workflows/synapse-sql-pool.yml b/.github/workflows/synapse-sql-pool.yml index f3575a75..04e732de 100644 --- a/.github/workflows/synapse-sql-pool.yml +++ b/.github/workflows/synapse-sql-pool.yml @@ -72,6 +72,6 @@ jobs: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" - name: Unit-test - run: go test -v -timeout 30m + run: go test -v -timeout 45m env: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" \ No newline at end of file diff --git a/.github/workflows/user-assigned-identity.yml b/.github/workflows/user-assigned-identity.yml index 6146cdf7..b7c11cd6 100644 --- a/.github/workflows/user-assigned-identity.yml +++ b/.github/workflows/user-assigned-identity.yml @@ -72,6 +72,6 @@ jobs: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" - name: Unit-test - run: go test -v + run: go test -v -timeout 45m env: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" \ No newline at end of file diff --git a/.github/workflows/virtual-machine.yml b/.github/workflows/virtual-machine.yml index bc03a4d5..8eb8c9c3 100644 --- a/.github/workflows/virtual-machine.yml +++ b/.github/workflows/virtual-machine.yml @@ -72,6 +72,6 @@ jobs: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" - name: Unit-test - run: go test -v + run: go test -v -timeout 45m env: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" \ No newline at end of file diff --git a/.github/workflows/virtual-network.yml b/.github/workflows/virtual-network.yml index c86148e0..8d58f675 100644 --- a/.github/workflows/virtual-network.yml +++ b/.github/workflows/virtual-network.yml @@ -72,6 +72,6 @@ jobs: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" - name: Unit-test - run: go test -v + run: go test -v -timeout 45m env: GOPATH: "/home/runner/work/azure-labs-modules/azure-labs-modules/${{ env.terraform_workingdir }}" \ No newline at end of file diff --git a/terraform/aks-cluster/main.tf b/terraform/aks-cluster/main.tf index 78c3e92d..2f65638b 100644 --- a/terraform/aks-cluster/main.tf +++ b/terraform/aks-cluster/main.tf @@ -70,5 +70,4 @@ resource "azurerm_kubernetes_cluster" "adl_aks" { api_server_authorized_ip_ranges = var.api_server_authorized_ip_ranges role_based_access_control_enabled = var.role_based_access_control_enabled - -} +} \ No newline at end of file diff --git a/terraform/aks-cluster/test/aks.tf b/terraform/aks-cluster/test/aks.tf index dc3c282b..03aa17b9 100644 --- a/terraform/aks-cluster/test/aks.tf +++ b/terraform/aks-cluster/test/aks.tf @@ -2,7 +2,7 @@ module "aks" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location dns_prefix = "azdatalbsaks" @@ -13,4 +13,15 @@ module "aks" { } tags = {} +} + +# Module dependencies + +module "local_rg" { + source = "../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags } \ No newline at end of file diff --git a/terraform/aks-cluster/test/locals.tf b/terraform/aks-cluster/test/locals.tf new file mode 100644 index 00000000..ac525984 --- /dev/null +++ b/terraform/aks-cluster/test/locals.tf @@ -0,0 +1,7 @@ +locals { + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "aks-cluster" + Toolkit = "Terraform" + } +} \ No newline at end of file diff --git a/terraform/aks-cluster/test/outputs.tf b/terraform/aks-cluster/test/outputs.tf index 44152ad1..3debb6e0 100644 --- a/terraform/aks-cluster/test/outputs.tf +++ b/terraform/aks-cluster/test/outputs.tf @@ -7,7 +7,6 @@ output "name" { value = module.aks.name } - output "all" { value = module.aks.all sensitive = true diff --git a/terraform/aks-cluster/test/main.tf b/terraform/aks-cluster/test/providers.tf similarity index 92% rename from terraform/aks-cluster/test/main.tf rename to terraform/aks-cluster/test/providers.tf index 3f9d9107..ee1fcdb6 100644 --- a/terraform/aks-cluster/test/main.tf +++ b/terraform/aks-cluster/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/aks-cluster/test/unit_test.go b/terraform/aks-cluster/test/unit_test.go index b3ebc4f7..afa8d9b4 100644 --- a/terraform/aks-cluster/test/unit_test.go +++ b/terraform/aks-cluster/test/unit_test.go @@ -31,5 +31,4 @@ func TestModule(t *testing.T) { assert.NotNil(name) all := terraform.Output(t, terraformOptions, "all") assert.NotNil(all) - } \ No newline at end of file diff --git a/terraform/aks-cluster/test/variables.tf b/terraform/aks-cluster/test/variables.tf index 4cd3b38c..b025435b 100644 --- a/terraform/aks-cluster/test/variables.tf +++ b/terraform/aks-cluster/test/variables.tf @@ -7,9 +7,4 @@ resource "random_string" "postfix" { variable "location" { type = string default = "North Europe" -} - -variable "rg_name" { - type = string - default = "rg-adl-modules-test-01" -} +} \ No newline at end of file diff --git a/terraform/analysis-services-server/test/analysis_services_server.tf b/terraform/analysis-services-server/test/analysis_services_server.tf index 890f07fd..a7966e72 100644 --- a/terraform/analysis-services-server/test/analysis_services_server.tf +++ b/terraform/analysis-services-server/test/analysis_services_server.tf @@ -2,10 +2,19 @@ module "analysis_services_server" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location - module_enabled = true - tags = {} +} + +# Module dependencies + +module "local_rg" { + source = "../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags } \ No newline at end of file diff --git a/terraform/analysis-services-server/test/locals.tf b/terraform/analysis-services-server/test/locals.tf new file mode 100644 index 00000000..f246fd92 --- /dev/null +++ b/terraform/analysis-services-server/test/locals.tf @@ -0,0 +1,7 @@ +locals { + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "analytis-services-server" + Toolkit = "Terraform" + } +} \ No newline at end of file diff --git a/terraform/analysis-services-server/test/main.tf b/terraform/analysis-services-server/test/providers.tf similarity index 93% rename from terraform/analysis-services-server/test/main.tf rename to terraform/analysis-services-server/test/providers.tf index 417acc98..5f3f8a13 100644 --- a/terraform/analysis-services-server/test/main.tf +++ b/terraform/analysis-services-server/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/analysis-services-server/test/variables.tf b/terraform/analysis-services-server/test/variables.tf index edf7f3e0..b025435b 100644 --- a/terraform/analysis-services-server/test/variables.tf +++ b/terraform/analysis-services-server/test/variables.tf @@ -7,9 +7,4 @@ resource "random_string" "postfix" { variable "location" { type = string default = "North Europe" -} - -variable "rg_name" { - type = string - default = "rg-adl-modules-test-01" } \ No newline at end of file diff --git a/terraform/analysis-services-server/variables.tf b/terraform/analysis-services-server/variables.tf index f3feeeee..eb6f2922 100644 --- a/terraform/analysis-services-server/variables.tf +++ b/terraform/analysis-services-server/variables.tf @@ -22,6 +22,7 @@ variable "tags" { variable "module_enabled" { type = bool description = "Variable to enable or disable the module" + default = true } variable "sku" { diff --git a/terraform/application-insights/test/application_insights.tf b/terraform/application-insights/test/application_insights.tf index 2c9e7dde..45ad15cc 100644 --- a/terraform/application-insights/test/application_insights.tf +++ b/terraform/application-insights/test/application_insights.tf @@ -2,8 +2,19 @@ module "application_insights" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location tags = {} +} + +# Module dependencies + +module "local_rg" { + source = "../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags } \ No newline at end of file diff --git a/terraform/application-insights/test/locals.tf b/terraform/application-insights/test/locals.tf new file mode 100644 index 00000000..65d64e2a --- /dev/null +++ b/terraform/application-insights/test/locals.tf @@ -0,0 +1,7 @@ +locals { + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "application-insights" + Toolkit = "Terraform" + } +} \ No newline at end of file diff --git a/terraform/application-insights/test/main.tf b/terraform/application-insights/test/providers.tf similarity index 93% rename from terraform/application-insights/test/main.tf rename to terraform/application-insights/test/providers.tf index 4303d343..ce653559 100644 --- a/terraform/application-insights/test/main.tf +++ b/terraform/application-insights/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/application-insights/test/variables.tf b/terraform/application-insights/test/variables.tf index edf7f3e0..b025435b 100644 --- a/terraform/application-insights/test/variables.tf +++ b/terraform/application-insights/test/variables.tf @@ -7,9 +7,4 @@ resource "random_string" "postfix" { variable "location" { type = string default = "North Europe" -} - -variable "rg_name" { - type = string - default = "rg-adl-modules-test-01" } \ No newline at end of file diff --git a/terraform/bastion-host/test/bastion_host.tf b/terraform/bastion-host/test/bastion_host.tf index 47746628..97957019 100644 --- a/terraform/bastion-host/test/bastion_host.tf +++ b/terraform/bastion-host/test/bastion_host.tf @@ -2,20 +2,40 @@ module "bastion" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location - subnet_id = data.azurerm_subnet.snet_bastion.id - - module_enabled = true + subnet_id = module.local_snet_default.id tags = {} } -# Data dependencies +# Module dependencies + +module "local_rg" { + source = "../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags +} + +module "local_vnet" { + source = "../../virtual-network" + + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location + + address_space = ["10.0.0.0/16"] +} + +module "local_snet_default" { + source = "../../subnet" -data "azurerm_subnet" "snet_bastion" { - name = local.snet_name - virtual_network_name = local.vnet_name - resource_group_name = var.rg_name + rg_name = module.local_rg.name + name = "AzureBastionSubnet" + vnet_name = module.local_vnet.name + address_prefixes = ["10.0.6.0/24"] } \ No newline at end of file diff --git a/terraform/bastion-host/test/locals.tf b/terraform/bastion-host/test/locals.tf index cad983f8..61ad8065 100644 --- a/terraform/bastion-host/test/locals.tf +++ b/terraform/bastion-host/test/locals.tf @@ -1,4 +1,10 @@ locals { + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "bastion-host" + Toolkit = "Terraform" + } + snet_name = "AzureBastionSubnet" vnet_name = "vnet-adl-modules-test" } \ No newline at end of file diff --git a/terraform/bastion-host/test/main.tf b/terraform/bastion-host/test/providers.tf similarity index 93% rename from terraform/bastion-host/test/main.tf rename to terraform/bastion-host/test/providers.tf index 5b25d635..b631b577 100644 --- a/terraform/bastion-host/test/main.tf +++ b/terraform/bastion-host/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/bastion-host/test/variables.tf b/terraform/bastion-host/test/variables.tf index edf7f3e0..b025435b 100644 --- a/terraform/bastion-host/test/variables.tf +++ b/terraform/bastion-host/test/variables.tf @@ -7,9 +7,4 @@ resource "random_string" "postfix" { variable "location" { type = string default = "North Europe" -} - -variable "rg_name" { - type = string - default = "rg-adl-modules-test-01" } \ No newline at end of file diff --git a/terraform/bastion-host/variables.tf b/terraform/bastion-host/variables.tf index 82d6608d..a3a92287 100644 --- a/terraform/bastion-host/variables.tf +++ b/terraform/bastion-host/variables.tf @@ -22,6 +22,7 @@ variable "tags" { variable "module_enabled" { type = bool description = "Variable to enable or disable the module" + default = true } variable "subnet_id" { diff --git a/terraform/cognitive-search/test/cognitive_search.tf b/terraform/cognitive-search/test/cognitive_search.tf index 37f9e2b2..ff123e1d 100644 --- a/terraform/cognitive-search/test/cognitive_search.tf +++ b/terraform/cognitive-search/test/cognitive_search.tf @@ -2,24 +2,51 @@ module "cognitive_search" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location - subnet_id = data.azurerm_subnet.snet_default.id - private_dns_zone_ids = [data.azurerm_private_dns_zone.cs_search.id] + subnet_id = module.local_snet_default.id + private_dns_zone_ids = [module.local_pdnsz_cs_search.list[local.dns_cs_search].id] tags = {} } -# Data dependencies +# Module dependencies -data "azurerm_subnet" "snet_default" { - name = local.snet_name - virtual_network_name = local.vnet_name - resource_group_name = var.rg_name +module "local_rg" { + source = "../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags } -data "azurerm_private_dns_zone" "cs_search" { - name = local.dns_cs_search - resource_group_name = var.rg_name_dns +module "local_vnet" { + source = "../../virtual-network" + + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location + + address_space = ["10.0.0.0/16"] +} + +module "local_snet_default" { + source = "../../subnet" + + rg_name = module.local_rg.name + name = "vnet-${random_string.postfix.result}-cs-default" + vnet_name = module.local_vnet.name + address_prefixes = ["10.0.6.0/24"] +} + +# DNS zones + +module "local_pdnsz_cs_search" { + source = "../../private-dns-zone" + + rg_name = module.local_rg.name + dns_zones = [local.dns_cs_search] + vnet_id = module.local_vnet.id } \ No newline at end of file diff --git a/terraform/cognitive-search/test/locals.tf b/terraform/cognitive-search/test/locals.tf index 5030af3a..e735330f 100644 --- a/terraform/cognitive-search/test/locals.tf +++ b/terraform/cognitive-search/test/locals.tf @@ -1,5 +1,9 @@ locals { - snet_name = "snet-adl-modules-test-default" - vnet_name = "vnet-adl-modules-test" + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "cognitive-search" + Toolkit = "Terraform" + } + dns_cs_search = "privatelink.search.windows.net" } \ No newline at end of file diff --git a/terraform/cognitive-search/test/main.tf b/terraform/cognitive-search/test/providers.tf similarity index 93% rename from terraform/cognitive-search/test/main.tf rename to terraform/cognitive-search/test/providers.tf index 15899a5c..eedc1016 100644 --- a/terraform/cognitive-search/test/main.tf +++ b/terraform/cognitive-search/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/cognitive-search/test/variables.tf b/terraform/cognitive-search/test/variables.tf index c2d60718..b025435b 100644 --- a/terraform/cognitive-search/test/variables.tf +++ b/terraform/cognitive-search/test/variables.tf @@ -7,14 +7,4 @@ resource "random_string" "postfix" { variable "location" { type = string default = "North Europe" -} - -variable "rg_name" { - type = string - default = "rg-adl-modules-test-01" -} - -variable "rg_name_dns" { - type = string - default = "rg-adl-modules-test-01-global-dns" } \ No newline at end of file diff --git a/terraform/cognitive-search/variables.tf b/terraform/cognitive-search/variables.tf index 9b31bff5..d0a171ad 100644 --- a/terraform/cognitive-search/variables.tf +++ b/terraform/cognitive-search/variables.tf @@ -28,11 +28,13 @@ variable "is_sec_module" { variable "subnet_id" { type = string description = "The ID of the subnet from which private IP addresses will be allocated for this Private Endpoint" + default = "" } variable "private_dns_zone_ids" { type = list(string) description = "Specifies the list of Private DNS Zones to include" + default = [] } variable "sku" { diff --git a/terraform/cognitive-services/test/cognitive_services.tf b/terraform/cognitive-services/test/cognitive_services.tf index 31beef70..4bfba495 100644 --- a/terraform/cognitive-services/test/cognitive_services.tf +++ b/terraform/cognitive-services/test/cognitive_services.tf @@ -2,25 +2,52 @@ module "cognitive_services" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location kind = "Face" - subnet_id = data.azurerm_subnet.snet_default.id - private_dns_zone_ids = [data.azurerm_private_dns_zone.cog.id] + subnet_id = module.local_snet_default.id + private_dns_zone_ids = [module.local_pdnsz_cog.list[local.dns_cog].id] tags = {} } -# Data dependencies +# Module dependencies -data "azurerm_subnet" "snet_default" { - name = local.snet_name - virtual_network_name = local.vnet_name - resource_group_name = var.rg_name +module "local_rg" { + source = "../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags } -data "azurerm_private_dns_zone" "cog" { - name = local.dns_cog - resource_group_name = var.rg_name_dns +module "local_vnet" { + source = "../../virtual-network" + + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location + + address_space = ["10.0.0.0/16"] +} + +module "local_snet_default" { + source = "../../subnet" + + rg_name = module.local_rg.name + name = "vnet-${random_string.postfix.result}-kv-default" + vnet_name = module.local_vnet.name + address_prefixes = ["10.0.6.0/24"] +} + +# DNS zones + +module "local_pdnsz_cog" { + source = "../../private-dns-zone" + + rg_name = module.local_rg.name + dns_zones = [local.dns_cog] + vnet_id = module.local_vnet.id } \ No newline at end of file diff --git a/terraform/cognitive-services/test/locals.tf b/terraform/cognitive-services/test/locals.tf index fe9fd270..66ffa0ad 100644 --- a/terraform/cognitive-services/test/locals.tf +++ b/terraform/cognitive-services/test/locals.tf @@ -1,5 +1,9 @@ locals { - snet_name = "snet-adl-modules-test-default" - vnet_name = "vnet-adl-modules-test" - dns_cog = "privatelink.cognitiveservices.azure.com" + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "cognitive-services" + Toolkit = "Terraform" + } + + dns_cog = "privatelink.cognitiveservices.azure.com" } \ No newline at end of file diff --git a/terraform/cognitive-services/test/main.tf b/terraform/cognitive-services/test/providers.tf similarity index 93% rename from terraform/cognitive-services/test/main.tf rename to terraform/cognitive-services/test/providers.tf index 95754aab..34d8c201 100644 --- a/terraform/cognitive-services/test/main.tf +++ b/terraform/cognitive-services/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/cognitive-services/test/variables.tf b/terraform/cognitive-services/test/variables.tf index c2d60718..b025435b 100644 --- a/terraform/cognitive-services/test/variables.tf +++ b/terraform/cognitive-services/test/variables.tf @@ -7,14 +7,4 @@ resource "random_string" "postfix" { variable "location" { type = string default = "North Europe" -} - -variable "rg_name" { - type = string - default = "rg-adl-modules-test-01" -} - -variable "rg_name_dns" { - type = string - default = "rg-adl-modules-test-01-global-dns" } \ No newline at end of file diff --git a/terraform/cognitive-services/variables.tf b/terraform/cognitive-services/variables.tf index b3017e1d..e6cd06c4 100644 --- a/terraform/cognitive-services/variables.tf +++ b/terraform/cognitive-services/variables.tf @@ -28,6 +28,7 @@ variable "is_sec_module" { variable "subnet_id" { type = string description = "The ID of the subnet from which private IP addresses will be allocated for this Private Endpoint" + default = "" } variable "kind" { @@ -56,4 +57,5 @@ variable "outbound_network_access_restrited" { variable "private_dns_zone_ids" { type = list(string) description = "Specifies the list of Private DNS Zones to include" + default = [] } \ No newline at end of file diff --git a/terraform/container-registry/test/container_registry.tf b/terraform/container-registry/test/container_registry.tf index 70fba91b..8aaec579 100644 --- a/terraform/container-registry/test/container_registry.tf +++ b/terraform/container-registry/test/container_registry.tf @@ -2,24 +2,51 @@ module "container_registry" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location - subnet_id = data.azurerm_subnet.snet_default.id - private_dns_zone_ids = [data.azurerm_private_dns_zone.cr.id] + subnet_id = module.local_snet_default.id + private_dns_zone_ids = [module.local_pdnsz_cr.list[local.dns_cr].id] tags = {} } -# Data dependencies +# Module dependencies -data "azurerm_subnet" "snet_default" { - name = local.snet_name - virtual_network_name = local.vnet_name - resource_group_name = var.rg_name +module "local_rg" { + source = "../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags } -data "azurerm_private_dns_zone" "cr" { - name = local.dns_cr - resource_group_name = var.rg_name_dns +module "local_vnet" { + source = "../../virtual-network" + + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location + + address_space = ["10.0.0.0/16"] +} + +module "local_snet_default" { + source = "../../subnet" + + rg_name = module.local_rg.name + name = "vnet-${random_string.postfix.result}-kv-default" + vnet_name = module.local_vnet.name + address_prefixes = ["10.0.6.0/24"] +} + +# DNS zones + +module "local_pdnsz_cr" { + source = "../../private-dns-zone" + + rg_name = module.local_rg.name + dns_zones = [local.dns_cr] + vnet_id = module.local_vnet.id } \ No newline at end of file diff --git a/terraform/container-registry/test/locals.tf b/terraform/container-registry/test/locals.tf index 94413d1f..67132b17 100644 --- a/terraform/container-registry/test/locals.tf +++ b/terraform/container-registry/test/locals.tf @@ -1,5 +1,9 @@ locals { - snet_name = "snet-adl-modules-test-default" - vnet_name = "vnet-adl-modules-test" - dns_cr = "privatelink.azurecr.io" + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "container-registry" + Toolkit = "Terraform" + } + + dns_cr = "privatelink.azurecr.io" } \ No newline at end of file diff --git a/terraform/container-registry/test/main.tf b/terraform/container-registry/test/providers.tf similarity index 93% rename from terraform/container-registry/test/main.tf rename to terraform/container-registry/test/providers.tf index 1bdc957a..3c4b0898 100644 --- a/terraform/container-registry/test/main.tf +++ b/terraform/container-registry/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/container-registry/test/variables.tf b/terraform/container-registry/test/variables.tf index c2d60718..b025435b 100644 --- a/terraform/container-registry/test/variables.tf +++ b/terraform/container-registry/test/variables.tf @@ -7,14 +7,4 @@ resource "random_string" "postfix" { variable "location" { type = string default = "North Europe" -} - -variable "rg_name" { - type = string - default = "rg-adl-modules-test-01" -} - -variable "rg_name_dns" { - type = string - default = "rg-adl-modules-test-01-global-dns" } \ No newline at end of file diff --git a/terraform/container-registry/variables.tf b/terraform/container-registry/variables.tf index 241c2126..6a54cadf 100644 --- a/terraform/container-registry/variables.tf +++ b/terraform/container-registry/variables.tf @@ -28,6 +28,7 @@ variable "is_sec_module" { variable "subnet_id" { type = string description = "The ID of the subnet from which private IP addresses will be allocated for this Private Endpoint" + default = "" } variable "sku" { @@ -51,6 +52,7 @@ variable "public_network_access_enabled" { variable "private_dns_zone_ids" { type = list(string) description = "Specifies the list of Private DNS Zones to include" + default = [] } variable "firewall_default_action" { diff --git a/terraform/cosmosdb/cosmosdb-account/main.tf b/terraform/cosmosdb/cosmosdb-account/main.tf index aad6285d..46333fca 100644 --- a/terraform/cosmosdb/cosmosdb-account/main.tf +++ b/terraform/cosmosdb/cosmosdb-account/main.tf @@ -30,7 +30,7 @@ resource "azurerm_cosmosdb_account" "adl_cosmos" { name = var.enable_capability } - ip_range_filter = data.http.ip.body + ip_range_filter = data.http.ip.response_body count = var.module_enabled ? 1 : 0 diff --git a/terraform/cosmosdb/cosmosdb-account/test/cosmosdb_account.tf b/terraform/cosmosdb/cosmosdb-account/test/cosmosdb_account.tf index 4db966a1..89617e3d 100644 --- a/terraform/cosmosdb/cosmosdb-account/test/cosmosdb_account.tf +++ b/terraform/cosmosdb/cosmosdb-account/test/cosmosdb_account.tf @@ -2,13 +2,22 @@ module "cosmosdb_account" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location kind = var.kind enable_capability = var.enable_capability - module_enabled = true - tags = {} +} + +# Module dependencies + +module "local_rg" { + source = "../../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags } \ No newline at end of file diff --git a/terraform/cosmosdb/cosmosdb-account/test/locals.tf b/terraform/cosmosdb/cosmosdb-account/test/locals.tf index 644fba04..cbbdcec3 100644 --- a/terraform/cosmosdb/cosmosdb-account/test/locals.tf +++ b/terraform/cosmosdb/cosmosdb-account/test/locals.tf @@ -1,2 +1,7 @@ locals { + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "cosmosdb-account" + Toolkit = "Terraform" + } } \ No newline at end of file diff --git a/terraform/cosmosdb/cosmosdb-account/test/main.tf b/terraform/cosmosdb/cosmosdb-account/test/providers.tf similarity index 93% rename from terraform/cosmosdb/cosmosdb-account/test/main.tf rename to terraform/cosmosdb/cosmosdb-account/test/providers.tf index 6502ffb6..a4f49b17 100644 --- a/terraform/cosmosdb/cosmosdb-account/test/main.tf +++ b/terraform/cosmosdb/cosmosdb-account/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/cosmosdb/cosmosdb-account/test/variables.tf b/terraform/cosmosdb/cosmosdb-account/test/variables.tf index dccd3b6c..292b7eec 100644 --- a/terraform/cosmosdb/cosmosdb-account/test/variables.tf +++ b/terraform/cosmosdb/cosmosdb-account/test/variables.tf @@ -9,11 +9,6 @@ variable "location" { default = "West Europe" } -variable "rg_name" { - type = string - default = "rg-adl-modules-test-01-we" -} - variable "kind" { type = string description = "Specifies the Kind of CosmosDB to create" diff --git a/terraform/cosmosdb/cosmosdb-account/variables.tf b/terraform/cosmosdb/cosmosdb-account/variables.tf index 1f11e674..911b8480 100644 --- a/terraform/cosmosdb/cosmosdb-account/variables.tf +++ b/terraform/cosmosdb/cosmosdb-account/variables.tf @@ -22,7 +22,7 @@ variable "tags" { variable "module_enabled" { type = bool description = "Variable to enable or disable the module" - default = false + default = true } variable "offer_type" { diff --git a/terraform/cosmosdb/cosmosdb-cassandra-keyspace/test/cosmosdb_cassandra_keyspace.tf b/terraform/cosmosdb/cosmosdb-cassandra-keyspace/test/cosmosdb_cassandra_keyspace.tf index 3f93bf7a..2597e956 100644 --- a/terraform/cosmosdb/cosmosdb-cassandra-keyspace/test/cosmosdb_cassandra_keyspace.tf +++ b/terraform/cosmosdb/cosmosdb-cassandra-keyspace/test/cosmosdb_cassandra_keyspace.tf @@ -2,11 +2,11 @@ module "cosmosdb_cassandra_keyspace" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location - subnet_id = data.azurerm_subnet.snet_default.id - private_dns_zone_ids = [data.azurerm_private_dns_zone.cosmos_cassandra.id] + subnet_id = module.local_snet_default.id + private_dns_zone_ids = [module.local_pdnsz_cosmos_cassandra.list[local.dns_cosmos_cassandra].id] cosmosdb_account_id = module.local_cosmosdb_account.id cosmosdb_account_name = module.local_cosmosdb_account.name @@ -14,23 +14,53 @@ module "cosmosdb_cassandra_keyspace" { tags = {} } -# Data dependencies +# Module dependencies -data "azurerm_subnet" "snet_default" { - name = local.snet_name - virtual_network_name = local.vnet_name - resource_group_name = var.rg_name -} +module "local_rg" { + source = "../../../resource-group" -data "azurerm_private_dns_zone" "cosmos_cassandra" { - name = local.dns_cosmos_cassandra - resource_group_name = var.rg_name_dns -} + basename = random_string.postfix.result + location = var.location -# Module dependencies + tags = local.tags +} module "local_cosmosdb_account" { - source = "../../cosmosdb-account/test" + source = "../../cosmosdb-account" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location + kind = "GlobalDocumentDB" enable_capability = "EnableCassandra" +} + +module "local_vnet" { + source = "../../../virtual-network" + + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location + + address_space = ["10.0.0.0/16"] +} + +module "local_snet_default" { + source = "../../../subnet" + + rg_name = module.local_rg.name + name = "vnet-${random_string.postfix.result}-cassandra-default" + vnet_name = module.local_vnet.name + address_prefixes = ["10.0.6.0/24"] +} + +# DNS zones + +module "local_pdnsz_cosmos_cassandra" { + source = "../../../private-dns-zone" + + rg_name = module.local_rg.name + dns_zones = [local.dns_cosmos_cassandra] + vnet_id = module.local_vnet.id } \ No newline at end of file diff --git a/terraform/cosmosdb/cosmosdb-cassandra-keyspace/test/locals.tf b/terraform/cosmosdb/cosmosdb-cassandra-keyspace/test/locals.tf index 235e077c..14b5f60b 100644 --- a/terraform/cosmosdb/cosmosdb-cassandra-keyspace/test/locals.tf +++ b/terraform/cosmosdb/cosmosdb-cassandra-keyspace/test/locals.tf @@ -1,5 +1,9 @@ locals { - snet_name = "snet-adl-modules-test-default" - vnet_name = "vnet-adl-modules-test-we" + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "cosmosdb-cassandra-keyspace" + Toolkit = "Terraform" + } + dns_cosmos_cassandra = "privatelink.cassandra.cosmos.azure.com" } \ No newline at end of file diff --git a/terraform/cosmosdb/cosmosdb-cassandra-keyspace/test/main.tf b/terraform/cosmosdb/cosmosdb-cassandra-keyspace/test/providers.tf similarity index 93% rename from terraform/cosmosdb/cosmosdb-cassandra-keyspace/test/main.tf rename to terraform/cosmosdb/cosmosdb-cassandra-keyspace/test/providers.tf index 4c91e627..0929ec28 100644 --- a/terraform/cosmosdb/cosmosdb-cassandra-keyspace/test/main.tf +++ b/terraform/cosmosdb/cosmosdb-cassandra-keyspace/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/cosmosdb/cosmosdb-cassandra-keyspace/test/variables.tf b/terraform/cosmosdb/cosmosdb-cassandra-keyspace/test/variables.tf index a4c42095..da40f6a4 100644 --- a/terraform/cosmosdb/cosmosdb-cassandra-keyspace/test/variables.tf +++ b/terraform/cosmosdb/cosmosdb-cassandra-keyspace/test/variables.tf @@ -7,14 +7,4 @@ resource "random_string" "postfix" { variable "location" { type = string default = "West Europe" -} - -variable "rg_name" { - type = string - default = "rg-adl-modules-test-01-we" -} - -variable "rg_name_dns" { - type = string - default = "rg-adl-modules-test-01-global-dns-we" -} +} \ No newline at end of file diff --git a/terraform/cosmosdb/cosmosdb-cassandra-keyspace/variables.tf b/terraform/cosmosdb/cosmosdb-cassandra-keyspace/variables.tf index c4eb2ddf..0bcb537c 100644 --- a/terraform/cosmosdb/cosmosdb-cassandra-keyspace/variables.tf +++ b/terraform/cosmosdb/cosmosdb-cassandra-keyspace/variables.tf @@ -28,11 +28,13 @@ variable "is_sec_module" { variable "subnet_id" { type = string description = "The ID of the subnet from which private IP addresses will be allocated for this Private Endpoint" + default = "" } variable "private_dns_zone_ids" { type = list(string) description = "Specifies the list of Private DNS Zones to include" + default = [] } variable "cosmosdb_account_name" { @@ -46,7 +48,7 @@ variable "cosmosdb_account_id" { } variable "throughput" { - type = number + type = number description = "The throughput of Cassandra KeySpace (RU/s)" - default = 400 + default = 400 } \ No newline at end of file diff --git a/terraform/cosmosdb/cosmosdb-gremlin-database/test/cosmosdb_gremlin_database.tf b/terraform/cosmosdb/cosmosdb-gremlin-database/test/cosmosdb_gremlin_database.tf index 9b20dbcb..b6e0452d 100644 --- a/terraform/cosmosdb/cosmosdb-gremlin-database/test/cosmosdb_gremlin_database.tf +++ b/terraform/cosmosdb/cosmosdb-gremlin-database/test/cosmosdb_gremlin_database.tf @@ -2,11 +2,11 @@ module "cosmosdb_gremlin_database" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location - subnet_id = data.azurerm_subnet.snet_default.id - private_dns_zone_ids = [data.azurerm_private_dns_zone.cosmos_gremlin.id] + subnet_id = module.local_snet_default.id + private_dns_zone_ids = [module.local_pdnsz_cosmos_gremlin.list[local.dns_cosmos_gremlin].id] cosmosdb_account_id = module.local_cosmosdb_account.id cosmosdb_account_name = module.local_cosmosdb_account.name @@ -14,23 +14,53 @@ module "cosmosdb_gremlin_database" { tags = {} } -# Data dependencies +# Module dependencies -data "azurerm_subnet" "snet_default" { - name = local.snet_name - virtual_network_name = local.vnet_name - resource_group_name = var.rg_name -} +module "local_rg" { + source = "../../../resource-group" -data "azurerm_private_dns_zone" "cosmos_gremlin" { - name = local.dns_cosmos_gremlin - resource_group_name = var.rg_name_dns -} + basename = random_string.postfix.result + location = var.location -# Module dependencies + tags = local.tags +} module "local_cosmosdb_account" { - source = "../../cosmosdb-account/test" + source = "../../cosmosdb-account" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location + kind = "GlobalDocumentDB" enable_capability = "EnableGremlin" +} + +module "local_vnet" { + source = "../../../virtual-network" + + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location + + address_space = ["10.0.0.0/16"] +} + +module "local_snet_default" { + source = "../../../subnet" + + rg_name = module.local_rg.name + name = "vnet-${random_string.postfix.result}-gremlin-default" + vnet_name = module.local_vnet.name + address_prefixes = ["10.0.6.0/24"] +} + +# DNS zones + +module "local_pdnsz_cosmos_gremlin" { + source = "../../../private-dns-zone" + + rg_name = module.local_rg.name + dns_zones = [local.dns_cosmos_gremlin] + vnet_id = module.local_vnet.id } \ No newline at end of file diff --git a/terraform/cosmosdb/cosmosdb-gremlin-database/test/locals.tf b/terraform/cosmosdb/cosmosdb-gremlin-database/test/locals.tf index a78102de..72a81b55 100644 --- a/terraform/cosmosdb/cosmosdb-gremlin-database/test/locals.tf +++ b/terraform/cosmosdb/cosmosdb-gremlin-database/test/locals.tf @@ -1,4 +1,10 @@ locals { + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "cosmosdb-gremlin-database" + Toolkit = "Terraform" + } + snet_name = "snet-adl-modules-test-default" vnet_name = "vnet-adl-modules-test-we" dns_cosmos_gremlin = "privatelink.gremlin.cosmos.azure.com" diff --git a/terraform/cosmosdb/cosmosdb-gremlin-database/test/main.tf b/terraform/cosmosdb/cosmosdb-gremlin-database/test/providers.tf similarity index 93% rename from terraform/cosmosdb/cosmosdb-gremlin-database/test/main.tf rename to terraform/cosmosdb/cosmosdb-gremlin-database/test/providers.tf index 08e4c1c3..39e66e1a 100644 --- a/terraform/cosmosdb/cosmosdb-gremlin-database/test/main.tf +++ b/terraform/cosmosdb/cosmosdb-gremlin-database/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/cosmosdb/cosmosdb-gremlin-database/test/variables.tf b/terraform/cosmosdb/cosmosdb-gremlin-database/test/variables.tf index a4c42095..da40f6a4 100644 --- a/terraform/cosmosdb/cosmosdb-gremlin-database/test/variables.tf +++ b/terraform/cosmosdb/cosmosdb-gremlin-database/test/variables.tf @@ -7,14 +7,4 @@ resource "random_string" "postfix" { variable "location" { type = string default = "West Europe" -} - -variable "rg_name" { - type = string - default = "rg-adl-modules-test-01-we" -} - -variable "rg_name_dns" { - type = string - default = "rg-adl-modules-test-01-global-dns-we" -} +} \ No newline at end of file diff --git a/terraform/cosmosdb/cosmosdb-gremlin-database/variables.tf b/terraform/cosmosdb/cosmosdb-gremlin-database/variables.tf index c4eb2ddf..0bcb537c 100644 --- a/terraform/cosmosdb/cosmosdb-gremlin-database/variables.tf +++ b/terraform/cosmosdb/cosmosdb-gremlin-database/variables.tf @@ -28,11 +28,13 @@ variable "is_sec_module" { variable "subnet_id" { type = string description = "The ID of the subnet from which private IP addresses will be allocated for this Private Endpoint" + default = "" } variable "private_dns_zone_ids" { type = list(string) description = "Specifies the list of Private DNS Zones to include" + default = [] } variable "cosmosdb_account_name" { @@ -46,7 +48,7 @@ variable "cosmosdb_account_id" { } variable "throughput" { - type = number + type = number description = "The throughput of Cassandra KeySpace (RU/s)" - default = 400 + default = 400 } \ No newline at end of file diff --git a/terraform/cosmosdb/cosmosdb-mongo-database/test/cosmosdb_mongo_database.tf b/terraform/cosmosdb/cosmosdb-mongo-database/test/cosmosdb_mongo_database.tf index 427fbc72..5dab1c5f 100644 --- a/terraform/cosmosdb/cosmosdb-mongo-database/test/cosmosdb_mongo_database.tf +++ b/terraform/cosmosdb/cosmosdb-mongo-database/test/cosmosdb_mongo_database.tf @@ -2,11 +2,11 @@ module "cosmosdb_mongo_database" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location - subnet_id = data.azurerm_subnet.snet_default.id - private_dns_zone_ids = [data.azurerm_private_dns_zone.cosmos_mongo.id] + subnet_id = module.local_snet_default.id + private_dns_zone_ids = [module.local_pdnsz_cosmos_mongo.list[local.dns_cosmos_mongo].id] cosmosdb_account_id = module.local_cosmosdb_account.id cosmosdb_account_name = module.local_cosmosdb_account.name @@ -14,23 +14,53 @@ module "cosmosdb_mongo_database" { tags = {} } -# Data dependencies +# Module dependencies -data "azurerm_subnet" "snet_default" { - name = local.snet_name - virtual_network_name = local.vnet_name - resource_group_name = var.rg_name -} +module "local_rg" { + source = "../../../resource-group" -data "azurerm_private_dns_zone" "cosmos_mongo" { - name = local.dns_cosmos_mongo - resource_group_name = var.rg_name_dns -} + basename = random_string.postfix.result + location = var.location -# Module dependencies + tags = local.tags +} module "local_cosmosdb_account" { - source = "../../cosmosdb-account/test" + source = "../../cosmosdb-account" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location + kind = "MongoDB" enable_capability = "EnableMongo" +} + +module "local_vnet" { + source = "../../../virtual-network" + + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location + + address_space = ["10.0.0.0/16"] +} + +module "local_snet_default" { + source = "../../../subnet" + + rg_name = module.local_rg.name + name = "vnet-${random_string.postfix.result}-mongo-default" + vnet_name = module.local_vnet.name + address_prefixes = ["10.0.6.0/24"] +} + +# DNS zones + +module "local_pdnsz_cosmos_mongo" { + source = "../../../private-dns-zone" + + rg_name = module.local_rg.name + dns_zones = [local.dns_cosmos_mongo] + vnet_id = module.local_vnet.id } \ No newline at end of file diff --git a/terraform/cosmosdb/cosmosdb-mongo-database/test/locals.tf b/terraform/cosmosdb/cosmosdb-mongo-database/test/locals.tf index f71504b3..05bc4a8e 100644 --- a/terraform/cosmosdb/cosmosdb-mongo-database/test/locals.tf +++ b/terraform/cosmosdb/cosmosdb-mongo-database/test/locals.tf @@ -1,5 +1,9 @@ locals { - snet_name = "snet-adl-modules-test-default" - vnet_name = "vnet-adl-modules-test-we" + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "cosmosdb-mongo-database" + Toolkit = "Terraform" + } + dns_cosmos_mongo = "privatelink.mongo.cosmos.azure.com" } \ No newline at end of file diff --git a/terraform/cosmosdb/cosmosdb-mongo-database/test/main.tf b/terraform/cosmosdb/cosmosdb-mongo-database/test/providers.tf similarity index 93% rename from terraform/cosmosdb/cosmosdb-mongo-database/test/main.tf rename to terraform/cosmosdb/cosmosdb-mongo-database/test/providers.tf index 677450ed..4ca9ac8e 100644 --- a/terraform/cosmosdb/cosmosdb-mongo-database/test/main.tf +++ b/terraform/cosmosdb/cosmosdb-mongo-database/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/cosmosdb/cosmosdb-mongo-database/test/variables.tf b/terraform/cosmosdb/cosmosdb-mongo-database/test/variables.tf index a4c42095..da40f6a4 100644 --- a/terraform/cosmosdb/cosmosdb-mongo-database/test/variables.tf +++ b/terraform/cosmosdb/cosmosdb-mongo-database/test/variables.tf @@ -7,14 +7,4 @@ resource "random_string" "postfix" { variable "location" { type = string default = "West Europe" -} - -variable "rg_name" { - type = string - default = "rg-adl-modules-test-01-we" -} - -variable "rg_name_dns" { - type = string - default = "rg-adl-modules-test-01-global-dns-we" -} +} \ No newline at end of file diff --git a/terraform/cosmosdb/cosmosdb-mongo-database/variables.tf b/terraform/cosmosdb/cosmosdb-mongo-database/variables.tf index c4eb2ddf..0bcb537c 100644 --- a/terraform/cosmosdb/cosmosdb-mongo-database/variables.tf +++ b/terraform/cosmosdb/cosmosdb-mongo-database/variables.tf @@ -28,11 +28,13 @@ variable "is_sec_module" { variable "subnet_id" { type = string description = "The ID of the subnet from which private IP addresses will be allocated for this Private Endpoint" + default = "" } variable "private_dns_zone_ids" { type = list(string) description = "Specifies the list of Private DNS Zones to include" + default = [] } variable "cosmosdb_account_name" { @@ -46,7 +48,7 @@ variable "cosmosdb_account_id" { } variable "throughput" { - type = number + type = number description = "The throughput of Cassandra KeySpace (RU/s)" - default = 400 + default = 400 } \ No newline at end of file diff --git a/terraform/cosmosdb/cosmosdb-sql-database/test/cosmosdb_sql_database.tf b/terraform/cosmosdb/cosmosdb-sql-database/test/cosmosdb_sql_database.tf index f7e76c51..a71f5a05 100644 --- a/terraform/cosmosdb/cosmosdb-sql-database/test/cosmosdb_sql_database.tf +++ b/terraform/cosmosdb/cosmosdb-sql-database/test/cosmosdb_sql_database.tf @@ -2,11 +2,11 @@ module "cosmosdb_sql_database" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location - subnet_id = data.azurerm_subnet.snet_default.id - private_dns_zone_ids = [data.azurerm_private_dns_zone.cosmos_sql.id] + subnet_id = module.local_snet_default.id + private_dns_zone_ids = [module.local_pdnsz_cosmos_sql.list[local.dns_cosmos_sql].id] cosmosdb_account_id = module.local_cosmosdb_account.id cosmosdb_account_name = module.local_cosmosdb_account.name @@ -14,23 +14,53 @@ module "cosmosdb_sql_database" { tags = {} } -# Data dependencies +# Module dependencies -data "azurerm_subnet" "snet_default" { - name = local.snet_name - virtual_network_name = local.vnet_name - resource_group_name = var.rg_name -} +module "local_rg" { + source = "../../../resource-group" -data "azurerm_private_dns_zone" "cosmos_sql" { - name = local.dns_cosmos_sql - resource_group_name = var.rg_name_dns -} + basename = random_string.postfix.result + location = var.location -# Module dependencies + tags = local.tags +} module "local_cosmosdb_account" { - source = "../../cosmosdb-account/test" + source = "../../cosmosdb-account" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location + kind = "GlobalDocumentDB" enable_capability = "DisableRateLimitingResponses" +} + +module "local_vnet" { + source = "../../../virtual-network" + + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location + + address_space = ["10.0.0.0/16"] +} + +module "local_snet_default" { + source = "../../../subnet" + + rg_name = module.local_rg.name + name = "vnet-${random_string.postfix.result}-sql-default" + vnet_name = module.local_vnet.name + address_prefixes = ["10.0.6.0/24"] +} + +# DNS zones + +module "local_pdnsz_cosmos_sql" { + source = "../../../private-dns-zone" + + rg_name = module.local_rg.name + dns_zones = [local.dns_cosmos_sql] + vnet_id = module.local_vnet.id } \ No newline at end of file diff --git a/terraform/cosmosdb/cosmosdb-sql-database/test/locals.tf b/terraform/cosmosdb/cosmosdb-sql-database/test/locals.tf index 97b64ff6..7fa7c501 100644 --- a/terraform/cosmosdb/cosmosdb-sql-database/test/locals.tf +++ b/terraform/cosmosdb/cosmosdb-sql-database/test/locals.tf @@ -1,4 +1,10 @@ locals { + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "cosmosdb-sql-database" + Toolkit = "Terraform" + } + snet_name = "snet-adl-modules-test-default" vnet_name = "vnet-adl-modules-test-we" dns_cosmos_sql = "privatelink.documents.azure.com" diff --git a/terraform/cosmosdb/cosmosdb-sql-database/test/main.tf b/terraform/cosmosdb/cosmosdb-sql-database/test/providers.tf similarity index 93% rename from terraform/cosmosdb/cosmosdb-sql-database/test/main.tf rename to terraform/cosmosdb/cosmosdb-sql-database/test/providers.tf index 8015a859..8212d13c 100644 --- a/terraform/cosmosdb/cosmosdb-sql-database/test/main.tf +++ b/terraform/cosmosdb/cosmosdb-sql-database/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/cosmosdb/cosmosdb-sql-database/test/variables.tf b/terraform/cosmosdb/cosmosdb-sql-database/test/variables.tf index a4c42095..da40f6a4 100644 --- a/terraform/cosmosdb/cosmosdb-sql-database/test/variables.tf +++ b/terraform/cosmosdb/cosmosdb-sql-database/test/variables.tf @@ -7,14 +7,4 @@ resource "random_string" "postfix" { variable "location" { type = string default = "West Europe" -} - -variable "rg_name" { - type = string - default = "rg-adl-modules-test-01-we" -} - -variable "rg_name_dns" { - type = string - default = "rg-adl-modules-test-01-global-dns-we" -} +} \ No newline at end of file diff --git a/terraform/cosmosdb/cosmosdb-sql-database/variables.tf b/terraform/cosmosdb/cosmosdb-sql-database/variables.tf index c4eb2ddf..0bcb537c 100644 --- a/terraform/cosmosdb/cosmosdb-sql-database/variables.tf +++ b/terraform/cosmosdb/cosmosdb-sql-database/variables.tf @@ -28,11 +28,13 @@ variable "is_sec_module" { variable "subnet_id" { type = string description = "The ID of the subnet from which private IP addresses will be allocated for this Private Endpoint" + default = "" } variable "private_dns_zone_ids" { type = list(string) description = "Specifies the list of Private DNS Zones to include" + default = [] } variable "cosmosdb_account_name" { @@ -46,7 +48,7 @@ variable "cosmosdb_account_id" { } variable "throughput" { - type = number + type = number description = "The throughput of Cassandra KeySpace (RU/s)" - default = 400 + default = 400 } \ No newline at end of file diff --git a/terraform/cosmosdb/cosmosdb-table/test/cosmosdb_table.tf b/terraform/cosmosdb/cosmosdb-table/test/cosmosdb_table.tf index d9d28f20..60701627 100644 --- a/terraform/cosmosdb/cosmosdb-table/test/cosmosdb_table.tf +++ b/terraform/cosmosdb/cosmosdb-table/test/cosmosdb_table.tf @@ -2,11 +2,11 @@ module "cosmosdb_table" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location - subnet_id = data.azurerm_subnet.snet_default.id - private_dns_zone_ids = [data.azurerm_private_dns_zone.cosmos_table.id] + subnet_id = module.local_snet_default.id + private_dns_zone_ids = [module.local_pdnsz_cosmos_table.list[local.dns_cosmos_table].id] cosmosdb_account_id = module.local_cosmosdb_account.id cosmosdb_account_name = module.local_cosmosdb_account.name @@ -14,23 +14,53 @@ module "cosmosdb_table" { tags = {} } -# Data dependencies +# Module dependencies -data "azurerm_subnet" "snet_default" { - name = local.snet_name - virtual_network_name = local.vnet_name - resource_group_name = var.rg_name -} +module "local_rg" { + source = "../../../resource-group" -data "azurerm_private_dns_zone" "cosmos_table" { - name = local.dns_cosmos_table - resource_group_name = var.rg_name_dns -} + basename = random_string.postfix.result + location = var.location -# Module dependencies + tags = local.tags +} module "local_cosmosdb_account" { - source = "../../cosmosdb-account/test" + source = "../../cosmosdb-account" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location + kind = "GlobalDocumentDB" enable_capability = "EnableTable" +} + +module "local_vnet" { + source = "../../../virtual-network" + + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location + + address_space = ["10.0.0.0/16"] +} + +module "local_snet_default" { + source = "../../../subnet" + + rg_name = module.local_rg.name + name = "vnet-${random_string.postfix.result}-table-default" + vnet_name = module.local_vnet.name + address_prefixes = ["10.0.6.0/24"] +} + +# DNS zones + +module "local_pdnsz_cosmos_table" { + source = "../../../private-dns-zone" + + rg_name = module.local_rg.name + dns_zones = [local.dns_cosmos_table] + vnet_id = module.local_vnet.id } \ No newline at end of file diff --git a/terraform/cosmosdb/cosmosdb-table/test/locals.tf b/terraform/cosmosdb/cosmosdb-table/test/locals.tf index 207814da..eb82fbac 100644 --- a/terraform/cosmosdb/cosmosdb-table/test/locals.tf +++ b/terraform/cosmosdb/cosmosdb-table/test/locals.tf @@ -1,5 +1,9 @@ locals { - snet_name = "snet-adl-modules-test-default" - vnet_name = "vnet-adl-modules-test-we" + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "cosmosdb-table" + Toolkit = "Terraform" + } + dns_cosmos_table = "privatelink.table.cosmos.azure.com" } \ No newline at end of file diff --git a/terraform/cosmosdb/cosmosdb-table/test/main.tf b/terraform/cosmosdb/cosmosdb-table/test/providers.tf similarity index 93% rename from terraform/cosmosdb/cosmosdb-table/test/main.tf rename to terraform/cosmosdb/cosmosdb-table/test/providers.tf index 80624417..5836c8ae 100644 --- a/terraform/cosmosdb/cosmosdb-table/test/main.tf +++ b/terraform/cosmosdb/cosmosdb-table/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/cosmosdb/cosmosdb-table/test/variables.tf b/terraform/cosmosdb/cosmosdb-table/test/variables.tf index a4c42095..da40f6a4 100644 --- a/terraform/cosmosdb/cosmosdb-table/test/variables.tf +++ b/terraform/cosmosdb/cosmosdb-table/test/variables.tf @@ -7,14 +7,4 @@ resource "random_string" "postfix" { variable "location" { type = string default = "West Europe" -} - -variable "rg_name" { - type = string - default = "rg-adl-modules-test-01-we" -} - -variable "rg_name_dns" { - type = string - default = "rg-adl-modules-test-01-global-dns-we" -} +} \ No newline at end of file diff --git a/terraform/cosmosdb/cosmosdb-table/variables.tf b/terraform/cosmosdb/cosmosdb-table/variables.tf index c4eb2ddf..0bcb537c 100644 --- a/terraform/cosmosdb/cosmosdb-table/variables.tf +++ b/terraform/cosmosdb/cosmosdb-table/variables.tf @@ -28,11 +28,13 @@ variable "is_sec_module" { variable "subnet_id" { type = string description = "The ID of the subnet from which private IP addresses will be allocated for this Private Endpoint" + default = "" } variable "private_dns_zone_ids" { type = list(string) description = "Specifies the list of Private DNS Zones to include" + default = [] } variable "cosmosdb_account_name" { @@ -46,7 +48,7 @@ variable "cosmosdb_account_id" { } variable "throughput" { - type = number + type = number description = "The throughput of Cassandra KeySpace (RU/s)" - default = 400 + default = 400 } \ No newline at end of file diff --git a/terraform/data-explorer/kusto-cluster/test/kusto_cluster.tf b/terraform/data-explorer/kusto-cluster/test/kusto_cluster.tf index 07ea8a48..4e71ae9b 100644 --- a/terraform/data-explorer/kusto-cluster/test/kusto_cluster.tf +++ b/terraform/data-explorer/kusto-cluster/test/kusto_cluster.tf @@ -2,24 +2,51 @@ module "kusto_cluster" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location - subnet_id = data.azurerm_subnet.snet_default.id - private_dns_zone_ids = [data.azurerm_private_dns_zone.dec_cluster.id] + subnet_id = module.local_snet_default.id + private_dns_zone_ids = [module.local_pdnsz_dec_cluster.list[local.dns_dec_cluster].id] tags = {} } -# Data dependencies +# Module dependencies -data "azurerm_subnet" "snet_default" { - name = local.snet_name - virtual_network_name = local.vnet_name - resource_group_name = var.rg_name +module "local_rg" { + source = "../../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags } -data "azurerm_private_dns_zone" "dec_cluster" { - name = local.dns_dec_cluster - resource_group_name = var.rg_name_dns +module "local_vnet" { + source = "../../../virtual-network" + + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location + + address_space = ["10.0.0.0/16"] +} + +module "local_snet_default" { + source = "../../../subnet" + + rg_name = module.local_rg.name + name = "vnet-${random_string.postfix.result}-kusto-default" + vnet_name = module.local_vnet.name + address_prefixes = ["10.0.6.0/24"] +} + +# DNS zones + +module "local_pdnsz_dec_cluster" { + source = "../../../private-dns-zone" + + rg_name = module.local_rg.name + dns_zones = [local.dns_dec_cluster] + vnet_id = module.local_vnet.id } \ No newline at end of file diff --git a/terraform/data-explorer/kusto-cluster/test/locals.tf b/terraform/data-explorer/kusto-cluster/test/locals.tf index 7a1131d5..10dcb0f7 100644 --- a/terraform/data-explorer/kusto-cluster/test/locals.tf +++ b/terraform/data-explorer/kusto-cluster/test/locals.tf @@ -1,5 +1,9 @@ locals { - snet_name = "snet-adl-modules-test-default" - vnet_name = "vnet-adl-modules-test" + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "kusto-cluster" + Toolkit = "Terraform" + } + dns_dec_cluster = "privatelink.northeurope.kusto.windows.net" } \ No newline at end of file diff --git a/terraform/data-explorer/kusto-database/test/main.tf b/terraform/data-explorer/kusto-cluster/test/providers.tf similarity index 77% rename from terraform/data-explorer/kusto-database/test/main.tf rename to terraform/data-explorer/kusto-cluster/test/providers.tf index e08a619f..b8b4525d 100644 --- a/terraform/data-explorer/kusto-database/test/main.tf +++ b/terraform/data-explorer/kusto-cluster/test/providers.tf @@ -3,13 +3,13 @@ terraform { resource_group_name = "rg-adl-terraform-state" storage_account_name = "stadlterraformstate" container_name = "default" - key = "keyvault.terraform.tfstate" + key = "kustocluster.terraform.tfstate" } required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/data-explorer/kusto-cluster/test/variables.tf b/terraform/data-explorer/kusto-cluster/test/variables.tf index c2d60718..b025435b 100644 --- a/terraform/data-explorer/kusto-cluster/test/variables.tf +++ b/terraform/data-explorer/kusto-cluster/test/variables.tf @@ -7,14 +7,4 @@ resource "random_string" "postfix" { variable "location" { type = string default = "North Europe" -} - -variable "rg_name" { - type = string - default = "rg-adl-modules-test-01" -} - -variable "rg_name_dns" { - type = string - default = "rg-adl-modules-test-01-global-dns" } \ No newline at end of file diff --git a/terraform/data-explorer/kusto-cluster/variables.tf b/terraform/data-explorer/kusto-cluster/variables.tf index 7fedefb7..6414baf2 100644 --- a/terraform/data-explorer/kusto-cluster/variables.tf +++ b/terraform/data-explorer/kusto-cluster/variables.tf @@ -28,11 +28,13 @@ variable "is_sec_module" { variable "subnet_id" { type = string description = "The ID of the subnet from which private IP addresses will be allocated for this Private Endpoint" + default = "" } variable "private_dns_zone_ids" { type = list(string) description = "Specifies the list of Private DNS Zones to include" + default = [] } variable "sku_name" { diff --git a/terraform/data-explorer/kusto-database/test/kusto_database.tf b/terraform/data-explorer/kusto-database/test/kusto_database.tf index 297e77f6..55707be5 100644 --- a/terraform/data-explorer/kusto-database/test/kusto_database.tf +++ b/terraform/data-explorer/kusto-database/test/kusto_database.tf @@ -2,7 +2,7 @@ module "kusto_database" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location cluster_name = module.local_kusto_cluster.name @@ -12,6 +12,51 @@ module "kusto_database" { # Module dependencies +module "local_rg" { + source = "../../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags +} + module "local_kusto_cluster" { - source = "../../kusto-cluster/test" + source = "../../kusto-cluster" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location + + subnet_id = module.local_snet_default.id + private_dns_zone_ids = [module.local_pdnsz_dec_cluster.list[local.dns_dec_cluster].id] +} + +module "local_vnet" { + source = "../../../virtual-network" + + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location + + address_space = ["10.0.0.0/16"] +} + +module "local_snet_default" { + source = "../../../subnet" + + rg_name = module.local_rg.name + name = "vnet-${random_string.postfix.result}-kusto-default" + vnet_name = module.local_vnet.name + address_prefixes = ["10.0.6.0/24"] +} + +# DNS zones + +module "local_pdnsz_dec_cluster" { + source = "../../../private-dns-zone" + + rg_name = module.local_rg.name + dns_zones = [local.dns_dec_cluster] + vnet_id = module.local_vnet.id } \ No newline at end of file diff --git a/terraform/data-explorer/kusto-database/test/locals.tf b/terraform/data-explorer/kusto-database/test/locals.tf index 130235aa..7aab921f 100644 --- a/terraform/data-explorer/kusto-database/test/locals.tf +++ b/terraform/data-explorer/kusto-database/test/locals.tf @@ -1,5 +1,9 @@ locals { - snet_name = "snet-adl-modules-test-default" - vnet_name = "vnet-adl-modules-test" - dns_kv_vault = "privatelink.vaultcore.azure.net" + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "kusto-database" + Toolkit = "Terraform" + } + + dns_dec_cluster = "privatelink.northeurope.kusto.windows.net" } \ No newline at end of file diff --git a/terraform/data-explorer/kusto-cluster/test/main.tf b/terraform/data-explorer/kusto-database/test/providers.tf similarity index 77% rename from terraform/data-explorer/kusto-cluster/test/main.tf rename to terraform/data-explorer/kusto-database/test/providers.tf index e08a619f..c9b205ef 100644 --- a/terraform/data-explorer/kusto-cluster/test/main.tf +++ b/terraform/data-explorer/kusto-database/test/providers.tf @@ -3,13 +3,13 @@ terraform { resource_group_name = "rg-adl-terraform-state" storage_account_name = "stadlterraformstate" container_name = "default" - key = "keyvault.terraform.tfstate" + key = "kustodatabase.terraform.tfstate" } required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/data-explorer/kusto-database/test/variables.tf b/terraform/data-explorer/kusto-database/test/variables.tf index edf7f3e0..b025435b 100644 --- a/terraform/data-explorer/kusto-database/test/variables.tf +++ b/terraform/data-explorer/kusto-database/test/variables.tf @@ -7,9 +7,4 @@ resource "random_string" "postfix" { variable "location" { type = string default = "North Europe" -} - -variable "rg_name" { - type = string - default = "rg-adl-modules-test-01" } \ No newline at end of file diff --git a/terraform/data-factory/test/data_factory.tf b/terraform/data-factory/test/data_factory.tf index fa5c7664..df83462d 100644 --- a/terraform/data-factory/test/data_factory.tf +++ b/terraform/data-factory/test/data_factory.tf @@ -2,32 +2,60 @@ module "data_factory" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location - subnet_id = data.azurerm_subnet.snet_default.id - private_dns_zone_ids_df = [data.azurerm_private_dns_zone.adf_df.id] - private_dns_zone_ids_portal = [data.azurerm_private_dns_zone.adf_portal.id] - - module_enabled = true + subnet_id = module.local_snet_default.id + private_dns_zone_ids_df = [module.local_pdnsz_adf_df.list[local.dns_adf_df].id] + private_dns_zone_ids_portal = [module.local_pdnsz_adf_portal.list[local.dns_adf_portal].id] tags = {} } -# Data dependencies +# Module dependencies + +module "local_rg" { + source = "../../resource-group" + + basename = random_string.postfix.result + location = var.location -data "azurerm_subnet" "snet_default" { - name = local.snet_name - virtual_network_name = local.vnet_name - resource_group_name = var.rg_name + tags = local.tags } -data "azurerm_private_dns_zone" "adf_df" { - name = local.dns_adf_df - resource_group_name = var.rg_name_dns +module "local_vnet" { + source = "../../virtual-network" + + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location + + address_space = ["10.0.0.0/16"] } -data "azurerm_private_dns_zone" "adf_portal" { - name = local.dns_adf_portal - resource_group_name = var.rg_name_dns +module "local_snet_default" { + source = "../../subnet" + + rg_name = module.local_rg.name + name = "vnet-${random_string.postfix.result}-adf-default" + vnet_name = module.local_vnet.name + address_prefixes = ["10.0.6.0/24"] +} + +# DNS zones + +module "local_pdnsz_adf_df" { + source = "../../private-dns-zone" + + rg_name = module.local_rg.name + dns_zones = [local.dns_adf_df] + vnet_id = module.local_vnet.id +} + +module "local_pdnsz_adf_portal" { + source = "../../private-dns-zone" + + rg_name = module.local_rg.name + dns_zones = [local.dns_adf_portal] + vnet_id = module.local_vnet.id } \ No newline at end of file diff --git a/terraform/data-factory/test/locals.tf b/terraform/data-factory/test/locals.tf index 1d7f7cca..e36da1f6 100644 --- a/terraform/data-factory/test/locals.tf +++ b/terraform/data-factory/test/locals.tf @@ -1,6 +1,10 @@ locals { - snet_name = "snet-adl-modules-test-default" - vnet_name = "vnet-adl-modules-test" + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "data-factory" + Toolkit = "Terraform" + } + dns_adf_df = "privatelink.datafactory.azure.net" dns_adf_portal = "privatelink.adf.azure.com" } \ No newline at end of file diff --git a/terraform/data-factory/test/main.tf b/terraform/data-factory/test/providers.tf similarity index 93% rename from terraform/data-factory/test/main.tf rename to terraform/data-factory/test/providers.tf index 0b323c13..c1e87649 100644 --- a/terraform/data-factory/test/main.tf +++ b/terraform/data-factory/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/data-factory/test/variables.tf b/terraform/data-factory/test/variables.tf index c2d60718..b025435b 100644 --- a/terraform/data-factory/test/variables.tf +++ b/terraform/data-factory/test/variables.tf @@ -7,14 +7,4 @@ resource "random_string" "postfix" { variable "location" { type = string default = "North Europe" -} - -variable "rg_name" { - type = string - default = "rg-adl-modules-test-01" -} - -variable "rg_name_dns" { - type = string - default = "rg-adl-modules-test-01-global-dns" } \ No newline at end of file diff --git a/terraform/data-factory/variables.tf b/terraform/data-factory/variables.tf index 8a9d6b68..279730bc 100644 --- a/terraform/data-factory/variables.tf +++ b/terraform/data-factory/variables.tf @@ -22,6 +22,7 @@ variable "tags" { variable "module_enabled" { type = bool description = "Variable to enable or disable the module" + default = true } variable "is_sec_module" { @@ -33,6 +34,7 @@ variable "is_sec_module" { variable "subnet_id" { type = string description = "The ID of the subnet from which private IP addresses will be allocated for this Private Endpoint" + default = "" } variable "public_network_access_enabled" { @@ -50,9 +52,11 @@ variable "managed_virtual_network_enabled" { variable "private_dns_zone_ids_df" { type = list(string) description = "Specifies the list of Private DNS Zones to include" + default = [] } variable "private_dns_zone_ids_portal" { type = list(string) description = "Specifies the list of Private DNS Zones to include" + default = [] } \ No newline at end of file diff --git a/terraform/databricks/main.tf b/terraform/databricks/main.tf index 0a7ee16c..53ba35c5 100644 --- a/terraform/databricks/main.tf +++ b/terraform/databricks/main.tf @@ -1,127 +1,36 @@ # https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/databricks_workspace # https://registry.terraform.io/providers/databricks/databricks/latest/docs - -resource "azurerm_virtual_network" "adb_vnet" { - name = "vnet-${var.basename}" - address_space = ["10.0.0.0/16"] - location = var.location - resource_group_name = var.rg_name -} - -resource "azurerm_subnet" "adb_snet_public" { - name = "vnet-${var.basename}-public" - resource_group_name = var.rg_name - virtual_network_name = azurerm_virtual_network.adb_vnet.name - address_prefixes = ["10.0.1.0/24"] - - delegation { - name = "databricks-del-pub-${var.basename}" - - service_delegation { - actions = [ - "Microsoft.Network/virtualNetworks/subnets/join/action", - "Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action", - "Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action", - ] - name = "Microsoft.Databricks/workspaces" - } - } -} - -resource "azurerm_subnet" "adb_snet_private" { - name = "vnet-${var.basename}-private" - resource_group_name = var.rg_name - virtual_network_name = azurerm_virtual_network.adb_vnet.name - address_prefixes = ["10.0.2.0/24"] - - delegation { - name = "databricks-del-pri-${var.basename}" - - service_delegation { - actions = [ - "Microsoft.Network/virtualNetworks/subnets/join/action", - "Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action", - "Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action", - ] - name = "Microsoft.Databricks/workspaces" - } - } -} - -resource "azurerm_subnet" "adb_snet_pe" { - name = "vnet-${var.basename}-private-endpoint" - resource_group_name = var.rg_name - virtual_network_name = azurerm_virtual_network.adb_vnet.name - address_prefixes = ["10.0.3.0/24"] - - private_endpoint_network_policies_enabled = false - - count = var.is_sec_module ? 1 : 0 -} - -resource "azurerm_subnet_network_security_group_association" "adb_snet_private_nsg" { - subnet_id = azurerm_subnet.adb_snet_private.id - network_security_group_id = azurerm_network_security_group.adb_nsg.id -} - -resource "azurerm_subnet_network_security_group_association" "adb_snet_public_nsg" { - subnet_id = azurerm_subnet.adb_snet_public.id - network_security_group_id = azurerm_network_security_group.adb_nsg.id -} - -resource "azurerm_network_security_group" "adb_nsg" { - name = "nsg-${var.basename}" - location = var.location - resource_group_name = var.rg_name -} - resource "azurerm_databricks_workspace" "adl_databricks" { name = "adb-${var.basename}" resource_group_name = var.rg_name location = var.location - sku = "premium" + sku = var.sku managed_resource_group_name = "${var.rg_name}-adb-managed" - public_network_access_enabled = var.is_sec_module ? false : true - network_security_group_rules_required = var.is_sec_module ? "NoAzureDatabricksRules" : "AllRules" + public_network_access_enabled = var.is_sec_module && var.public_network_enabled ? false : true + network_security_group_rules_required = var.is_sec_module && var.public_network_enabled ? "NoAzureDatabricksRules" : "AllRules" custom_parameters { no_public_ip = var.is_sec_module ? true : false - public_subnet_name = azurerm_subnet.adb_snet_public.name - private_subnet_name = azurerm_subnet.adb_snet_private.name - virtual_network_id = azurerm_virtual_network.adb_vnet.id + public_subnet_name = var.public_subnet_name + private_subnet_name = var.private_subnet_name + virtual_network_id = var.virtual_network_id - public_subnet_network_security_group_association_id = azurerm_subnet_network_security_group_association.adb_snet_public_nsg.id - private_subnet_network_security_group_association_id = azurerm_subnet_network_security_group_association.adb_snet_private_nsg.id + public_subnet_network_security_group_association_id = var.public_subnet_network_security_group_association_id + private_subnet_network_security_group_association_id = var.private_subnet_network_security_group_association_id } tags = var.tags } -resource "azurerm_private_dns_zone" "databricks_dns" { - #depends_on = [azurerm_private_endpoint.databricks_pe] - - name = "privatelink.azuredatabricks.net" - resource_group_name = var.rg_name - - count = var.is_sec_module ? 1 : 0 -} - -resource "azurerm_private_dns_zone_virtual_network_link" "databricks_dns_netlink" { - name = "vnet-${var.basename}-adb-netlink" - resource_group_name = var.rg_name - private_dns_zone_name = azurerm_private_dns_zone.databricks_dns[0].name - virtual_network_id = azurerm_virtual_network.adb_vnet.id - - count = var.is_sec_module ? 1 : 0 -} +# Private Endpoint configuration resource "azurerm_private_endpoint" "databricks_pe_be" { name = "pe-${azurerm_databricks_workspace.adl_databricks.name}-databricks-be" location = var.location resource_group_name = var.rg_name - subnet_id = azurerm_subnet.adb_snet_pe[0].id + subnet_id = var.backend_subnet_id private_service_connection { name = "psc-databricks-be-${var.basename}" @@ -132,10 +41,13 @@ resource "azurerm_private_endpoint" "databricks_pe_be" { private_dns_zone_group { name = "private-dns-zone-group-adb" - private_dns_zone_ids = [azurerm_private_dns_zone.databricks_dns[0].id] + private_dns_zone_ids = var.backend_private_dns_zone_ids } - count = var.is_sec_module ? 1 : 0 + # Only deploy if backend and frontend use different private endpoints + count = var.is_sec_module && (var.maximum_network_security) ? 1 : 0 + + tags = var.tags } resource "azurerm_private_endpoint" "databricks_fe" { @@ -157,6 +69,8 @@ resource "azurerm_private_endpoint" "databricks_fe" { } count = var.is_sec_module ? 1 : 0 + + tags = var.tags } resource "azurerm_private_endpoint" "databricks_pe_sso" { @@ -178,4 +92,6 @@ resource "azurerm_private_endpoint" "databricks_pe_sso" { } count = var.is_sec_module ? 1 : 0 + + tags = var.tags } \ No newline at end of file diff --git a/terraform/databricks/test/databricks.tf b/terraform/databricks/test/databricks.tf index 7130d42f..d7244843 100644 --- a/terraform/databricks/test/databricks.tf +++ b/terraform/databricks/test/databricks.tf @@ -2,24 +2,126 @@ module "databricks" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location - subnet_id = data.azurerm_subnet.snet_default.id - private_dns_zone_ids = [data.azurerm_private_dns_zone.adb.id] + virtual_network_id = module.local_vnet.id + subnet_id = module.local_snet_default.id + private_dns_zone_ids = [module.local_pdnsz_adb.list[local.dns_databricks].id] + + public_subnet_name = module.local_snet_public.name + private_subnet_name = module.local_snet_private.name + + public_subnet_network_security_group_association_id = module.local_snet_nsg_association_public.id + private_subnet_network_security_group_association_id = module.local_snet_nsg_association_private.id tags = {} } -# Data dependencies +# Modules dependencies + +module "local_rg" { + source = "../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags +} + +module "local_vnet" { + source = "../../virtual-network" + + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location + + address_space = ["10.0.0.0/16"] +} + +module "local_snet_default" { + source = "../../subnet" + + rg_name = module.local_rg.name + name = "vnet-${random_string.postfix.result}-adb-default" + vnet_name = module.local_vnet.name + address_prefixes = ["10.0.6.0/24"] +} + +module "local_snet_public" { + source = "../../subnet" -data "azurerm_subnet" "snet_default" { - name = local.snet_name - virtual_network_name = local.vnet_name - resource_group_name = var.rg_name + rg_name = module.local_rg.name + name = "vnet-${random_string.postfix.result}-adb-public" + vnet_name = module.local_vnet.name + address_prefixes = ["10.0.4.0/24"] + + subnet_delegation = { + databricks-del-pub = [ + { + name = "Microsoft.Databricks/workspaces" + actions = [ + "Microsoft.Network/virtualNetworks/subnets/join/action", + "Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action", + "Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action" + ] + } + ] + } +} + +module "local_snet_private" { + source = "../../subnet" + + rg_name = module.local_rg.name + name = "vnet-${random_string.postfix.result}-adb-private" + vnet_name = module.local_vnet.name + address_prefixes = ["10.0.5.0/24"] + + subnet_delegation = { + databricks-del-pri = [ + { + name = "Microsoft.Databricks/workspaces" + actions = [ + "Microsoft.Network/virtualNetworks/subnets/join/action", + "Microsoft.Network/virtualNetworks/subnets/prepareNetworkPolicies/action", + "Microsoft.Network/virtualNetworks/subnets/unprepareNetworkPolicies/action" + ] + } + ] + } +} + +# Network Security Group + +module "local_nsg" { + source = "../../network-security-group" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location } -data "azurerm_private_dns_zone" "adb" { - name = local.dns_databricks - resource_group_name = var.rg_name_dns +module "local_snet_nsg_association_public" { + source = "../../subnet-network-security-group-association" + + subnet_id = module.local_snet_public.id + network_security_group_id = module.local_nsg.id } + +module "local_snet_nsg_association_private" { + source = "../../subnet-network-security-group-association" + + subnet_id = module.local_snet_private.id + network_security_group_id = module.local_nsg.id +} + +# DNS Zones + +module "local_pdnsz_adb" { + source = "../../private-dns-zone" + + rg_name = module.local_rg.name + dns_zones = [local.dns_databricks] + vnet_id = module.local_vnet.id +} \ No newline at end of file diff --git a/terraform/databricks/test/locals.tf b/terraform/databricks/test/locals.tf index 540f4b7b..ac5881e7 100644 --- a/terraform/databricks/test/locals.tf +++ b/terraform/databricks/test/locals.tf @@ -1,5 +1,9 @@ locals { - snet_name = "snet-adl-modules-test-default" - vnet_name = "vnet-adl-modules-test" + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "databricks-workspace" + Toolkit = "Terraform" + } + dns_databricks = "privatelink.azuredatabricks.net" } \ No newline at end of file diff --git a/terraform/databricks/test/main.tf b/terraform/databricks/test/providers.tf similarity index 92% rename from terraform/databricks/test/main.tf rename to terraform/databricks/test/providers.tf index 9168df5f..0fb962fc 100644 --- a/terraform/databricks/test/main.tf +++ b/terraform/databricks/test/providers.tf @@ -9,11 +9,12 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } } + provider "azurerm" { features {} } \ No newline at end of file diff --git a/terraform/databricks/test/variables.tf b/terraform/databricks/test/variables.tf index 222ed625..b025435b 100644 --- a/terraform/databricks/test/variables.tf +++ b/terraform/databricks/test/variables.tf @@ -7,14 +7,4 @@ resource "random_string" "postfix" { variable "location" { type = string default = "North Europe" -} - -variable "rg_name" { - type = string - default = "rg-adl-modules-test-01" -} - -variable "rg_name_dns" { - type = string - default = "rg-adl-modules-test-01-global-dns" -} +} \ No newline at end of file diff --git a/terraform/databricks/variables.tf b/terraform/databricks/variables.tf index c0b904c0..b9b37440 100644 --- a/terraform/databricks/variables.tf +++ b/terraform/databricks/variables.tf @@ -28,6 +28,13 @@ variable "is_sec_module" { variable "subnet_id" { type = string description = "The ID of the subnet from which private IP addresses will be allocated for the user access Private Endpoints" + default = "" +} + +variable "backend_subnet_id" { + type = string + description = "Only used when maximum_network_security is true. The ID of the subnet from which private IP addresses will be allocated for the backend Private Endpoint" + default = null } variable "public_network_enabled" { @@ -39,4 +46,48 @@ variable "public_network_enabled" { variable "private_dns_zone_ids" { type = list(string) description = "Specifies the list of Private DNS Zones to include" + default = [] +} + +variable "backend_private_dns_zone_ids" { + type = list(string) + description = "Only used when maximum_network_security is true. Specifies the list of Private DNS Zones to include for the backend" + default = null +} + +variable "sku" { + type = string + description = "The sku to use for the Databricks Workspace" + default = "premium" } + +variable "public_subnet_name" { + type = string + description = "The name of the Public Subnet within the Virtual Network" +} + +variable "private_subnet_name" { + type = string + description = "The name of the Private Subnet within the Virtual Network" +} + +variable "maximum_network_security" { + type = bool + description = "Separate private endpoints for backend and frontend?" + default = false +} + +variable "virtual_network_id" { + type = string + description = "The ID of a Virtual Network where this Databricks Cluster should be created" +} + +variable "public_subnet_network_security_group_association_id" { + type = string + description = "The resource ID of the azurerm_subnet_network_security_group_association resource which is referred to by the public_subnet_name field" +} + +variable "private_subnet_network_security_group_association_id" { + type = string + description = "The resource ID of the azurerm_subnet_network_security_group_association resource which is referred to by the private_subnet_name field" +} \ No newline at end of file diff --git a/terraform/event-grid/event-grid-domain/test/event_grid_domain.tf b/terraform/event-grid/event-grid-domain/test/event_grid_domain.tf index dd699d60..86cc7f1b 100644 --- a/terraform/event-grid/event-grid-domain/test/event_grid_domain.tf +++ b/terraform/event-grid/event-grid-domain/test/event_grid_domain.tf @@ -2,24 +2,51 @@ module "event_grid_domain" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location - subnet_id = data.azurerm_subnet.snet_default.id - private_dns_zone_ids = [data.azurerm_private_dns_zone.ev_domain.id] + subnet_id = module.local_snet_default.id + private_dns_zone_ids = [module.local_pdnsz_ev_domain.list[local.dns_ev_domain].id] tags = {} } -# Data dependencies +# Modules dependencies -data "azurerm_subnet" "snet_default" { - name = local.snet_name - virtual_network_name = local.vnet_name - resource_group_name = var.rg_name +module "local_rg" { + source = "../../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags } -data "azurerm_private_dns_zone" "ev_domain" { - name = local.dns_ev_domain - resource_group_name = var.rg_name_dns +module "local_vnet" { + source = "../../../virtual-network" + + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location + + address_space = ["10.0.0.0/16"] +} + +module "local_snet_default" { + source = "../../../subnet" + + rg_name = module.local_rg.name + name = "vnet-${random_string.postfix.result}-evd-default" + vnet_name = module.local_vnet.name + address_prefixes = ["10.0.6.0/24"] +} + +# DNS zones + +module "local_pdnsz_ev_domain" { + source = "../../../private-dns-zone" + + rg_name = module.local_rg.name + dns_zones = [local.dns_ev_domain] + vnet_id = module.local_vnet.id } \ No newline at end of file diff --git a/terraform/event-grid/event-grid-domain/test/locals.tf b/terraform/event-grid/event-grid-domain/test/locals.tf index b13af255..20a03e6d 100644 --- a/terraform/event-grid/event-grid-domain/test/locals.tf +++ b/terraform/event-grid/event-grid-domain/test/locals.tf @@ -1,5 +1,9 @@ locals { - snet_name = "snet-adl-modules-test-default" - vnet_name = "vnet-adl-modules-test" + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "event-grid-domain" + Toolkit = "Terraform" + } + dns_ev_domain = "privatelink.eventgrid.azure.net" } \ No newline at end of file diff --git a/terraform/event-grid/event-grid-domain/test/main.tf b/terraform/event-grid/event-grid-domain/test/providers.tf similarity index 93% rename from terraform/event-grid/event-grid-domain/test/main.tf rename to terraform/event-grid/event-grid-domain/test/providers.tf index 7c613e51..c2f497c8 100644 --- a/terraform/event-grid/event-grid-domain/test/main.tf +++ b/terraform/event-grid/event-grid-domain/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/event-grid/event-grid-domain/test/variables.tf b/terraform/event-grid/event-grid-domain/test/variables.tf index c2d60718..b025435b 100644 --- a/terraform/event-grid/event-grid-domain/test/variables.tf +++ b/terraform/event-grid/event-grid-domain/test/variables.tf @@ -7,14 +7,4 @@ resource "random_string" "postfix" { variable "location" { type = string default = "North Europe" -} - -variable "rg_name" { - type = string - default = "rg-adl-modules-test-01" -} - -variable "rg_name_dns" { - type = string - default = "rg-adl-modules-test-01-global-dns" } \ No newline at end of file diff --git a/terraform/event-grid/event-grid-domain/variables.tf b/terraform/event-grid/event-grid-domain/variables.tf index 9c915248..9278422f 100644 --- a/terraform/event-grid/event-grid-domain/variables.tf +++ b/terraform/event-grid/event-grid-domain/variables.tf @@ -28,11 +28,13 @@ variable "is_sec_module" { variable "subnet_id" { type = string description = "The ID of the subnet from which private IP addresses will be allocated for this Private Endpoint" + default = "" } variable "private_dns_zone_ids" { type = list(string) description = "Specifies the list of Private DNS Zones to include" + default = [] } variable "input_schema" { diff --git a/terraform/event-grid/event-grid-topic/test/event_grid_topic.tf b/terraform/event-grid/event-grid-topic/test/event_grid_topic.tf index ca11d2ef..e68c49ff 100644 --- a/terraform/event-grid/event-grid-topic/test/event_grid_topic.tf +++ b/terraform/event-grid/event-grid-topic/test/event_grid_topic.tf @@ -2,24 +2,51 @@ module "event_grid_topic" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location - subnet_id = data.azurerm_subnet.snet_default.id - private_dns_zone_ids = [data.azurerm_private_dns_zone.ev_topic.id] + subnet_id = module.local_snet_default.id + private_dns_zone_ids = [module.local_pdnsz_ev_topic.list[local.dns_ev_topic].id] tags = {} } -# Data dependencies +# Modules dependencies -data "azurerm_subnet" "snet_default" { - name = local.snet_name - virtual_network_name = local.vnet_name - resource_group_name = var.rg_name +module "local_rg" { + source = "../../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags } -data "azurerm_private_dns_zone" "ev_topic" { - name = local.dns_ev_topic - resource_group_name = var.rg_name_dns +module "local_vnet" { + source = "../../../virtual-network" + + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location + + address_space = ["10.0.0.0/16"] +} + +module "local_snet_default" { + source = "../../../subnet" + + rg_name = module.local_rg.name + name = "vnet-${random_string.postfix.result}-evt-default" + vnet_name = module.local_vnet.name + address_prefixes = ["10.0.6.0/24"] +} + +# DNS zones + +module "local_pdnsz_ev_topic" { + source = "../../../private-dns-zone" + + rg_name = module.local_rg.name + dns_zones = [local.dns_ev_topic] + vnet_id = module.local_vnet.id } \ No newline at end of file diff --git a/terraform/event-grid/event-grid-topic/test/locals.tf b/terraform/event-grid/event-grid-topic/test/locals.tf index bbf40df3..cda2bb48 100644 --- a/terraform/event-grid/event-grid-topic/test/locals.tf +++ b/terraform/event-grid/event-grid-topic/test/locals.tf @@ -1,5 +1,9 @@ locals { - snet_name = "snet-adl-modules-test-default" - vnet_name = "vnet-adl-modules-test" + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "event-grid-topic" + Toolkit = "Terraform" + } + dns_ev_topic = "privatelink.eventgrid.azure.net" } \ No newline at end of file diff --git a/terraform/event-grid/event-grid-topic/test/main.tf b/terraform/event-grid/event-grid-topic/test/providers.tf similarity index 93% rename from terraform/event-grid/event-grid-topic/test/main.tf rename to terraform/event-grid/event-grid-topic/test/providers.tf index 3baca5f9..f6206e0a 100644 --- a/terraform/event-grid/event-grid-topic/test/main.tf +++ b/terraform/event-grid/event-grid-topic/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/event-grid/event-grid-topic/test/variables.tf b/terraform/event-grid/event-grid-topic/test/variables.tf index c2d60718..b025435b 100644 --- a/terraform/event-grid/event-grid-topic/test/variables.tf +++ b/terraform/event-grid/event-grid-topic/test/variables.tf @@ -7,14 +7,4 @@ resource "random_string" "postfix" { variable "location" { type = string default = "North Europe" -} - -variable "rg_name" { - type = string - default = "rg-adl-modules-test-01" -} - -variable "rg_name_dns" { - type = string - default = "rg-adl-modules-test-01-global-dns" } \ No newline at end of file diff --git a/terraform/event-grid/event-grid-topic/variables.tf b/terraform/event-grid/event-grid-topic/variables.tf index 9aa9cbb7..395cff69 100644 --- a/terraform/event-grid/event-grid-topic/variables.tf +++ b/terraform/event-grid/event-grid-topic/variables.tf @@ -28,11 +28,13 @@ variable "is_sec_module" { variable "subnet_id" { type = string description = "The ID of the subnet from which private IP addresses will be allocated for this Private Endpoint" + default = "" } variable "private_dns_zone_ids" { type = list(string) description = "Specifies the list of Private DNS Zones to include" + default = [] } variable "input_schema" { diff --git a/terraform/event-hubs/event-hubs-namespace/test/event_hubs_namespace.tf b/terraform/event-hubs/event-hubs-namespace/test/event_hubs_namespace.tf index 0275ca35..f6cf1a38 100644 --- a/terraform/event-hubs/event-hubs-namespace/test/event_hubs_namespace.tf +++ b/terraform/event-hubs/event-hubs-namespace/test/event_hubs_namespace.tf @@ -2,26 +2,51 @@ module "event_hubs_namespace" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location - subnet_id = data.azurerm_subnet.snet_default.id - private_dns_zone_ids = [data.azurerm_private_dns_zone.ev_namespace.id] - - module_enabled = true + subnet_id = module.local_snet_default.id + private_dns_zone_ids = [module.local_pdnsz_ehn.list[local.dns_ev_namespace].id] tags = {} } -# Data dependencies +# Modules dependencies + +module "local_rg" { + source = "../../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags +} + +module "local_vnet" { + source = "../../../virtual-network" -data "azurerm_subnet" "snet_default" { - name = local.snet_name - virtual_network_name = local.vnet_name - resource_group_name = var.rg_name + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location + + address_space = ["10.0.0.0/16"] +} + +module "local_snet_default" { + source = "../../../subnet" + + rg_name = module.local_rg.name + name = "vnet-${random_string.postfix.result}-ehn-default" + vnet_name = module.local_vnet.name + address_prefixes = ["10.0.6.0/24"] } -data "azurerm_private_dns_zone" "ev_namespace" { - name = local.dns_ev_namespace - resource_group_name = var.rg_name_dns +# DNS zones + +module "local_pdnsz_ehn" { + source = "../../../private-dns-zone" + + rg_name = module.local_rg.name + dns_zones = [local.dns_ev_namespace] + vnet_id = module.local_vnet.id } \ No newline at end of file diff --git a/terraform/event-hubs/event-hubs-namespace/test/locals.tf b/terraform/event-hubs/event-hubs-namespace/test/locals.tf index 48dd3996..4be6d517 100644 --- a/terraform/event-hubs/event-hubs-namespace/test/locals.tf +++ b/terraform/event-hubs/event-hubs-namespace/test/locals.tf @@ -1,5 +1,9 @@ locals { - snet_name = "snet-adl-modules-test-default" - vnet_name = "vnet-adl-modules-test" + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "event-hubs-namespace" + Toolkit = "Terraform" + } + dns_ev_namespace = "privatelink.servicebus.windows.net" } \ No newline at end of file diff --git a/terraform/event-hubs/event-hubs-namespace/test/main.tf b/terraform/event-hubs/event-hubs-namespace/test/providers.tf similarity index 93% rename from terraform/event-hubs/event-hubs-namespace/test/main.tf rename to terraform/event-hubs/event-hubs-namespace/test/providers.tf index c306a759..1d1cc6df 100644 --- a/terraform/event-hubs/event-hubs-namespace/test/main.tf +++ b/terraform/event-hubs/event-hubs-namespace/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/event-hubs/event-hubs-namespace/test/variables.tf b/terraform/event-hubs/event-hubs-namespace/test/variables.tf index c2d60718..b025435b 100644 --- a/terraform/event-hubs/event-hubs-namespace/test/variables.tf +++ b/terraform/event-hubs/event-hubs-namespace/test/variables.tf @@ -7,14 +7,4 @@ resource "random_string" "postfix" { variable "location" { type = string default = "North Europe" -} - -variable "rg_name" { - type = string - default = "rg-adl-modules-test-01" -} - -variable "rg_name_dns" { - type = string - default = "rg-adl-modules-test-01-global-dns" } \ No newline at end of file diff --git a/terraform/event-hubs/event-hubs-namespace/variables.tf b/terraform/event-hubs/event-hubs-namespace/variables.tf index 0b8d8756..b80da0de 100644 --- a/terraform/event-hubs/event-hubs-namespace/variables.tf +++ b/terraform/event-hubs/event-hubs-namespace/variables.tf @@ -33,6 +33,7 @@ variable "is_sec_module" { variable "subnet_id" { type = string description = "The ID of the subnet from which private IP addresses will be allocated for this Private Endpoint" + default = "" } variable "sku" { @@ -62,6 +63,7 @@ variable "auto_inflate_enabled" { variable "private_dns_zone_ids" { type = list(string) description = "Specifies the list of Private DNS Zones to include" + default = [] } variable "partition_count" { diff --git a/terraform/hdinsight/hdinsight-hadoop/test/hdinsight_hadoop.tf b/terraform/hdinsight/hdinsight-hadoop/test/hdinsight_hadoop.tf index 7bf54180..cae714b9 100644 --- a/terraform/hdinsight/hdinsight-hadoop/test/hdinsight_hadoop.tf +++ b/terraform/hdinsight/hdinsight-hadoop/test/hdinsight_hadoop.tf @@ -2,11 +2,11 @@ module "hdinsight_hadoop" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location - subnet_id = data.azurerm_subnet.snet_default.id - virtual_network_id = data.azurerm_virtual_network.vnet_default.id + subnet_id = module.local_snet_default.id + virtual_network_id = module.local_vnet.id cluster_version = "4.0" component_version_hadoop = "3.1" @@ -27,17 +27,17 @@ module "hdinsight_hadoop" { managed_identity_resource_id = module.local_user_managed_identity.id managed_identity_principal_id = module.local_user_managed_identity.principal_id - ambari_server_name = module.local_sql_server.name + ambari_server_name = module.local_sql_database_server.name ambari_database_name = module.local_sql_database_ambari.name ambari_database_administrator_login = "sqladminuser" ambari_database_administrator_login_password = "ThisIsNotVerySecure!" - hive_server_name = module.local_sql_server.name + hive_server_name = module.local_sql_database_server.name hive_database_name = module.local_sql_database_hive.name hive_database_administrator_login = "sqladminuser" hive_database_administrator_login_password = "ThisIsNotVerySecure!" - oozie_server_name = module.local_sql_server.name + oozie_server_name = module.local_sql_database_server.name oozie_database_name = module.local_sql_database_oozie.name oozie_database_administrator_login = "sqladminuser" oozie_database_administrator_login_password = "ThisIsNotVerySecure!" @@ -45,59 +45,112 @@ module "hdinsight_hadoop" { tags = {} } -# Data dependencies +# Modules dependencies -data "azurerm_virtual_network" "vnet_default" { - name = local.vnet_name - resource_group_name = var.rg_name +module "local_rg" { + source = "../../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags +} + +module "local_vnet" { + source = "../../../virtual-network" + + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location + + address_space = ["10.0.0.0/16"] } -data "azurerm_subnet" "snet_default" { - name = local.snet_name - virtual_network_name = local.vnet_name - resource_group_name = var.rg_name +module "local_snet_default" { + source = "../../../subnet" + + rg_name = module.local_rg.name + name = "vnet-${random_string.postfix.result}-hadoop-default" + vnet_name = module.local_vnet.name + address_prefixes = ["10.0.6.0/24"] } -# Module dependencies +# Storage Account module "local_storage_account" { - source = "../../../storage-account/test" - rg_name = var.rg_name - location = var.location - is_sec_module = false + source = "../../../storage-account" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location + + hns_enabled = true firewall_default_action = "Allow" + + is_sec_module = false } +# User managed identity + module "local_user_managed_identity" { - source = "../../../user-assigned-identity/test" - rg_name = var.rg_name + source = "../../../user-assigned-identity" + + basename = random_string.postfix.result + rg_name = module.local_rg.name location = var.location } -module "local_sql_server" { - source = "../../../sql-database-server/test" - rg_name = var.rg_name - location = var.location +# Metastores + +module "local_sql_database_server" { + source = "../../../sql-database-server" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location + + db_version = "12.0" + administrator_login = "sqladminuser" + administrator_login_password = "ThisIsNotVerySecure!" + is_sec_module = false } module "local_sql_database_ambari" { - source = "../../../sql-database/test" - rg_name = var.rg_name + source = "../../../sql-database" + + basename = "${random_string.postfix.result}ambari" + rg_name = module.local_rg.name location = var.location - server_name = module.local_sql_server.name + server_name = module.local_sql_database_server.name + + collation = "SQL_LATIN1_GENERAL_CP1_CI_AS" + edition = "Standard" + requested_service_objective_name = "S0" } module "local_sql_database_hive" { - source = "../../../sql-database/test" - rg_name = var.rg_name + source = "../../../sql-database" + + basename = "${random_string.postfix.result}hive" + rg_name = module.local_rg.name location = var.location - server_name = module.local_sql_server.name + server_name = module.local_sql_database_server.name + + collation = "SQL_LATIN1_GENERAL_CP1_CI_AS" + edition = "Standard" + requested_service_objective_name = "S0" } module "local_sql_database_oozie" { - source = "../../../sql-database/test" - rg_name = var.rg_name + source = "../../../sql-database" + + basename = "${random_string.postfix.result}oozie" + rg_name = module.local_rg.name location = var.location - server_name = module.local_sql_server.name + server_name = module.local_sql_database_server.name + + collation = "SQL_LATIN1_GENERAL_CP1_CI_AS" + edition = "Standard" + requested_service_objective_name = "S0" } \ No newline at end of file diff --git a/terraform/hdinsight/hdinsight-hadoop/test/locals.tf b/terraform/hdinsight/hdinsight-hadoop/test/locals.tf index cb89cf14..f4873781 100644 --- a/terraform/hdinsight/hdinsight-hadoop/test/locals.tf +++ b/terraform/hdinsight/hdinsight-hadoop/test/locals.tf @@ -1,4 +1,7 @@ locals { - snet_name = "snet-adl-modules-test-default" - vnet_name = "vnet-adl-modules-test" + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "hdinsight-hadoop" + Toolkit = "Terraform" + } } \ No newline at end of file diff --git a/terraform/hdinsight/hdinsight-hadoop/test/main.tf b/terraform/hdinsight/hdinsight-hadoop/test/providers.tf similarity index 93% rename from terraform/hdinsight/hdinsight-hadoop/test/main.tf rename to terraform/hdinsight/hdinsight-hadoop/test/providers.tf index 6c3d1ca2..2261de13 100644 --- a/terraform/hdinsight/hdinsight-hadoop/test/main.tf +++ b/terraform/hdinsight/hdinsight-hadoop/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/hdinsight/hdinsight-hadoop/test/variables.tf b/terraform/hdinsight/hdinsight-hadoop/test/variables.tf index 89c3f5f9..5c6d9742 100644 --- a/terraform/hdinsight/hdinsight-hadoop/test/variables.tf +++ b/terraform/hdinsight/hdinsight-hadoop/test/variables.tf @@ -7,14 +7,4 @@ resource "random_string" "postfix" { variable "location" { type = string default = "Central US" -} - -variable "rg_name" { - type = string - default = "rg-adl-modules-test-01-cus" -} - -variable "rg_name_dns" { - type = string - default = "rg-adl-modules-test-01-global-dns" } \ No newline at end of file diff --git a/terraform/hdinsight/hdinsight-hbase/test/hdinsight_hbase.tf b/terraform/hdinsight/hdinsight-hbase/test/hdinsight_hbase.tf index 03b24116..ba8195ca 100644 --- a/terraform/hdinsight/hdinsight-hbase/test/hdinsight_hbase.tf +++ b/terraform/hdinsight/hdinsight-hbase/test/hdinsight_hbase.tf @@ -2,11 +2,11 @@ module "hdinsight_hbase" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location - subnet_id = data.azurerm_subnet.snet_default.id - virtual_network_id = data.azurerm_virtual_network.vnet_default.id + subnet_id = module.local_snet_default.id + virtual_network_id = module.local_vnet.id cluster_version = "4.0" component_version_hbase = "2.1" @@ -18,7 +18,7 @@ module "hdinsight_hbase" { roles_head_node_vm_size = "A6" roles_worker_node_vm_size = "A5" roles_worker_node_target_instance_count = 2 - roles_zookeeper_node_vm_size = "Small" + roles_zookeeper_node_vm_size = "A5" tier = "Standard" storage_resource_id = module.local_storage_account.id @@ -27,17 +27,17 @@ module "hdinsight_hbase" { managed_identity_resource_id = module.local_user_managed_identity.id managed_identity_principal_id = module.local_user_managed_identity.principal_id - ambari_server_name = module.local_sql_server.name + ambari_server_name = module.local_sql_database_server.name ambari_database_name = module.local_sql_database_ambari.name ambari_database_administrator_login = "sqladminuser" ambari_database_administrator_login_password = "ThisIsNotVerySecure!" - hive_server_name = module.local_sql_server.name + hive_server_name = module.local_sql_database_server.name hive_database_name = module.local_sql_database_hive.name hive_database_administrator_login = "sqladminuser" hive_database_administrator_login_password = "ThisIsNotVerySecure!" - oozie_server_name = module.local_sql_server.name + oozie_server_name = module.local_sql_database_server.name oozie_database_name = module.local_sql_database_oozie.name oozie_database_administrator_login = "sqladminuser" oozie_database_administrator_login_password = "ThisIsNotVerySecure!" @@ -45,59 +45,112 @@ module "hdinsight_hbase" { tags = {} } -# Data dependencies +# Modules dependencies -data "azurerm_virtual_network" "vnet_default" { - name = local.vnet_name - resource_group_name = var.rg_name +module "local_rg" { + source = "../../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags +} + +module "local_vnet" { + source = "../../../virtual-network" + + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location + + address_space = ["10.0.0.0/16"] } -data "azurerm_subnet" "snet_default" { - name = local.snet_name - virtual_network_name = local.vnet_name - resource_group_name = var.rg_name +module "local_snet_default" { + source = "../../../subnet" + + rg_name = module.local_rg.name + name = "vnet-${random_string.postfix.result}-hbase-default" + vnet_name = module.local_vnet.name + address_prefixes = ["10.0.6.0/24"] } -# Module dependencies +# Storage Account module "local_storage_account" { - source = "../../../storage-account/test" - rg_name = var.rg_name - location = var.location - is_sec_module = false + source = "../../../storage-account" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location + + hns_enabled = true firewall_default_action = "Allow" + + is_sec_module = false } +# User managed identity + module "local_user_managed_identity" { - source = "../../../user-assigned-identity/test" - rg_name = var.rg_name + source = "../../../user-assigned-identity" + + basename = random_string.postfix.result + rg_name = module.local_rg.name location = var.location } -module "local_sql_server" { - source = "../../../sql-database-server/test" - rg_name = var.rg_name - location = var.location +# Metastores + +module "local_sql_database_server" { + source = "../../../sql-database-server" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location + + db_version = "12.0" + administrator_login = "sqladminuser" + administrator_login_password = "ThisIsNotVerySecure!" + is_sec_module = false } module "local_sql_database_ambari" { - source = "../../../sql-database/test" - rg_name = var.rg_name + source = "../../../sql-database" + + basename = "${random_string.postfix.result}ambari" + rg_name = module.local_rg.name location = var.location - server_name = module.local_sql_server.name + server_name = module.local_sql_database_server.name + + collation = "SQL_LATIN1_GENERAL_CP1_CI_AS" + edition = "Standard" + requested_service_objective_name = "S0" } module "local_sql_database_hive" { - source = "../../../sql-database/test" - rg_name = var.rg_name + source = "../../../sql-database" + + basename = "${random_string.postfix.result}hive" + rg_name = module.local_rg.name location = var.location - server_name = module.local_sql_server.name + server_name = module.local_sql_database_server.name + + collation = "SQL_LATIN1_GENERAL_CP1_CI_AS" + edition = "Standard" + requested_service_objective_name = "S0" } module "local_sql_database_oozie" { - source = "../../../sql-database/test" - rg_name = var.rg_name + source = "../../../sql-database" + + basename = "${random_string.postfix.result}oozie" + rg_name = module.local_rg.name location = var.location - server_name = module.local_sql_server.name + server_name = module.local_sql_database_server.name + + collation = "SQL_LATIN1_GENERAL_CP1_CI_AS" + edition = "Standard" + requested_service_objective_name = "S0" } \ No newline at end of file diff --git a/terraform/hdinsight/hdinsight-hbase/test/locals.tf b/terraform/hdinsight/hdinsight-hbase/test/locals.tf index 6682edf7..fd57670f 100644 --- a/terraform/hdinsight/hdinsight-hbase/test/locals.tf +++ b/terraform/hdinsight/hdinsight-hbase/test/locals.tf @@ -1,4 +1,7 @@ locals { - snet_name = "snet-adl-modules-test-default" - vnet_name = "vnet-adl-modules-test" + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "hdinsight-hbase" + Toolkit = "Terraform" + } } \ No newline at end of file diff --git a/terraform/hdinsight/hdinsight-hbase/test/main.tf b/terraform/hdinsight/hdinsight-hbase/test/providers.tf similarity index 88% rename from terraform/hdinsight/hdinsight-hbase/test/main.tf rename to terraform/hdinsight/hdinsight-hbase/test/providers.tf index 5bfdb8f6..ef016ef0 100644 --- a/terraform/hdinsight/hdinsight-hbase/test/main.tf +++ b/terraform/hdinsight/hdinsight-hbase/test/providers.tf @@ -1,20 +1,20 @@ -terraform { - backend "azurerm" { - resource_group_name = "rg-adl-terraform-state" - storage_account_name = "stadlterraformstate" - container_name = "default" - key = "hdinsighthbase.terraform.tfstate" - } - - required_providers { - azurerm = { - source = "hashicorp/azurerm" - version = "= 3.31.0" - } - } - -} - -provider "azurerm" { - features {} +terraform { + backend "azurerm" { + resource_group_name = "rg-adl-terraform-state" + storage_account_name = "stadlterraformstate" + container_name = "default" + key = "hdinsighthbase.terraform.tfstate" + } + + required_providers { + azurerm = { + source = "hashicorp/azurerm" + version = "= 3.32.0" + } + } + +} + +provider "azurerm" { + features {} } \ No newline at end of file diff --git a/terraform/hdinsight/hdinsight-interactive/test/hdinsight_interactive.tf b/terraform/hdinsight/hdinsight-interactive/test/hdinsight_interactive.tf index 3613c797..1cae6dd9 100644 --- a/terraform/hdinsight/hdinsight-interactive/test/hdinsight_interactive.tf +++ b/terraform/hdinsight/hdinsight-interactive/test/hdinsight_interactive.tf @@ -2,11 +2,11 @@ module "hdinsight_interactive" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location - subnet_id = data.azurerm_subnet.snet_default.id - virtual_network_id = data.azurerm_virtual_network.vnet_default.id + subnet_id = module.local_snet_default.id + virtual_network_id = module.local_vnet.id cluster_version = "4.0" component_version_interactive = "3.1" @@ -15,7 +15,7 @@ module "hdinsight_interactive" { gateway_password = "This1sNotVerySecure!" ssh_username = "sshuser" ssh_password = "This1sNotVerySecure!" - roles_head_node_vm_size = "D13" + roles_head_node_vm_size = "A5" roles_worker_node_vm_size = "A5" roles_worker_node_target_instance_count = 2 roles_zookeeper_node_vm_size = "Small" @@ -27,17 +27,17 @@ module "hdinsight_interactive" { managed_identity_resource_id = module.local_user_managed_identity.id managed_identity_principal_id = module.local_user_managed_identity.principal_id - ambari_server_name = module.local_sql_server.name + ambari_server_name = module.local_sql_database_server.name ambari_database_name = module.local_sql_database_ambari.name ambari_database_administrator_login = "sqladminuser" ambari_database_administrator_login_password = "ThisIsNotVerySecure!" - hive_server_name = module.local_sql_server.name + hive_server_name = module.local_sql_database_server.name hive_database_name = module.local_sql_database_hive.name hive_database_administrator_login = "sqladminuser" hive_database_administrator_login_password = "ThisIsNotVerySecure!" - oozie_server_name = module.local_sql_server.name + oozie_server_name = module.local_sql_database_server.name oozie_database_name = module.local_sql_database_oozie.name oozie_database_administrator_login = "sqladminuser" oozie_database_administrator_login_password = "ThisIsNotVerySecure!" @@ -45,59 +45,112 @@ module "hdinsight_interactive" { tags = {} } -# Data dependencies +# Modules dependencies -data "azurerm_virtual_network" "vnet_default" { - name = local.vnet_name - resource_group_name = var.rg_name +module "local_rg" { + source = "../../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags +} + +module "local_vnet" { + source = "../../../virtual-network" + + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location + + address_space = ["10.0.0.0/16"] } -data "azurerm_subnet" "snet_default" { - name = local.snet_name - virtual_network_name = local.vnet_name - resource_group_name = var.rg_name +module "local_snet_default" { + source = "../../../subnet" + + rg_name = module.local_rg.name + name = "vnet-${random_string.postfix.result}-interactive-default" + vnet_name = module.local_vnet.name + address_prefixes = ["10.0.6.0/24"] } -# Module dependencies +# Storage Account module "local_storage_account" { - source = "../../../storage-account/test" - rg_name = var.rg_name - location = var.location - is_sec_module = false + source = "../../../storage-account" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location + + hns_enabled = true firewall_default_action = "Allow" + + is_sec_module = false } +# User managed identity + module "local_user_managed_identity" { - source = "../../../user-assigned-identity/test" - rg_name = var.rg_name + source = "../../../user-assigned-identity" + + basename = random_string.postfix.result + rg_name = module.local_rg.name location = var.location } -module "local_sql_server" { - source = "../../../sql-database-server/test" - rg_name = var.rg_name - location = var.location +# Metastores + +module "local_sql_database_server" { + source = "../../../sql-database-server" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location + + db_version = "12.0" + administrator_login = "sqladminuser" + administrator_login_password = "ThisIsNotVerySecure!" + is_sec_module = false } module "local_sql_database_ambari" { - source = "../../../sql-database/test" - rg_name = var.rg_name + source = "../../../sql-database" + + basename = "${random_string.postfix.result}ambari" + rg_name = module.local_rg.name location = var.location - server_name = module.local_sql_server.name + server_name = module.local_sql_database_server.name + + collation = "SQL_LATIN1_GENERAL_CP1_CI_AS" + edition = "Standard" + requested_service_objective_name = "S0" } module "local_sql_database_hive" { - source = "../../../sql-database/test" - rg_name = var.rg_name + source = "../../../sql-database" + + basename = "${random_string.postfix.result}hive" + rg_name = module.local_rg.name location = var.location - server_name = module.local_sql_server.name + server_name = module.local_sql_database_server.name + + collation = "SQL_LATIN1_GENERAL_CP1_CI_AS" + edition = "Standard" + requested_service_objective_name = "S0" } module "local_sql_database_oozie" { - source = "../../../sql-database/test" - rg_name = var.rg_name + source = "../../../sql-database" + + basename = "${random_string.postfix.result}oozie" + rg_name = module.local_rg.name location = var.location - server_name = module.local_sql_server.name + server_name = module.local_sql_database_server.name + + collation = "SQL_LATIN1_GENERAL_CP1_CI_AS" + edition = "Standard" + requested_service_objective_name = "S0" } \ No newline at end of file diff --git a/terraform/hdinsight/hdinsight-interactive/test/locals.tf b/terraform/hdinsight/hdinsight-interactive/test/locals.tf index cb89cf14..088ac559 100644 --- a/terraform/hdinsight/hdinsight-interactive/test/locals.tf +++ b/terraform/hdinsight/hdinsight-interactive/test/locals.tf @@ -1,4 +1,7 @@ locals { - snet_name = "snet-adl-modules-test-default" - vnet_name = "vnet-adl-modules-test" + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "hdinsight-interactive" + Toolkit = "Terraform" + } } \ No newline at end of file diff --git a/terraform/hdinsight/hdinsight-interactive/test/main.tf b/terraform/hdinsight/hdinsight-interactive/test/providers.tf similarity index 93% rename from terraform/hdinsight/hdinsight-interactive/test/main.tf rename to terraform/hdinsight/hdinsight-interactive/test/providers.tf index b8968ef1..3c155bd8 100644 --- a/terraform/hdinsight/hdinsight-interactive/test/main.tf +++ b/terraform/hdinsight/hdinsight-interactive/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/hdinsight/hdinsight-kafka/test/hdinsight_kafka.tf b/terraform/hdinsight/hdinsight-kafka/test/hdinsight_kafka.tf index 1d542815..28cb3bc7 100644 --- a/terraform/hdinsight/hdinsight-kafka/test/hdinsight_kafka.tf +++ b/terraform/hdinsight/hdinsight-kafka/test/hdinsight_kafka.tf @@ -2,11 +2,11 @@ module "hdinsight_kafka" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location - subnet_id = data.azurerm_subnet.snet_default.id - virtual_network_id = data.azurerm_virtual_network.vnet_default.id + subnet_id = module.local_snet_default.id + virtual_network_id = module.local_vnet.id cluster_version = "4.0" component_version_kafka = "2.1" @@ -27,17 +27,17 @@ module "hdinsight_kafka" { managed_identity_resource_id = module.local_user_managed_identity.id managed_identity_principal_id = module.local_user_managed_identity.principal_id - ambari_server_name = module.local_sql_server.name + ambari_server_name = module.local_sql_database_server.name ambari_database_name = module.local_sql_database_ambari.name ambari_database_administrator_login = "sqladminuser" ambari_database_administrator_login_password = "ThisIsNotVerySecure!" - hive_server_name = module.local_sql_server.name + hive_server_name = module.local_sql_database_server.name hive_database_name = module.local_sql_database_hive.name hive_database_administrator_login = "sqladminuser" hive_database_administrator_login_password = "ThisIsNotVerySecure!" - oozie_server_name = module.local_sql_server.name + oozie_server_name = module.local_sql_database_server.name oozie_database_name = module.local_sql_database_oozie.name oozie_database_administrator_login = "sqladminuser" oozie_database_administrator_login_password = "ThisIsNotVerySecure!" @@ -45,59 +45,112 @@ module "hdinsight_kafka" { tags = {} } -# Data dependencies +# Modules dependencies -data "azurerm_virtual_network" "vnet_default" { - name = local.vnet_name - resource_group_name = var.rg_name +module "local_rg" { + source = "../../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags +} + +module "local_vnet" { + source = "../../../virtual-network" + + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location + + address_space = ["10.0.0.0/16"] } -data "azurerm_subnet" "snet_default" { - name = local.snet_name - virtual_network_name = local.vnet_name - resource_group_name = var.rg_name +module "local_snet_default" { + source = "../../../subnet" + + rg_name = module.local_rg.name + name = "vnet-${random_string.postfix.result}-kafka-default" + vnet_name = module.local_vnet.name + address_prefixes = ["10.0.6.0/24"] } -# Module dependencies +# Storage Account module "local_storage_account" { - source = "../../../storage-account/test" - rg_name = var.rg_name - location = var.location - is_sec_module = false + source = "../../../storage-account" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location + + hns_enabled = true firewall_default_action = "Allow" + + is_sec_module = false } +# User managed identity + module "local_user_managed_identity" { - source = "../../../user-assigned-identity/test" - rg_name = var.rg_name + source = "../../../user-assigned-identity" + + basename = random_string.postfix.result + rg_name = module.local_rg.name location = var.location } -module "local_sql_server" { - source = "../../../sql-database-server/test" - rg_name = var.rg_name - location = var.location +# Metastores + +module "local_sql_database_server" { + source = "../../../sql-database-server" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location + + db_version = "12.0" + administrator_login = "sqladminuser" + administrator_login_password = "ThisIsNotVerySecure!" + is_sec_module = false } module "local_sql_database_ambari" { - source = "../../../sql-database/test" - rg_name = var.rg_name + source = "../../../sql-database" + + basename = "${random_string.postfix.result}ambari" + rg_name = module.local_rg.name location = var.location - server_name = module.local_sql_server.name + server_name = module.local_sql_database_server.name + + collation = "SQL_LATIN1_GENERAL_CP1_CI_AS" + edition = "Standard" + requested_service_objective_name = "S0" } module "local_sql_database_hive" { - source = "../../../sql-database/test" - rg_name = var.rg_name + source = "../../../sql-database" + + basename = "${random_string.postfix.result}hive" + rg_name = module.local_rg.name location = var.location - server_name = module.local_sql_server.name + server_name = module.local_sql_database_server.name + + collation = "SQL_LATIN1_GENERAL_CP1_CI_AS" + edition = "Standard" + requested_service_objective_name = "S0" } module "local_sql_database_oozie" { - source = "../../../sql-database/test" - rg_name = var.rg_name + source = "../../../sql-database" + + basename = "${random_string.postfix.result}oozie" + rg_name = module.local_rg.name location = var.location - server_name = module.local_sql_server.name + server_name = module.local_sql_database_server.name + + collation = "SQL_LATIN1_GENERAL_CP1_CI_AS" + edition = "Standard" + requested_service_objective_name = "S0" } \ No newline at end of file diff --git a/terraform/hdinsight/hdinsight-kafka/test/locals.tf b/terraform/hdinsight/hdinsight-kafka/test/locals.tf index cb89cf14..87393126 100644 --- a/terraform/hdinsight/hdinsight-kafka/test/locals.tf +++ b/terraform/hdinsight/hdinsight-kafka/test/locals.tf @@ -1,4 +1,7 @@ locals { - snet_name = "snet-adl-modules-test-default" - vnet_name = "vnet-adl-modules-test" + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "hdinsight-kafka" + Toolkit = "Terraform" + } } \ No newline at end of file diff --git a/terraform/hdinsight/hdinsight-kafka/test/main.tf b/terraform/hdinsight/hdinsight-kafka/test/providers.tf similarity index 93% rename from terraform/hdinsight/hdinsight-kafka/test/main.tf rename to terraform/hdinsight/hdinsight-kafka/test/providers.tf index 51b839f6..f8f6a57e 100644 --- a/terraform/hdinsight/hdinsight-kafka/test/main.tf +++ b/terraform/hdinsight/hdinsight-kafka/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/hdinsight/hdinsight-spark/test/hdinsight_spark.tf b/terraform/hdinsight/hdinsight-spark/test/hdinsight_spark.tf index beb5fb83..03d34d4e 100644 --- a/terraform/hdinsight/hdinsight-spark/test/hdinsight_spark.tf +++ b/terraform/hdinsight/hdinsight-spark/test/hdinsight_spark.tf @@ -2,11 +2,11 @@ module "hdinsight_spark" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location - subnet_id = data.azurerm_subnet.snet_default.id - virtual_network_id = data.azurerm_virtual_network.vnet_default.id + subnet_id = module.local_snet_default.id + virtual_network_id = module.local_vnet.id cluster_version = "4.0" component_version_spark = "2.4" @@ -27,17 +27,17 @@ module "hdinsight_spark" { managed_identity_resource_id = module.local_user_managed_identity.id managed_identity_principal_id = module.local_user_managed_identity.principal_id - ambari_server_name = module.local_sql_server.name + ambari_server_name = module.local_sql_database_server.name ambari_database_name = module.local_sql_database_ambari.name ambari_database_administrator_login = "sqladminuser" ambari_database_administrator_login_password = "ThisIsNotVerySecure!" - hive_server_name = module.local_sql_server.name + hive_server_name = module.local_sql_database_server.name hive_database_name = module.local_sql_database_hive.name hive_database_administrator_login = "sqladminuser" hive_database_administrator_login_password = "ThisIsNotVerySecure!" - oozie_server_name = module.local_sql_server.name + oozie_server_name = module.local_sql_database_server.name oozie_database_name = module.local_sql_database_oozie.name oozie_database_administrator_login = "sqladminuser" oozie_database_administrator_login_password = "ThisIsNotVerySecure!" @@ -45,59 +45,112 @@ module "hdinsight_spark" { tags = {} } -# Data dependencies +# Modules dependencies -data "azurerm_virtual_network" "vnet_default" { - name = local.vnet_name - resource_group_name = var.rg_name +module "local_rg" { + source = "../../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags +} + +module "local_vnet" { + source = "../../../virtual-network" + + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location + + address_space = ["10.0.0.0/16"] } -data "azurerm_subnet" "snet_default" { - name = local.snet_name - virtual_network_name = local.vnet_name - resource_group_name = var.rg_name +module "local_snet_default" { + source = "../../../subnet" + + rg_name = module.local_rg.name + name = "vnet-${random_string.postfix.result}-kafka-default" + vnet_name = module.local_vnet.name + address_prefixes = ["10.0.6.0/24"] } -# Module dependencies +# Storage Account module "local_storage_account" { - source = "../../../storage-account/test" - rg_name = var.rg_name - location = var.location - is_sec_module = false + source = "../../../storage-account" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location + + hns_enabled = true firewall_default_action = "Allow" + + is_sec_module = false } +# User managed identity + module "local_user_managed_identity" { - source = "../../../user-assigned-identity/test" - rg_name = var.rg_name + source = "../../../user-assigned-identity" + + basename = random_string.postfix.result + rg_name = module.local_rg.name location = var.location } -module "local_sql_server" { - source = "../../../sql-database-server/test" - rg_name = var.rg_name - location = var.location +# Metastores + +module "local_sql_database_server" { + source = "../../../sql-database-server" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location + + db_version = "12.0" + administrator_login = "sqladminuser" + administrator_login_password = "ThisIsNotVerySecure!" + is_sec_module = false } module "local_sql_database_ambari" { - source = "../../../sql-database/test" - rg_name = var.rg_name + source = "../../../sql-database" + + basename = "${random_string.postfix.result}ambari" + rg_name = module.local_rg.name location = var.location - server_name = module.local_sql_server.name + server_name = module.local_sql_database_server.name + + collation = "SQL_LATIN1_GENERAL_CP1_CI_AS" + edition = "Standard" + requested_service_objective_name = "S0" } module "local_sql_database_hive" { - source = "../../../sql-database/test" - rg_name = var.rg_name + source = "../../../sql-database" + + basename = "${random_string.postfix.result}hive" + rg_name = module.local_rg.name location = var.location - server_name = module.local_sql_server.name + server_name = module.local_sql_database_server.name + + collation = "SQL_LATIN1_GENERAL_CP1_CI_AS" + edition = "Standard" + requested_service_objective_name = "S0" } module "local_sql_database_oozie" { - source = "../../../sql-database/test" - rg_name = var.rg_name + source = "../../../sql-database" + + basename = "${random_string.postfix.result}oozie" + rg_name = module.local_rg.name location = var.location - server_name = module.local_sql_server.name + server_name = module.local_sql_database_server.name + + collation = "SQL_LATIN1_GENERAL_CP1_CI_AS" + edition = "Standard" + requested_service_objective_name = "S0" } \ No newline at end of file diff --git a/terraform/hdinsight/hdinsight-spark/test/locals.tf b/terraform/hdinsight/hdinsight-spark/test/locals.tf index cb89cf14..03e0d125 100644 --- a/terraform/hdinsight/hdinsight-spark/test/locals.tf +++ b/terraform/hdinsight/hdinsight-spark/test/locals.tf @@ -1,4 +1,7 @@ locals { - snet_name = "snet-adl-modules-test-default" - vnet_name = "vnet-adl-modules-test" + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "hdinsight-spark" + Toolkit = "Terraform" + } } \ No newline at end of file diff --git a/terraform/hdinsight/hdinsight-spark/test/main.tf b/terraform/hdinsight/hdinsight-spark/test/providers.tf similarity index 93% rename from terraform/hdinsight/hdinsight-spark/test/main.tf rename to terraform/hdinsight/hdinsight-spark/test/providers.tf index b3b646fd..81dd4d1d 100644 --- a/terraform/hdinsight/hdinsight-spark/test/main.tf +++ b/terraform/hdinsight/hdinsight-spark/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/key-vault/test/key_vault.tf b/terraform/key-vault/test/key_vault.tf index d50a5f38..ca7e078d 100644 --- a/terraform/key-vault/test/key_vault.tf +++ b/terraform/key-vault/test/key_vault.tf @@ -2,25 +2,53 @@ module "key_vault" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location - subnet_id = data.azurerm_subnet.snet_default.id - private_dns_zone_ids = [data.azurerm_private_dns_zone.kv_vault.id] - sku_name = var.sku_name + subnet_id = module.local_snet_default.id + private_dns_zone_ids = [module.local_pdnsz_kv.list[local.dns_kv_vault].id] + + sku_name = var.sku_name tags = {} } -# Data dependencies +# Modules dependencies + +module "local_rg" { + source = "../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags +} + +module "local_vnet" { + source = "../../virtual-network" -data "azurerm_subnet" "snet_default" { - name = local.snet_name - virtual_network_name = local.vnet_name - resource_group_name = var.rg_name + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location + + address_space = ["10.0.0.0/16"] +} + +module "local_snet_default" { + source = "../../subnet" + + rg_name = module.local_rg.name + name = "vnet-${random_string.postfix.result}-kv-default" + vnet_name = module.local_vnet.name + address_prefixes = ["10.0.6.0/24"] } -data "azurerm_private_dns_zone" "kv_vault" { - name = local.dns_kv_vault - resource_group_name = var.rg_name_dns +# DNS zones + +module "local_pdnsz_kv" { + source = "../../private-dns-zone" + + rg_name = module.local_rg.name + dns_zones = [local.dns_kv_vault] + vnet_id = module.local_vnet.id } \ No newline at end of file diff --git a/terraform/key-vault/test/locals.tf b/terraform/key-vault/test/locals.tf index 130235aa..7cae9884 100644 --- a/terraform/key-vault/test/locals.tf +++ b/terraform/key-vault/test/locals.tf @@ -1,5 +1,9 @@ locals { - snet_name = "snet-adl-modules-test-default" - vnet_name = "vnet-adl-modules-test" + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "key-vault" + Toolkit = "Terraform" + } + dns_kv_vault = "privatelink.vaultcore.azure.net" } \ No newline at end of file diff --git a/terraform/key-vault/test/main.tf b/terraform/key-vault/test/providers.tf similarity index 92% rename from terraform/key-vault/test/main.tf rename to terraform/key-vault/test/providers.tf index e08a619f..cf1557df 100644 --- a/terraform/key-vault/test/main.tf +++ b/terraform/key-vault/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/key-vault/test/variables.tf b/terraform/key-vault/test/variables.tf index 437e32c5..80fa87a7 100644 --- a/terraform/key-vault/test/variables.tf +++ b/terraform/key-vault/test/variables.tf @@ -9,16 +9,6 @@ variable "location" { default = "North Europe" } -variable "rg_name" { - type = string - default = "rg-adl-modules-test-01" -} - -variable "rg_name_dns" { - type = string - default = "rg-adl-modules-test-01-global-dns" -} - variable "sku_name" { type = string default = "standard" diff --git a/terraform/key-vault/variables.tf b/terraform/key-vault/variables.tf index 5b4ed85f..6369df8c 100644 --- a/terraform/key-vault/variables.tf +++ b/terraform/key-vault/variables.tf @@ -28,11 +28,13 @@ variable "is_sec_module" { variable "subnet_id" { type = string description = "The ID of the subnet from which private IP addresses will be allocated for this Private Endpoint" + default = "" } variable "private_dns_zone_ids" { type = list(string) description = "Specifies the list of Private DNS Zones to include" + default = [] } variable "sku_name" { diff --git a/terraform/log-analytics/log-analytics-workspace/test/locals.tf b/terraform/log-analytics/log-analytics-workspace/test/locals.tf index 644fba04..29396df2 100644 --- a/terraform/log-analytics/log-analytics-workspace/test/locals.tf +++ b/terraform/log-analytics/log-analytics-workspace/test/locals.tf @@ -1,2 +1,7 @@ locals { + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "log-analytics-workspace" + Toolkit = "Terraform" + } } \ No newline at end of file diff --git a/terraform/log-analytics/log-analytics-workspace/test/log_analytics_workspace.tf b/terraform/log-analytics/log-analytics-workspace/test/log_analytics_workspace.tf index 6fa16b1f..e70677ba 100644 --- a/terraform/log-analytics/log-analytics-workspace/test/log_analytics_workspace.tf +++ b/terraform/log-analytics/log-analytics-workspace/test/log_analytics_workspace.tf @@ -2,8 +2,19 @@ module "log_analytics_workspace" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location tags = {} +} + +# Modules dependencies + +module "local_rg" { + source = "../../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags } \ No newline at end of file diff --git a/terraform/log-analytics/log-analytics-workspace/test/main.tf b/terraform/log-analytics/log-analytics-workspace/test/providers.tf similarity index 93% rename from terraform/log-analytics/log-analytics-workspace/test/main.tf rename to terraform/log-analytics/log-analytics-workspace/test/providers.tf index 6034f680..c31d29bc 100644 --- a/terraform/log-analytics/log-analytics-workspace/test/main.tf +++ b/terraform/log-analytics/log-analytics-workspace/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/log-analytics/log-analytics-workspace/test/variables.tf b/terraform/log-analytics/log-analytics-workspace/test/variables.tf index edf7f3e0..b025435b 100644 --- a/terraform/log-analytics/log-analytics-workspace/test/variables.tf +++ b/terraform/log-analytics/log-analytics-workspace/test/variables.tf @@ -7,9 +7,4 @@ resource "random_string" "postfix" { variable "location" { type = string default = "North Europe" -} - -variable "rg_name" { - type = string - default = "rg-adl-modules-test-01" } \ No newline at end of file diff --git a/terraform/machine-learning/machine-learning-compute-cluster/outputs.tf b/terraform/machine-learning/machine-learning-compute-cluster/outputs.tf index 36d375f5..65d951ab 100644 --- a/terraform/machine-learning/machine-learning-compute-cluster/outputs.tf +++ b/terraform/machine-learning/machine-learning-compute-cluster/outputs.tf @@ -1,7 +1,13 @@ output "id" { - value = azurerm_machine_learning_compute_cluster.adl_mlw_compute_cluster[0].id + value = ( + length(azurerm_machine_learning_compute_cluster.adl_mlw_compute_cluster) > 0 ? + azurerm_machine_learning_compute_cluster.adl_mlw_compute_cluster[0].id : "" + ) } output "name" { - value = azurerm_machine_learning_compute_cluster.adl_mlw_compute_cluster[0].name + value = ( + length(azurerm_machine_learning_compute_cluster.adl_mlw_compute_cluster) > 0 ? + azurerm_machine_learning_compute_cluster.adl_mlw_compute_cluster[0].name : "" + ) } \ No newline at end of file diff --git a/terraform/machine-learning/machine-learning-compute-cluster/test/locals.tf b/terraform/machine-learning/machine-learning-compute-cluster/test/locals.tf index 52da57ab..572819bd 100644 --- a/terraform/machine-learning/machine-learning-compute-cluster/test/locals.tf +++ b/terraform/machine-learning/machine-learning-compute-cluster/test/locals.tf @@ -1,5 +1,7 @@ locals { - snet_name = "snet-adl-modules-test-compute" - vnet_name = "vnet-adl-modules-test" - mlw_name = "mlw-adl-modules-test" + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "machine-learning-compute-cluster" + Toolkit = "Terraform" + } } \ No newline at end of file diff --git a/terraform/machine-learning/machine-learning-compute-cluster/test/machine_learning_compute_cluster.tf b/terraform/machine-learning/machine-learning-compute-cluster/test/machine_learning_compute_cluster.tf index b03c4935..58a26ee7 100644 --- a/terraform/machine-learning/machine-learning-compute-cluster/test/machine_learning_compute_cluster.tf +++ b/terraform/machine-learning/machine-learning-compute-cluster/test/machine_learning_compute_cluster.tf @@ -1,25 +1,105 @@ module "machine_learning_compute_cluster" { source = "../" + basename = random_string.postfix.result location = var.location - subnet_id = data.azurerm_subnet.snet_compute.id - machine_learning_workspace_id = data.azurerm_machine_learning_workspace.mlw_default.id + subnet_id = module.local_snet_default.id + machine_learning_workspace_id = module.local_mlw.id +} + +# Modules dependencies + +module "local_rg" { + source = "../../../resource-group" + + basename = random_string.postfix.result + location = var.location - module_enabled = true + tags = local.tags } -# Data dependencies +module "local_mlw" { + source = "../../machine-learning-workspace" -data "azurerm_subnet" "snet_compute" { - name = local.snet_name - virtual_network_name = local.vnet_name - resource_group_name = var.rg_name + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location + + storage_account_id = module.local_storage_account.id + key_vault_id = module.local_key_vault.id + application_insights_id = module.local_application_insights.id + container_registry_id = module.local_container_registry.id + + is_sec_module = false } -data "azurerm_machine_learning_workspace" "mlw_default" { - name = local.mlw_name - resource_group_name = var.rg_name +# Network Configuration + +module "local_vnet" { + source = "../../../virtual-network" + + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location + + address_space = ["10.0.0.0/16"] +} + +module "local_snet_default" { + source = "../../../subnet" + + rg_name = module.local_rg.name + name = "vnet-${random_string.postfix.result}-mlw-default" + vnet_name = module.local_vnet.name + address_prefixes = ["10.0.6.0/24"] } -# Module dependencies \ No newline at end of file +# Storage Account + +module "local_storage_account" { + source = "../../../storage-account" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location + + hns_enabled = false + firewall_default_action = "Allow" + + is_sec_module = false +} + +# Key Vault + +module "local_key_vault" { + source = "../../../key-vault" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location + + is_sec_module = false +} + +# Application Insights + +module "local_application_insights" { + source = "../../../application-insights" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location +} + +# Container registry + +module "local_container_registry" { + source = "../../../container-registry" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location + + is_sec_module = false +} \ No newline at end of file diff --git a/terraform/machine-learning/machine-learning-compute-cluster/test/main.tf b/terraform/machine-learning/machine-learning-compute-cluster/test/providers.tf similarity index 93% rename from terraform/machine-learning/machine-learning-compute-cluster/test/main.tf rename to terraform/machine-learning/machine-learning-compute-cluster/test/providers.tf index 2f1ff650..b82c5228 100644 --- a/terraform/machine-learning/machine-learning-compute-cluster/test/main.tf +++ b/terraform/machine-learning/machine-learning-compute-cluster/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/machine-learning/machine-learning-compute-instance/outputs.tf b/terraform/machine-learning/machine-learning-compute-instance/outputs.tf index 39c67e1e..b9f7238d 100644 --- a/terraform/machine-learning/machine-learning-compute-instance/outputs.tf +++ b/terraform/machine-learning/machine-learning-compute-instance/outputs.tf @@ -1,3 +1,6 @@ output "id" { - value = azurerm_machine_learning_compute_instance.adl_mlw_compute_instance[0].id + value = ( + length(azurerm_machine_learning_compute_instance.adl_mlw_compute_instance) > 0 ? + azurerm_machine_learning_compute_instance.adl_mlw_compute_instance[0].id : "" + ) } \ No newline at end of file diff --git a/terraform/machine-learning/machine-learning-compute-instance/test/locals.tf b/terraform/machine-learning/machine-learning-compute-instance/test/locals.tf index 52da57ab..da262285 100644 --- a/terraform/machine-learning/machine-learning-compute-instance/test/locals.tf +++ b/terraform/machine-learning/machine-learning-compute-instance/test/locals.tf @@ -1,5 +1,7 @@ locals { - snet_name = "snet-adl-modules-test-compute" - vnet_name = "vnet-adl-modules-test" - mlw_name = "mlw-adl-modules-test" + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "mahcine-learning-compute-instance" + Toolkit = "Terraform" + } } \ No newline at end of file diff --git a/terraform/machine-learning/machine-learning-compute-instance/test/machine_learning_compute_instance.tf b/terraform/machine-learning/machine-learning-compute-instance/test/machine_learning_compute_instance.tf index 5d29e0e4..23a91e33 100644 --- a/terraform/machine-learning/machine-learning-compute-instance/test/machine_learning_compute_instance.tf +++ b/terraform/machine-learning/machine-learning-compute-instance/test/machine_learning_compute_instance.tf @@ -4,23 +4,102 @@ module "machine_learning_compute_instance" { basename = random_string.postfix.result location = var.location - subnet_id = data.azurerm_subnet.snet_compute.id - machine_learning_workspace_id = data.azurerm_machine_learning_workspace.mlw_default.id + subnet_id = module.local_snet_default.id + machine_learning_workspace_id = module.local_mlw.id +} + +# Modules dependencies + +module "local_rg" { + source = "../../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags +} + +module "local_mlw" { + source = "../../machine-learning-workspace" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location + + storage_account_id = module.local_storage_account.id + key_vault_id = module.local_key_vault.id + application_insights_id = module.local_application_insights.id + container_registry_id = module.local_container_registry.id + + is_sec_module = false +} + +# Network Configuration + +module "local_vnet" { + source = "../../../virtual-network" + + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location + + address_space = ["10.0.0.0/16"] +} - module_enabled = true +module "local_snet_default" { + source = "../../../subnet" + + rg_name = module.local_rg.name + name = "vnet-${random_string.postfix.result}-mlw-default" + vnet_name = module.local_vnet.name + address_prefixes = ["10.0.6.0/24"] } -# Data dependencies +# Storage Account + +module "local_storage_account" { + source = "../../../storage-account" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location + + hns_enabled = false + firewall_default_action = "Allow" + + is_sec_module = false +} + +# Key Vault + +module "local_key_vault" { + source = "../../../key-vault" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location -data "azurerm_subnet" "snet_compute" { - name = local.snet_name - virtual_network_name = local.vnet_name - resource_group_name = var.rg_name + is_sec_module = false } -data "azurerm_machine_learning_workspace" "mlw_default" { - name = local.mlw_name - resource_group_name = var.rg_name +# Application Insights + +module "local_application_insights" { + source = "../../../application-insights" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location } -# Module dependencies \ No newline at end of file +# Container registry + +module "local_container_registry" { + source = "../../../container-registry" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location + + is_sec_module = false +} \ No newline at end of file diff --git a/terraform/machine-learning/machine-learning-compute-instance/test/main.tf b/terraform/machine-learning/machine-learning-compute-instance/test/providers.tf similarity index 93% rename from terraform/machine-learning/machine-learning-compute-instance/test/main.tf rename to terraform/machine-learning/machine-learning-compute-instance/test/providers.tf index a0ce571c..f1f54d4c 100644 --- a/terraform/machine-learning/machine-learning-compute-instance/test/main.tf +++ b/terraform/machine-learning/machine-learning-compute-instance/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/machine-learning/machine-learning-compute-instance/variables.tf b/terraform/machine-learning/machine-learning-compute-instance/variables.tf index e14f74b6..f50e6319 100644 --- a/terraform/machine-learning/machine-learning-compute-instance/variables.tf +++ b/terraform/machine-learning/machine-learning-compute-instance/variables.tf @@ -38,5 +38,5 @@ variable "authorization_type" { variable "module_enabled" { description = "Variable to enable or disable AML compute instance" - default = false + default = true } \ No newline at end of file diff --git a/terraform/machine-learning/machine-learning-inference-cluster/test/locals.tf b/terraform/machine-learning/machine-learning-inference-cluster/test/locals.tf index e94662fe..8d817c14 100644 --- a/terraform/machine-learning/machine-learning-inference-cluster/test/locals.tf +++ b/terraform/machine-learning/machine-learning-inference-cluster/test/locals.tf @@ -1,5 +1,7 @@ locals { - snet_name = "snet-adl-modules-test-aks" - vnet_name = "vnet-adl-modules-test" - mlw_name = "mlw-adl-modules-test" + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "machine-learning-inference-cluster" + Toolkit = "Terraform" + } } \ No newline at end of file diff --git a/terraform/machine-learning/machine-learning-inference-cluster/test/machine_learning_inference_cluster.tf b/terraform/machine-learning/machine-learning-inference-cluster/test/machine_learning_inference_cluster.tf index dc230fad..ab2e80f9 100644 --- a/terraform/machine-learning/machine-learning-inference-cluster/test/machine_learning_inference_cluster.tf +++ b/terraform/machine-learning/machine-learning-inference-cluster/test/machine_learning_inference_cluster.tf @@ -4,53 +4,98 @@ module "machine_learning_inference_cluster" { basename = random_string.postfix.result location = var.location - machine_learning_workspace_id = data.azurerm_machine_learning_workspace.mlw_default.id + machine_learning_workspace_id = module.local_mlw.id kubernetes_cluster_id = module.local_aks.id - - module_enabled = true } -# Data dependencies +# Modules dependencies + +module "local_rg" { + source = "../../../resource-group" + + basename = random_string.postfix.result + location = var.location -data "azurerm_subnet" "snet_aks" { - name = local.snet_name - virtual_network_name = local.vnet_name - resource_group_name = var.rg_name + tags = local.tags } -data "azurerm_machine_learning_workspace" "mlw_default" { - name = local.mlw_name - resource_group_name = var.rg_name +module "local_mlw" { + source = "../../machine-learning-workspace" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location + + storage_account_id = module.local_storage_account.id + key_vault_id = module.local_key_vault.id + application_insights_id = module.local_application_insights.id + container_registry_id = module.local_container_registry.id + + is_sec_module = false } -# Module dependencies +# AKS Cluster module "local_aks" { - source = "../../../aks-cluster/test" + source = "../../../aks-cluster" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location + dns_prefix = "azdatalbsaks" + + default_node_pool = { + name = "default" + node_count = 3 + vm_size = "Standard_D2_v2" + } +} + +# Storage Account + +module "local_storage_account" { + source = "../../../storage-account" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location + + hns_enabled = false + firewall_default_action = "Allow" + + is_sec_module = false +} + +# Key Vault + +module "local_key_vault" { + source = "../../../key-vault" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location + + is_sec_module = false } -# resource "azurerm_kubernetes_cluster" "adl_aks" { -# name = "aks-adl-modules-test" -# location = var.location -# resource_group_name = var.rg_name -# #dns_prefix_private_cluster = "adlaks1" -# dns_prefix = "adlaks1" - -# default_node_pool { -# name = "default" -# node_count = 3 -# vm_size = "Standard_D3_v2" -# vnet_subnet_id = data.azurerm_subnet.snet_aks.id -# } - -# identity { -# type = "SystemAssigned" -# } - -# # network_profile { -# # network_plugin = "azure" -# # dns_service_ip = "10.0.3.10" -# # service_cidr = "10.0.3.0/24" -# # docker_bridge_cidr = "172.17.0.1/16" -# # } -# } \ No newline at end of file +# Application Insights + +module "local_application_insights" { + source = "../../../application-insights" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location +} + +# Container registry + +module "local_container_registry" { + source = "../../../container-registry" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location + + is_sec_module = false +} \ No newline at end of file diff --git a/terraform/machine-learning/machine-learning-inference-cluster/test/main.tf b/terraform/machine-learning/machine-learning-inference-cluster/test/providers.tf similarity index 93% rename from terraform/machine-learning/machine-learning-inference-cluster/test/main.tf rename to terraform/machine-learning/machine-learning-inference-cluster/test/providers.tf index 748fdd72..0cddbdb3 100644 --- a/terraform/machine-learning/machine-learning-inference-cluster/test/main.tf +++ b/terraform/machine-learning/machine-learning-inference-cluster/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/machine-learning/machine-learning-inference-cluster/variables.tf b/terraform/machine-learning/machine-learning-inference-cluster/variables.tf index 6f36519b..780823a2 100644 --- a/terraform/machine-learning/machine-learning-inference-cluster/variables.tf +++ b/terraform/machine-learning/machine-learning-inference-cluster/variables.tf @@ -32,5 +32,5 @@ variable "cluster_purpose" { variable "module_enabled" { description = "Variable to enable or disable AML synapse spark" - default = false + default = true } \ No newline at end of file diff --git a/terraform/machine-learning/machine-learning-synapse-spark/test/locals.tf b/terraform/machine-learning/machine-learning-synapse-spark/test/locals.tf index 52da57ab..f3700e5b 100644 --- a/terraform/machine-learning/machine-learning-synapse-spark/test/locals.tf +++ b/terraform/machine-learning/machine-learning-synapse-spark/test/locals.tf @@ -1,5 +1,7 @@ locals { - snet_name = "snet-adl-modules-test-compute" - vnet_name = "vnet-adl-modules-test" - mlw_name = "mlw-adl-modules-test" + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "machine-learning-synapse-spark" + Toolkit = "Terraform" + } } \ No newline at end of file diff --git a/terraform/machine-learning/machine-learning-synapse-spark/test/machine_learning_synapse_spark.tf b/terraform/machine-learning/machine-learning-synapse-spark/test/machine_learning_synapse_spark.tf index 79ee1bbd..ea737366 100644 --- a/terraform/machine-learning/machine-learning-synapse-spark/test/machine_learning_synapse_spark.tf +++ b/terraform/machine-learning/machine-learning-synapse-spark/test/machine_learning_synapse_spark.tf @@ -4,21 +4,125 @@ module "machine_learning_synapse_spark" { basename = random_string.postfix.result location = var.location - machine_learning_workspace_id = data.azurerm_machine_learning_workspace.mlw_default.id + machine_learning_workspace_id = module.local_mlw.id synapse_spark_pool_id = module.local_synapse_spark_pool.id +} + +# Modules dependencies + +module "local_rg" { + source = "../../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags +} + +module "local_mlw" { + source = "../../machine-learning-workspace" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location + + storage_account_id = module.local_storage_account.id + key_vault_id = module.local_key_vault.id + application_insights_id = module.local_application_insights.id + container_registry_id = module.local_container_registry.id + + is_sec_module = false +} + +# Storage Account + +module "local_storage_account" { + source = "../../../storage-account" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location + + hns_enabled = false + firewall_default_action = "Allow" + + is_sec_module = false +} + +# Key Vault + +module "local_key_vault" { + source = "../../../key-vault" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location - module_enabled = true + is_sec_module = false } -# Data dependencies +# Application Insights -data "azurerm_machine_learning_workspace" "mlw_default" { - name = local.mlw_name - resource_group_name = var.rg_name +module "local_application_insights" { + source = "../../../application-insights" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location +} + +# Container registry + +module "local_container_registry" { + source = "../../../container-registry" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location + + is_sec_module = false } -# Module dependencies +# Synapse workspace + +module "local_synapse_workspace" { + source = "../../../synapse/synapse-workspace" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location + + adls_id = module.local_storage_account_syn.adls_id + storage_account_id = module.local_storage_account_syn.id + storage_account_name = module.local_storage_account_syn.name + + synadmin_username = var.synadmin_username + synadmin_password = var.synadmin_password + + set_aad_login = false + is_sec_module = false + + tags = {} +} module "local_synapse_spark_pool" { - source = "../../../synapse/synapse-spark-pool/test" + source = "../../../synapse/synapse-spark-pool" + + basename = random_string.postfix.result + synapse_workspace_id = module.local_synapse_workspace.id +} + +# Storage Account + +module "local_storage_account_syn" { + source = "../../../storage-account" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location + + hns_enabled = true + firewall_default_action = "Allow" + + is_sec_module = false } \ No newline at end of file diff --git a/terraform/machine-learning/machine-learning-synapse-spark/test/main.tf b/terraform/machine-learning/machine-learning-synapse-spark/test/providers.tf similarity index 93% rename from terraform/machine-learning/machine-learning-synapse-spark/test/main.tf rename to terraform/machine-learning/machine-learning-synapse-spark/test/providers.tf index 3adf6726..fbfebd72 100644 --- a/terraform/machine-learning/machine-learning-synapse-spark/test/main.tf +++ b/terraform/machine-learning/machine-learning-synapse-spark/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/machine-learning/machine-learning-synapse-spark/test/variables.tf b/terraform/machine-learning/machine-learning-synapse-spark/test/variables.tf index edf7f3e0..7763c9b4 100644 --- a/terraform/machine-learning/machine-learning-synapse-spark/test/variables.tf +++ b/terraform/machine-learning/machine-learning-synapse-spark/test/variables.tf @@ -9,7 +9,12 @@ variable "location" { default = "North Europe" } -variable "rg_name" { +variable "synadmin_username" { type = string - default = "rg-adl-modules-test-01" + default = "sqladminuser" +} + +variable "synadmin_password" { + type = string + default = "ThisIsNotVerySecure!" } \ No newline at end of file diff --git a/terraform/machine-learning/machine-learning-synapse-spark/variables.tf b/terraform/machine-learning/machine-learning-synapse-spark/variables.tf index 1aef9e74..bf4f5f76 100644 --- a/terraform/machine-learning/machine-learning-synapse-spark/variables.tf +++ b/terraform/machine-learning/machine-learning-synapse-spark/variables.tf @@ -26,5 +26,5 @@ variable "synapse_spark_pool_id" { variable "module_enabled" { description = "Variable to enable or disable AML synapse spark" - default = false + default = true } \ No newline at end of file diff --git a/terraform/machine-learning/machine-learning-workspace/test/locals.tf b/terraform/machine-learning/machine-learning-workspace/test/locals.tf index dd170ab7..fa43725b 100644 --- a/terraform/machine-learning/machine-learning-workspace/test/locals.tf +++ b/terraform/machine-learning/machine-learning-workspace/test/locals.tf @@ -1,6 +1,10 @@ locals { - snet_name = "snet-adl-modules-test-default" - vnet_name = "vnet-adl-modules-test" + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "machine-learning-workspace" + Toolkit = "Terraform" + } + dns_mlw_api = "privatelink.api.azureml.ms" dns_mlw_notebooks = "privatelink.notebooks.azure.net" } \ No newline at end of file diff --git a/terraform/machine-learning/machine-learning-workspace/test/machine_learning_workspace.tf b/terraform/machine-learning/machine-learning-workspace/test/machine_learning_workspace.tf index c7f94f18..ecce5426 100644 --- a/terraform/machine-learning/machine-learning-workspace/test/machine_learning_workspace.tf +++ b/terraform/machine-learning/machine-learning-workspace/test/machine_learning_workspace.tf @@ -2,55 +2,74 @@ module "machine_learning_workspace" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location - subnet_id = data.azurerm_subnet.snet_default.id - private_dns_zone_ids = [ - data.azurerm_private_dns_zone.mlw_api.id, - data.azurerm_private_dns_zone.mlw_notebooks.id - ] - storage_account_id = module.local_storage_account.id key_vault_id = module.local_key_vault.id application_insights_id = module.local_application_insights.id container_registry_id = module.local_container_registry.id - tags = {} + is_sec_module = false + tags = {} } -# Data dependencies +# Modules dependencies -data "azurerm_subnet" "snet_default" { - name = local.snet_name - virtual_network_name = local.vnet_name - resource_group_name = var.rg_name -} +module "local_rg" { + source = "../../../resource-group" -data "azurerm_private_dns_zone" "mlw_api" { - name = local.dns_mlw_api - resource_group_name = var.rg_name_dns -} + basename = random_string.postfix.result + location = var.location -data "azurerm_private_dns_zone" "mlw_notebooks" { - name = local.dns_mlw_notebooks - resource_group_name = var.rg_name_dns + tags = local.tags } -# Module dependencies +# Storage Account module "local_storage_account" { - source = "../../../storage-account/test" + source = "../../../storage-account" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location + + hns_enabled = false + firewall_default_action = "Allow" + + is_sec_module = false } +# Key Vault + module "local_key_vault" { - source = "../../../key-vault/test" + source = "../../../key-vault" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location + + is_sec_module = false } +# Application Insights + module "local_application_insights" { - source = "../../../application-insights/test" + source = "../../../application-insights" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location } +# Container registry + module "local_container_registry" { - source = "../../../container-registry/test" + source = "../../../container-registry" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location + + is_sec_module = false } \ No newline at end of file diff --git a/terraform/machine-learning/machine-learning-workspace/test/main.tf b/terraform/machine-learning/machine-learning-workspace/test/providers.tf similarity index 93% rename from terraform/machine-learning/machine-learning-workspace/test/main.tf rename to terraform/machine-learning/machine-learning-workspace/test/providers.tf index 885d47bc..87e98589 100644 --- a/terraform/machine-learning/machine-learning-workspace/test/main.tf +++ b/terraform/machine-learning/machine-learning-workspace/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/machine-learning/machine-learning-workspace/variables.tf b/terraform/machine-learning/machine-learning-workspace/variables.tf index 0a96ede9..6df0bce6 100644 --- a/terraform/machine-learning/machine-learning-workspace/variables.tf +++ b/terraform/machine-learning/machine-learning-workspace/variables.tf @@ -28,6 +28,7 @@ variable "is_sec_module" { variable "subnet_id" { type = string description = "The ID of the subnet from which private IP addresses will be allocated for this Private Endpoint" + default = "" } variable "public_network_access_enabled" { @@ -59,6 +60,7 @@ variable "container_registry_id" { variable "private_dns_zone_ids" { type = list(string) description = "Specifies the list of Private DNS Zones to include" + default = [] } variable "image_build_compute_name" { diff --git a/terraform/mariadb-database/test/locals.tf b/terraform/mariadb-database/test/locals.tf index ee24cab1..af86a1c1 100644 --- a/terraform/mariadb-database/test/locals.tf +++ b/terraform/mariadb-database/test/locals.tf @@ -1,5 +1,9 @@ locals { - snet_name = "snet-adl-modules-test-default" - vnet_name = "vnet-adl-modules-test" + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "mariadb-database" + Toolkit = "Terraform" + } + dns_mariadb_server = "privatelink.mariadb.database.azure.com" } \ No newline at end of file diff --git a/terraform/mariadb-database/test/mariadb_database.tf b/terraform/mariadb-database/test/mariadb_database.tf index 063b9991..e0060f4a 100644 --- a/terraform/mariadb-database/test/mariadb_database.tf +++ b/terraform/mariadb-database/test/mariadb_database.tf @@ -2,25 +2,51 @@ module "mariadb_database" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location - subnet_id = data.azurerm_subnet.snet_default.id - private_dns_zone_ids = [data.azurerm_private_dns_zone.mariadb_server.id] + subnet_id = module.local_snet_default.id + private_dns_zone_ids = [module.local_pdnsz_mariadb_server.list[local.dns_mariadb_server].id] - module_enabled = true - tags = {} + tags = {} } -# Data dependencies +# Modules dependencies -data "azurerm_subnet" "snet_default" { - name = local.snet_name - virtual_network_name = local.vnet_name - resource_group_name = var.rg_name +module "local_rg" { + source = "../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags } -data "azurerm_private_dns_zone" "mariadb_server" { - name = local.dns_mariadb_server - resource_group_name = var.rg_name_dns +module "local_vnet" { + source = "../../virtual-network" + + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location + + address_space = ["10.0.0.0/16"] +} + +module "local_snet_default" { + source = "../../subnet" + + rg_name = module.local_rg.name + name = "vnet-${random_string.postfix.result}-mariadb-default" + vnet_name = module.local_vnet.name + address_prefixes = ["10.0.6.0/24"] +} + +# DNS zones + +module "local_pdnsz_mariadb_server" { + source = "../../private-dns-zone" + + rg_name = module.local_rg.name + dns_zones = [local.dns_mariadb_server] + vnet_id = module.local_vnet.id } \ No newline at end of file diff --git a/terraform/mariadb-database/test/main.tf b/terraform/mariadb-database/test/providers.tf similarity index 93% rename from terraform/mariadb-database/test/main.tf rename to terraform/mariadb-database/test/providers.tf index 2751e400..6605e5de 100644 --- a/terraform/mariadb-database/test/main.tf +++ b/terraform/mariadb-database/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/mariadb-database/test/variables.tf b/terraform/mariadb-database/test/variables.tf index c2d60718..b025435b 100644 --- a/terraform/mariadb-database/test/variables.tf +++ b/terraform/mariadb-database/test/variables.tf @@ -7,14 +7,4 @@ resource "random_string" "postfix" { variable "location" { type = string default = "North Europe" -} - -variable "rg_name" { - type = string - default = "rg-adl-modules-test-01" -} - -variable "rg_name_dns" { - type = string - default = "rg-adl-modules-test-01-global-dns" } \ No newline at end of file diff --git a/terraform/mariadb-database/variables.tf b/terraform/mariadb-database/variables.tf index bf19bb14..87304b19 100644 --- a/terraform/mariadb-database/variables.tf +++ b/terraform/mariadb-database/variables.tf @@ -22,6 +22,7 @@ variable "tags" { variable "module_enabled" { type = bool description = "Variable to enable or disable the module" + default = true } variable "is_sec_module" { @@ -33,11 +34,13 @@ variable "is_sec_module" { variable "subnet_id" { type = string description = "The ID of the subnet from which private IP addresses will be allocated for this Private Endpoint" + default = "" } variable "private_dns_zone_ids" { type = list(string) description = "Specifies the list of Private DNS Zones to include" + default = [] } variable "administrator_login" { diff --git a/terraform/mysql-database/test/locals.tf b/terraform/mysql-database/test/locals.tf index bd44de82..1b6e5fb5 100644 --- a/terraform/mysql-database/test/locals.tf +++ b/terraform/mysql-database/test/locals.tf @@ -1,5 +1,9 @@ locals { - snet_name = "snet-adl-modules-test-default" - vnet_name = "vnet-adl-modules-test" + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "mysql-database" + Toolkit = "Terraform" + } + dns_mysql_server = "privatelink.mysql.database.azure.com" } \ No newline at end of file diff --git a/terraform/mysql-database/test/mysql_database.tf b/terraform/mysql-database/test/mysql_database.tf index 01a97bea..9ff356e0 100644 --- a/terraform/mysql-database/test/mysql_database.tf +++ b/terraform/mysql-database/test/mysql_database.tf @@ -2,25 +2,51 @@ module "mysql_database" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location - subnet_id = data.azurerm_subnet.snet_default.id - private_dns_zone_ids = [data.azurerm_private_dns_zone.mysql_server.id] + subnet_id = module.local_snet_default.id + private_dns_zone_ids = [module.local_pdnsz_mysql_server.list[local.dns_mysql_server].id] - module_enabled = true - tags = {} + tags = {} } -# Data dependencies +# Modules dependencies -data "azurerm_subnet" "snet_default" { - name = local.snet_name - virtual_network_name = local.vnet_name - resource_group_name = var.rg_name +module "local_rg" { + source = "../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags } -data "azurerm_private_dns_zone" "mysql_server" { - name = local.dns_mysql_server - resource_group_name = var.rg_name_dns +module "local_vnet" { + source = "../../virtual-network" + + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location + + address_space = ["10.0.0.0/16"] +} + +module "local_snet_default" { + source = "../../subnet" + + rg_name = module.local_rg.name + name = "vnet-${random_string.postfix.result}-mysql-default" + vnet_name = module.local_vnet.name + address_prefixes = ["10.0.6.0/24"] +} + +# DNS zones + +module "local_pdnsz_mysql_server" { + source = "../../private-dns-zone" + + rg_name = module.local_rg.name + dns_zones = [local.dns_mysql_server] + vnet_id = module.local_vnet.id } \ No newline at end of file diff --git a/terraform/mysql-database/test/main.tf b/terraform/mysql-database/test/providers.tf similarity index 93% rename from terraform/mysql-database/test/main.tf rename to terraform/mysql-database/test/providers.tf index 76d0f8a5..842af686 100644 --- a/terraform/mysql-database/test/main.tf +++ b/terraform/mysql-database/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/mysql-database/test/variables.tf b/terraform/mysql-database/test/variables.tf index c2d60718..b025435b 100644 --- a/terraform/mysql-database/test/variables.tf +++ b/terraform/mysql-database/test/variables.tf @@ -7,14 +7,4 @@ resource "random_string" "postfix" { variable "location" { type = string default = "North Europe" -} - -variable "rg_name" { - type = string - default = "rg-adl-modules-test-01" -} - -variable "rg_name_dns" { - type = string - default = "rg-adl-modules-test-01-global-dns" } \ No newline at end of file diff --git a/terraform/mysql-database/variables.tf b/terraform/mysql-database/variables.tf index 16e79c01..b4bc70ce 100644 --- a/terraform/mysql-database/variables.tf +++ b/terraform/mysql-database/variables.tf @@ -22,6 +22,7 @@ variable "tags" { variable "module_enabled" { type = bool description = "Variable to enable or disable the module" + default = true } variable "is_sec_module" { @@ -33,11 +34,13 @@ variable "is_sec_module" { variable "subnet_id" { type = string description = "The ID of the subnet from which private IP addresses will be allocated for this Private Endpoint" + default = "" } variable "private_dns_zone_ids" { type = list(string) description = "Specifies the list of Private DNS Zones to include" + default = [] } variable "administrator_login" { diff --git a/terraform/network-security-group/test/locals.tf b/terraform/network-security-group/test/locals.tf index 644fba04..66d3a470 100644 --- a/terraform/network-security-group/test/locals.tf +++ b/terraform/network-security-group/test/locals.tf @@ -1,2 +1,7 @@ locals { + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "network-security-group" + Toolkit = "Terraform" + } } \ No newline at end of file diff --git a/terraform/network-security-group/test/network_security_group.tf b/terraform/network-security-group/test/network_security_group.tf index 15f0db04..1c7cede5 100644 --- a/terraform/network-security-group/test/network_security_group.tf +++ b/terraform/network-security-group/test/network_security_group.tf @@ -2,8 +2,19 @@ module "network_security_group" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location tags = {} +} + +# Modules dependencies + +module "local_rg" { + source = "../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags } \ No newline at end of file diff --git a/terraform/network-security-group/test/main.tf b/terraform/network-security-group/test/providers.tf similarity index 93% rename from terraform/network-security-group/test/main.tf rename to terraform/network-security-group/test/providers.tf index 981e89f7..67b1d848 100644 --- a/terraform/network-security-group/test/main.tf +++ b/terraform/network-security-group/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/network-security-group/test/variables.tf b/terraform/network-security-group/test/variables.tf index edf7f3e0..b025435b 100644 --- a/terraform/network-security-group/test/variables.tf +++ b/terraform/network-security-group/test/variables.tf @@ -7,9 +7,4 @@ resource "random_string" "postfix" { variable "location" { type = string default = "North Europe" -} - -variable "rg_name" { - type = string - default = "rg-adl-modules-test-01" } \ No newline at end of file diff --git a/terraform/network-security-rule/test/locals.tf b/terraform/network-security-rule/test/locals.tf index 644fba04..6b17e8b8 100644 --- a/terraform/network-security-rule/test/locals.tf +++ b/terraform/network-security-rule/test/locals.tf @@ -1,2 +1,7 @@ locals { + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "network-security-rule" + Toolkit = "Terraform" + } } \ No newline at end of file diff --git a/terraform/network-security-rule/test/network_security_rule.tf b/terraform/network-security-rule/test/network_security_rule.tf index f36322a9..b859ddb7 100644 --- a/terraform/network-security-rule/test/network_security_rule.tf +++ b/terraform/network-security-rule/test/network_security_rule.tf @@ -1,7 +1,7 @@ module "network_security_rule" { source = "../" - rg_name = var.rg_name + rg_name = module.local_rg.name name = "TestRule" priority = 100 @@ -16,8 +16,21 @@ module "network_security_rule" { network_security_group_name = module.local_network_security_group.name } -# Module dependencies +# Modules dependencies + +module "local_rg" { + source = "../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags +} module "local_network_security_group" { - source = "../../network-security-group/test" + source = "../../network-security-group" + + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location } diff --git a/terraform/network-security-rule/test/main.tf b/terraform/network-security-rule/test/providers.tf similarity index 93% rename from terraform/network-security-rule/test/main.tf rename to terraform/network-security-rule/test/providers.tf index 5ae618c0..f2376aca 100644 --- a/terraform/network-security-rule/test/main.tf +++ b/terraform/network-security-rule/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/network-security-rule/test/variables.tf b/terraform/network-security-rule/test/variables.tf index 42af12f1..b025435b 100644 --- a/terraform/network-security-rule/test/variables.tf +++ b/terraform/network-security-rule/test/variables.tf @@ -1,4 +1,10 @@ -variable "rg_name" { +resource "random_string" "postfix" { + length = 8 + special = false + upper = false +} + +variable "location" { type = string - default = "rg-adl-modules-test-01" + default = "North Europe" } \ No newline at end of file diff --git a/terraform/postgresql-database/test/locals.tf b/terraform/postgresql-database/test/locals.tf index 74d8354c..90aecff1 100644 --- a/terraform/postgresql-database/test/locals.tf +++ b/terraform/postgresql-database/test/locals.tf @@ -1,5 +1,9 @@ locals { - snet_name = "snet-adl-modules-test-default" - vnet_name = "vnet-adl-modules-test" + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "postgresql-database" + Toolkit = "Terraform" + } + dns_psql_server = "privatelink.postgres.database.azure.com" } \ No newline at end of file diff --git a/terraform/postgresql-database/test/postgresql_database.tf b/terraform/postgresql-database/test/postgresql_database.tf index be43988b..c364f915 100644 --- a/terraform/postgresql-database/test/postgresql_database.tf +++ b/terraform/postgresql-database/test/postgresql_database.tf @@ -2,25 +2,51 @@ module "postgresql_database" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location - subnet_id = data.azurerm_subnet.snet_default.id - private_dns_zone_ids = [data.azurerm_private_dns_zone.psql_server.id] + subnet_id = module.local_snet_default.id + private_dns_zone_ids = [module.local_pdnsz_psql.list[local.dns_psql_server].id] - module_enabled = true - tags = {} + tags = {} } -# Data dependencies +# Modules dependencies -data "azurerm_subnet" "snet_default" { - name = local.snet_name - virtual_network_name = local.vnet_name - resource_group_name = var.rg_name +module "local_rg" { + source = "../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags } -data "azurerm_private_dns_zone" "psql_server" { - name = local.dns_psql_server - resource_group_name = var.rg_name_dns +module "local_vnet" { + source = "../../virtual-network" + + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location + + address_space = ["10.0.0.0/16"] +} + +module "local_snet_default" { + source = "../../subnet" + + rg_name = module.local_rg.name + name = "vnet-${random_string.postfix.result}-psql-default" + vnet_name = module.local_vnet.name + address_prefixes = ["10.0.6.0/24"] +} + +# DNS zones + +module "local_pdnsz_psql" { + source = "../../private-dns-zone" + + rg_name = module.local_rg.name + dns_zones = [local.dns_psql_server] + vnet_id = module.local_vnet.id } \ No newline at end of file diff --git a/terraform/postgresql-database/test/main.tf b/terraform/postgresql-database/test/providers.tf similarity index 93% rename from terraform/postgresql-database/test/main.tf rename to terraform/postgresql-database/test/providers.tf index d6810fa5..d4347e6d 100644 --- a/terraform/postgresql-database/test/main.tf +++ b/terraform/postgresql-database/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/postgresql-database/test/variables.tf b/terraform/postgresql-database/test/variables.tf index c2d60718..b025435b 100644 --- a/terraform/postgresql-database/test/variables.tf +++ b/terraform/postgresql-database/test/variables.tf @@ -7,14 +7,4 @@ resource "random_string" "postfix" { variable "location" { type = string default = "North Europe" -} - -variable "rg_name" { - type = string - default = "rg-adl-modules-test-01" -} - -variable "rg_name_dns" { - type = string - default = "rg-adl-modules-test-01-global-dns" } \ No newline at end of file diff --git a/terraform/postgresql-database/variables.tf b/terraform/postgresql-database/variables.tf index b0fefc8d..5bce2baa 100644 --- a/terraform/postgresql-database/variables.tf +++ b/terraform/postgresql-database/variables.tf @@ -22,6 +22,7 @@ variable "tags" { variable "module_enabled" { type = bool description = "Variable to enable or disable the module" + default = true } variable "is_sec_module" { @@ -33,11 +34,13 @@ variable "is_sec_module" { variable "subnet_id" { type = string description = "The ID of the subnet from which private IP addresses will be allocated for this Private Endpoint" + default = "" } variable "private_dns_zone_ids" { type = list(string) description = "Specifies the list of Private DNS Zones to include" + default = [] } variable "administrator_login" { diff --git a/terraform/private-dns-zone/test/locals.tf b/terraform/private-dns-zone/test/locals.tf new file mode 100644 index 00000000..07d00b7b --- /dev/null +++ b/terraform/private-dns-zone/test/locals.tf @@ -0,0 +1,7 @@ +locals { + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "private-dns-zone" + Toolkit = "Terraform" + } +} \ No newline at end of file diff --git a/terraform/private-dns-zone/test/private_dns_zone.tf b/terraform/private-dns-zone/test/private_dns_zone.tf index cbea7ef6..c97b17f7 100644 --- a/terraform/private-dns-zone/test/private_dns_zone.tf +++ b/terraform/private-dns-zone/test/private_dns_zone.tf @@ -1,8 +1,30 @@ module "private_dns_zones" { source = "../" - rg_name = var.rg_name + rg_name = module.local_rg.name dns_zones = var.dns_zones + vnet_id = module.local_vnet.id tags = {} +} + +# Modules dependencies + +module "local_rg" { + source = "../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags +} + +module "local_vnet" { + source = "../../virtual-network" + + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location + + address_space = ["10.0.0.0/16"] } \ No newline at end of file diff --git a/terraform/private-dns-zone/test/main.tf b/terraform/private-dns-zone/test/providers.tf similarity index 93% rename from terraform/private-dns-zone/test/main.tf rename to terraform/private-dns-zone/test/providers.tf index ac1203b2..45d39cd5 100644 --- a/terraform/private-dns-zone/test/main.tf +++ b/terraform/private-dns-zone/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/private-dns-zone/test/variables.tf b/terraform/private-dns-zone/test/variables.tf index e63fa717..14aa346a 100644 --- a/terraform/private-dns-zone/test/variables.tf +++ b/terraform/private-dns-zone/test/variables.tf @@ -1,19 +1,14 @@ -variable "rg_name" { - type = string - default = "rg-adl-modules-test-01" -} - -variable "rg_name_dns" { - type = string - default = "rg-adl-modules-test-01-global-dns" -} - resource "random_string" "postfix" { - length = 6 + length = 8 special = false upper = false } +variable "location" { + type = string + default = "North Europe" +} + variable "dns_zones" { type = set(string) description = "List of Private DNS Zones utilized by Azure Private Link resources" diff --git a/terraform/purview/main.tf b/terraform/purview/main.tf index a59a9c68..70da717b 100644 --- a/terraform/purview/main.tf +++ b/terraform/purview/main.tf @@ -34,6 +34,10 @@ resource "azurerm_private_endpoint" "purview_pe" { name = "private-dns-zone-group-purview" private_dns_zone_ids = var.private_dns_zone_ids_account } + + count = var.is_sec_module ? 1 : 0 + + tags = var.tags } resource "azurerm_private_endpoint" "studio_pe" { @@ -55,4 +59,6 @@ resource "azurerm_private_endpoint" "studio_pe" { } count = var.is_sec_module ? 1 : 0 + + tags = var.tags } \ No newline at end of file diff --git a/terraform/purview/test/locals.tf b/terraform/purview/test/locals.tf index ff442f54..a26d6d98 100644 --- a/terraform/purview/test/locals.tf +++ b/terraform/purview/test/locals.tf @@ -1,6 +1,10 @@ locals { - snet_name = "snet-adl-modules-test-default" - vnet_name = "vnet-adl-modules-test-we" + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "purview" + Toolkit = "Terraform" + } + dns_pview_portal = "privatelink.purview.azure.com" dns_pview_account = "privatelink.purviewstudio.azure.com" } \ No newline at end of file diff --git a/terraform/purview/test/main.tf b/terraform/purview/test/providers.tf similarity index 92% rename from terraform/purview/test/main.tf rename to terraform/purview/test/providers.tf index 3fddd013..d06d3116 100644 --- a/terraform/purview/test/main.tf +++ b/terraform/purview/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/purview/test/purview.tf b/terraform/purview/test/purview.tf index fb0104ac..a7fbb453 100644 --- a/terraform/purview/test/purview.tf +++ b/terraform/purview/test/purview.tf @@ -2,30 +2,60 @@ module "purview" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location - subnet_id = data.azurerm_subnet.snet_default.id - private_dns_zone_ids_account = [data.azurerm_private_dns_zone.pview_portal.id] - private_dns_zone_ids_portal = [data.azurerm_private_dns_zone.pview_acount.id] + subnet_id = module.local_snet_default.id + private_dns_zone_ids_account = [module.local_pdnsz_pview_portal.list[local.dns_pview_portal].id] + private_dns_zone_ids_portal = [module.local_pdnsz_pview_account.list[local.dns_pview_account].id] tags = {} } -# Data dependencies +# Modules dependencies -data "azurerm_subnet" "snet_default" { - name = local.snet_name - virtual_network_name = local.vnet_name - resource_group_name = var.rg_name +module "local_rg" { + source = "../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags } -data "azurerm_private_dns_zone" "pview_portal" { - name = local.dns_pview_portal - resource_group_name = var.rg_name_dns +module "local_vnet" { + source = "../../virtual-network" + + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location + + address_space = ["10.0.0.0/16"] } -data "azurerm_private_dns_zone" "pview_acount" { - name = local.dns_pview_account - resource_group_name = var.rg_name_dns +module "local_snet_default" { + source = "../../subnet" + + rg_name = module.local_rg.name + name = "vnet-${random_string.postfix.result}-pur-default" + vnet_name = module.local_vnet.name + address_prefixes = ["10.0.6.0/24"] } + +# DNS zones + +module "local_pdnsz_pview_portal" { + source = "../../private-dns-zone" + + rg_name = module.local_rg.name + dns_zones = [local.dns_pview_portal] + vnet_id = module.local_vnet.id +} + +module "local_pdnsz_pview_account" { + source = "../../private-dns-zone" + + rg_name = module.local_rg.name + dns_zones = [local.dns_pview_account] + vnet_id = module.local_vnet.id +} \ No newline at end of file diff --git a/terraform/purview/test/variables.tf b/terraform/purview/test/variables.tf index a4c42095..da40f6a4 100644 --- a/terraform/purview/test/variables.tf +++ b/terraform/purview/test/variables.tf @@ -7,14 +7,4 @@ resource "random_string" "postfix" { variable "location" { type = string default = "West Europe" -} - -variable "rg_name" { - type = string - default = "rg-adl-modules-test-01-we" -} - -variable "rg_name_dns" { - type = string - default = "rg-adl-modules-test-01-global-dns-we" -} +} \ No newline at end of file diff --git a/terraform/purview/variables.tf b/terraform/purview/variables.tf index 1b221a13..85c2cfaf 100644 --- a/terraform/purview/variables.tf +++ b/terraform/purview/variables.tf @@ -28,6 +28,7 @@ variable "is_sec_module" { variable "subnet_id" { type = string description = "The ID of the subnet from which private IP addresses will be allocated for this Private Endpoint" + default = "" } variable "public_network_enabled" { @@ -39,9 +40,11 @@ variable "public_network_enabled" { variable "private_dns_zone_ids_account" { type = list(string) description = "Specifies the list of Private DNS Zones to include" + default = [] } variable "private_dns_zone_ids_portal" { type = list(string) description = "Specifies the list of Private DNS Zones to include" + default = [] } \ No newline at end of file diff --git a/terraform/redis-cache/test/locals.tf b/terraform/redis-cache/test/locals.tf index e9b1420f..10deb6c2 100644 --- a/terraform/redis-cache/test/locals.tf +++ b/terraform/redis-cache/test/locals.tf @@ -1,5 +1,9 @@ locals { - snet_name = "snet-adl-modules-test-default" - vnet_name = "vnet-adl-modules-test" + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "redis-cache" + Toolkit = "Terraform" + } + dns_redis = "privatelink.redis.cache.windows.net" } \ No newline at end of file diff --git a/terraform/redis-cache/test/main.tf b/terraform/redis-cache/test/providers.tf similarity index 93% rename from terraform/redis-cache/test/main.tf rename to terraform/redis-cache/test/providers.tf index 0ddf8ef3..0c66c024 100644 --- a/terraform/redis-cache/test/main.tf +++ b/terraform/redis-cache/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/redis-cache/test/redis_cache.tf b/terraform/redis-cache/test/redis_cache.tf index 7660bda5..68ac5195 100644 --- a/terraform/redis-cache/test/redis_cache.tf +++ b/terraform/redis-cache/test/redis_cache.tf @@ -2,25 +2,51 @@ module "redis_cache" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location - subnet_id = data.azurerm_subnet.snet_default.id - private_dns_zone_ids = [data.azurerm_private_dns_zone.redis.id] + subnet_id = module.local_snet_default.id + private_dns_zone_ids = [module.local_pdnsz_redis.list[local.dns_redis].id] - module_enabled = true - tags = {} + tags = {} } -# Data dependencies +# Modules dependencies -data "azurerm_subnet" "snet_default" { - name = local.snet_name - virtual_network_name = local.vnet_name - resource_group_name = var.rg_name +module "local_rg" { + source = "../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags } -data "azurerm_private_dns_zone" "redis" { - name = local.dns_redis - resource_group_name = var.rg_name_dns +module "local_vnet" { + source = "../../virtual-network" + + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location + + address_space = ["10.0.0.0/16"] +} + +module "local_snet_default" { + source = "../../subnet" + + rg_name = module.local_rg.name + name = "vnet-${random_string.postfix.result}-redis-default" + vnet_name = module.local_vnet.name + address_prefixes = ["10.0.6.0/24"] +} + +# DNS zones + +module "local_pdnsz_redis" { + source = "../../private-dns-zone" + + rg_name = module.local_rg.name + dns_zones = [local.dns_redis] + vnet_id = module.local_vnet.id } \ No newline at end of file diff --git a/terraform/redis-cache/test/variables.tf b/terraform/redis-cache/test/variables.tf index c2d60718..b025435b 100644 --- a/terraform/redis-cache/test/variables.tf +++ b/terraform/redis-cache/test/variables.tf @@ -7,14 +7,4 @@ resource "random_string" "postfix" { variable "location" { type = string default = "North Europe" -} - -variable "rg_name" { - type = string - default = "rg-adl-modules-test-01" -} - -variable "rg_name_dns" { - type = string - default = "rg-adl-modules-test-01-global-dns" } \ No newline at end of file diff --git a/terraform/redis-cache/variables.tf b/terraform/redis-cache/variables.tf index 3ce75bbf..311ab3e0 100644 --- a/terraform/redis-cache/variables.tf +++ b/terraform/redis-cache/variables.tf @@ -22,6 +22,7 @@ variable "tags" { variable "module_enabled" { type = bool description = "Variable to enable or disable the module" + default = true } variable "is_sec_module" { @@ -33,11 +34,13 @@ variable "is_sec_module" { variable "subnet_id" { type = string description = "The ID of the subnet from which private IP addresses will be allocated for this Private Endpoint" + default = "" } variable "private_dns_zone_ids" { type = list(string) description = "Specifies the list of Private DNS Zones to include" + default = [] } variable "capacity" { diff --git a/terraform/resource-group/test/locals.tf b/terraform/resource-group/test/locals.tf new file mode 100644 index 00000000..65d9afb4 --- /dev/null +++ b/terraform/resource-group/test/locals.tf @@ -0,0 +1,7 @@ +locals { + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "resource-group" + Toolkit = "Terraform" + } +} \ No newline at end of file diff --git a/terraform/resource-group/test/main.tf b/terraform/resource-group/test/providers.tf similarity index 93% rename from terraform/resource-group/test/main.tf rename to terraform/resource-group/test/providers.tf index f42a4864..d641d5cd 100644 --- a/terraform/resource-group/test/main.tf +++ b/terraform/resource-group/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/resource-group/test/resource_group.tf b/terraform/resource-group/test/resource_group.tf index 8bbcb6d6..4d8f4b98 100644 --- a/terraform/resource-group/test/resource_group.tf +++ b/terraform/resource-group/test/resource_group.tf @@ -4,5 +4,5 @@ module "resource_group" { basename = random_string.postfix.result location = var.location - tags = {} + tags = local.tags } \ No newline at end of file diff --git a/terraform/route-table/test/locals.tf b/terraform/route-table/test/locals.tf index 644fba04..107bd9c6 100644 --- a/terraform/route-table/test/locals.tf +++ b/terraform/route-table/test/locals.tf @@ -1,2 +1,7 @@ locals { + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "route-table" + Toolkit = "Terraform" + } } \ No newline at end of file diff --git a/terraform/route-table/test/main.tf b/terraform/route-table/test/providers.tf similarity index 93% rename from terraform/route-table/test/main.tf rename to terraform/route-table/test/providers.tf index e6bab67b..c5e0f2ad 100644 --- a/terraform/route-table/test/main.tf +++ b/terraform/route-table/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/route-table/test/route_table.tf b/terraform/route-table/test/route_table.tf index 942724fb..a4fdf62e 100644 --- a/terraform/route-table/test/route_table.tf +++ b/terraform/route-table/test/route_table.tf @@ -2,8 +2,19 @@ module "route_table" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location tags = {} +} + +# Modules dependencies + +module "local_rg" { + source = "../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags } \ No newline at end of file diff --git a/terraform/route-table/test/variables.tf b/terraform/route-table/test/variables.tf index edf7f3e0..b025435b 100644 --- a/terraform/route-table/test/variables.tf +++ b/terraform/route-table/test/variables.tf @@ -7,9 +7,4 @@ resource "random_string" "postfix" { variable "location" { type = string default = "North Europe" -} - -variable "rg_name" { - type = string - default = "rg-adl-modules-test-01" } \ No newline at end of file diff --git a/terraform/route/test/locals.tf b/terraform/route/test/locals.tf index 644fba04..8433879f 100644 --- a/terraform/route/test/locals.tf +++ b/terraform/route/test/locals.tf @@ -1,2 +1,7 @@ locals { + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "route" + Toolkit = "Terraform" + } } \ No newline at end of file diff --git a/terraform/route/test/main.tf b/terraform/route/test/providers.tf similarity index 92% rename from terraform/route/test/main.tf rename to terraform/route/test/providers.tf index e78684bf..ed2c580f 100644 --- a/terraform/route/test/main.tf +++ b/terraform/route/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/route/test/route.tf b/terraform/route/test/route.tf index 57819110..509906c4 100644 --- a/terraform/route/test/route.tf +++ b/terraform/route/test/route.tf @@ -1,7 +1,7 @@ module "route" { source = "../" - rg_name = var.rg_name + rg_name = module.local_rg.name name = "TestRoute" route_table_name = module.local_route_table.name @@ -9,8 +9,21 @@ module "route" { next_hop_type = "Internet" } -# Module dependencies +# Modules dependencies + +module "local_rg" { + source = "../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags +} module "local_route_table" { - source = "../../route-table/test" + source = "../../route-table" + + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location } diff --git a/terraform/route/test/variables.tf b/terraform/route/test/variables.tf index 464d9383..b025435b 100644 --- a/terraform/route/test/variables.tf +++ b/terraform/route/test/variables.tf @@ -1,9 +1,10 @@ -variable "location" { - type = string - default = "North Europe" +resource "random_string" "postfix" { + length = 8 + special = false + upper = false } -variable "rg_name" { +variable "location" { type = string - default = "rg-adl-modules-test-01" + default = "North Europe" } \ No newline at end of file diff --git a/terraform/service-bus/service-bus-namespace/test/locals.tf b/terraform/service-bus/service-bus-namespace/test/locals.tf index b7263ae4..2731d859 100644 --- a/terraform/service-bus/service-bus-namespace/test/locals.tf +++ b/terraform/service-bus/service-bus-namespace/test/locals.tf @@ -1,5 +1,9 @@ locals { - snet_name = "snet-adl-modules-test-default" - vnet_name = "vnet-adl-modules-test" + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "service-bus-namespace" + Toolkit = "Terraform" + } + dns_sb_namespace = "privatelink.servicebus.windows.net" } \ No newline at end of file diff --git a/terraform/service-bus/service-bus-namespace/test/main.tf b/terraform/service-bus/service-bus-namespace/test/providers.tf similarity index 93% rename from terraform/service-bus/service-bus-namespace/test/main.tf rename to terraform/service-bus/service-bus-namespace/test/providers.tf index 7dff07c9..11457483 100644 --- a/terraform/service-bus/service-bus-namespace/test/main.tf +++ b/terraform/service-bus/service-bus-namespace/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/service-bus/service-bus-namespace/test/service_bus_namespace.tf b/terraform/service-bus/service-bus-namespace/test/service_bus_namespace.tf index 0e651828..ca8a3dfd 100644 --- a/terraform/service-bus/service-bus-namespace/test/service_bus_namespace.tf +++ b/terraform/service-bus/service-bus-namespace/test/service_bus_namespace.tf @@ -2,24 +2,51 @@ module "service_bus_namespace" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location - subnet_id = data.azurerm_subnet.snet_default.id - private_dns_zone_ids = [data.azurerm_private_dns_zone.sb_namespace.id] + subnet_id = module.local_snet_default.id + private_dns_zone_ids = [module.local_pdnsz_sb.list[local.dns_sb_namespace].id] tags = {} } -# Data dependencies +# Modules dependencies -data "azurerm_subnet" "snet_default" { - name = local.snet_name - virtual_network_name = local.vnet_name - resource_group_name = var.rg_name +module "local_rg" { + source = "../../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags } -data "azurerm_private_dns_zone" "sb_namespace" { - name = local.dns_sb_namespace - resource_group_name = var.rg_name_dns +module "local_vnet" { + source = "../../../virtual-network" + + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location + + address_space = ["10.0.0.0/16"] +} + +module "local_snet_default" { + source = "../../../subnet" + + rg_name = module.local_rg.name + name = "vnet-${random_string.postfix.result}-sb-default" + vnet_name = module.local_vnet.name + address_prefixes = ["10.0.6.0/24"] +} + +# DNS zones + +module "local_pdnsz_sb" { + source = "../../../private-dns-zone" + + rg_name = module.local_rg.name + dns_zones = [local.dns_sb_namespace] + vnet_id = module.local_vnet.id } \ No newline at end of file diff --git a/terraform/service-bus/service-bus-namespace/test/variables.tf b/terraform/service-bus/service-bus-namespace/test/variables.tf index c2d60718..b025435b 100644 --- a/terraform/service-bus/service-bus-namespace/test/variables.tf +++ b/terraform/service-bus/service-bus-namespace/test/variables.tf @@ -7,14 +7,4 @@ resource "random_string" "postfix" { variable "location" { type = string default = "North Europe" -} - -variable "rg_name" { - type = string - default = "rg-adl-modules-test-01" -} - -variable "rg_name_dns" { - type = string - default = "rg-adl-modules-test-01-global-dns" } \ No newline at end of file diff --git a/terraform/service-bus/service-bus-namespace/variables.tf b/terraform/service-bus/service-bus-namespace/variables.tf index f6669a74..3cabd788 100644 --- a/terraform/service-bus/service-bus-namespace/variables.tf +++ b/terraform/service-bus/service-bus-namespace/variables.tf @@ -46,11 +46,13 @@ variable "manage" { variable "subnet_id" { type = string description = "The ID of the subnet from which private IP addresses will be allocated for this Private Endpoint" + default = "" } variable "private_dns_zone_ids" { type = list(string) description = "Specifies the list of Private DNS Zones to include" + default = [] } variable "sku" { diff --git a/terraform/service-bus/service-bus-queue/test/locals.tf b/terraform/service-bus/service-bus-queue/test/locals.tf index 644fba04..6edd47aa 100644 --- a/terraform/service-bus/service-bus-queue/test/locals.tf +++ b/terraform/service-bus/service-bus-queue/test/locals.tf @@ -1,2 +1,7 @@ locals { + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "service-bus-queue" + Toolkit = "Terraform" + } } \ No newline at end of file diff --git a/terraform/service-bus/service-bus-queue/test/main.tf b/terraform/service-bus/service-bus-queue/test/providers.tf similarity index 93% rename from terraform/service-bus/service-bus-queue/test/main.tf rename to terraform/service-bus/service-bus-queue/test/providers.tf index 5325b3bc..616a49f5 100644 --- a/terraform/service-bus/service-bus-queue/test/main.tf +++ b/terraform/service-bus/service-bus-queue/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/service-bus/service-bus-subscription/test/locals.tf b/terraform/service-bus/service-bus-subscription/test/locals.tf index 644fba04..bc5f57f9 100644 --- a/terraform/service-bus/service-bus-subscription/test/locals.tf +++ b/terraform/service-bus/service-bus-subscription/test/locals.tf @@ -1,2 +1,7 @@ locals { + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "service-bus-subscription" + Toolkit = "Terraform" + } } \ No newline at end of file diff --git a/terraform/service-bus/service-bus-subscription/test/main.tf b/terraform/service-bus/service-bus-subscription/test/providers.tf similarity index 93% rename from terraform/service-bus/service-bus-subscription/test/main.tf rename to terraform/service-bus/service-bus-subscription/test/providers.tf index d1d54208..4a6549bf 100644 --- a/terraform/service-bus/service-bus-subscription/test/main.tf +++ b/terraform/service-bus/service-bus-subscription/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/service-bus/service-bus-topic/test/locals.tf b/terraform/service-bus/service-bus-topic/test/locals.tf index 644fba04..4a2bb26b 100644 --- a/terraform/service-bus/service-bus-topic/test/locals.tf +++ b/terraform/service-bus/service-bus-topic/test/locals.tf @@ -1,2 +1,7 @@ locals { + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "service-bus-topic" + Toolkit = "Terraform" + } } \ No newline at end of file diff --git a/terraform/service-bus/service-bus-topic/test/main.tf b/terraform/service-bus/service-bus-topic/test/providers.tf similarity index 93% rename from terraform/service-bus/service-bus-topic/test/main.tf rename to terraform/service-bus/service-bus-topic/test/providers.tf index 3e884c9d..2a39e141 100644 --- a/terraform/service-bus/service-bus-topic/test/main.tf +++ b/terraform/service-bus/service-bus-topic/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/sql-database-server/test/locals.tf b/terraform/sql-database-server/test/locals.tf index 1c184dac..9e271257 100644 --- a/terraform/sql-database-server/test/locals.tf +++ b/terraform/sql-database-server/test/locals.tf @@ -1,5 +1,9 @@ locals { - snet_name = "snet-adl-modules-test-default" - vnet_name = "vnet-adl-modules-test" + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "sql-server-database" + Toolkit = "Terraform" + } + dns_sql_server = "privatelink.database.windows.net" } \ No newline at end of file diff --git a/terraform/sql-database-server/test/main.tf b/terraform/sql-database-server/test/providers.tf similarity index 93% rename from terraform/sql-database-server/test/main.tf rename to terraform/sql-database-server/test/providers.tf index 5f804164..a26b2773 100644 --- a/terraform/sql-database-server/test/main.tf +++ b/terraform/sql-database-server/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/sql-database-server/test/sql_database_server.tf b/terraform/sql-database-server/test/sql_database_server.tf index c8fd0f34..6e5802d1 100644 --- a/terraform/sql-database-server/test/sql_database_server.tf +++ b/terraform/sql-database-server/test/sql_database_server.tf @@ -2,31 +2,57 @@ module "sql_database_server" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location - subnet_id = data.azurerm_subnet.snet_default.id - private_dns_zone_ids = [data.azurerm_private_dns_zone.sql_server.id] + subnet_id = module.local_snet_default.id + private_dns_zone_ids = [module.local_pdnsz_sql_blob.list[local.dns_sql_server].id] db_version = "12.0" administrator_login = "sqladminuser" administrator_login_password = "ThisIsNotVerySecure!" - is_sec_module = var.is_sec_module - module_enabled = true + is_sec_module = var.is_sec_module tags = {} } -# Data dependencies +# Modules dependencies -data "azurerm_subnet" "snet_default" { - name = local.snet_name - virtual_network_name = local.vnet_name - resource_group_name = var.rg_name +module "local_rg" { + source = "../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags } -data "azurerm_private_dns_zone" "sql_server" { - name = local.dns_sql_server - resource_group_name = var.rg_name_dns +module "local_vnet" { + source = "../../virtual-network" + + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location + + address_space = ["10.0.0.0/16"] +} + +module "local_snet_default" { + source = "../../subnet" + + rg_name = module.local_rg.name + name = "vnet-${random_string.postfix.result}-sql-default" + vnet_name = module.local_vnet.name + address_prefixes = ["10.0.6.0/24"] +} + +# DNS zones + +module "local_pdnsz_sql_blob" { + source = "../../private-dns-zone" + + rg_name = module.local_rg.name + dns_zones = [local.dns_sql_server] + vnet_id = module.local_vnet.id } \ No newline at end of file diff --git a/terraform/sql-database-server/test/variables.tf b/terraform/sql-database-server/test/variables.tf index 72428607..f407116c 100644 --- a/terraform/sql-database-server/test/variables.tf +++ b/terraform/sql-database-server/test/variables.tf @@ -9,11 +9,6 @@ variable "location" { default = "North Europe" } -variable "rg_name" { - type = string - default = "rg-adl-modules-test-01" -} - variable "rg_name_dns" { type = string default = "rg-adl-modules-test-01-global-dns" @@ -28,5 +23,5 @@ variable "is_sec_module" { variable "module_enabled" { type = bool description = "Variable to enable or disable the module" - default = true + default = true } diff --git a/terraform/sql-database-server/variables.tf b/terraform/sql-database-server/variables.tf index 63ff1fd4..ef2f5647 100644 --- a/terraform/sql-database-server/variables.tf +++ b/terraform/sql-database-server/variables.tf @@ -28,16 +28,19 @@ variable "is_sec_module" { variable "module_enabled" { type = bool description = "Variable to enable or disable the module" + default = true } variable "subnet_id" { type = string description = "The ID of the subnet from which private IP addresses will be allocated for this Private Endpoint" + default = "" } variable "private_dns_zone_ids" { type = list(string) description = "Specifies the list of Private DNS Zones to include" + default = [] } variable "db_version" { diff --git a/terraform/sql-database/test/locals.tf b/terraform/sql-database/test/locals.tf index 644fba04..ac1c32ad 100644 --- a/terraform/sql-database/test/locals.tf +++ b/terraform/sql-database/test/locals.tf @@ -1,2 +1,9 @@ locals { + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "sql-database" + Toolkit = "Terraform" + } + + dns_sql_server = "privatelink.database.windows.net" } \ No newline at end of file diff --git a/terraform/sql-database/test/main.tf b/terraform/sql-database/test/providers.tf similarity index 93% rename from terraform/sql-database/test/main.tf rename to terraform/sql-database/test/providers.tf index b38b1275..5b367aec 100644 --- a/terraform/sql-database/test/main.tf +++ b/terraform/sql-database/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/sql-database/test/sql_database.tf b/terraform/sql-database/test/sql_database.tf index c41f3d91..e39b5884 100644 --- a/terraform/sql-database/test/sql_database.tf +++ b/terraform/sql-database/test/sql_database.tf @@ -2,25 +2,68 @@ module "sql_database" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location - server_name = var.server_name == "" ? module.local_sql_database_server[0].name : var.server_name + server_name = module.local_sql_database_server.name collation = "SQL_LATIN1_GENERAL_CP1_CI_AS" edition = "Standard" requested_service_objective_name = "S0" - module_enabled = true - tags = {} } -# Module dependencies +# Modules dependencies + +module "local_rg" { + source = "../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags +} module "local_sql_database_server" { - source = "../../sql-database-server/test" - rg_name = var.rg_name - location = var.location - is_sec_module = false - module_enabled = var.server_name == "" ? true : false + source = "../../sql-database-server" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location + + subnet_id = module.local_snet_default.id + private_dns_zone_ids = [module.local_pdnsz_sql_blob.list[local.dns_sql_server].id] + + db_version = "12.0" + administrator_login = "sqladminuser" + administrator_login_password = "ThisIsNotVerySecure!" +} + +module "local_vnet" { + source = "../../virtual-network" + + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location + + address_space = ["10.0.0.0/16"] +} + +module "local_snet_default" { + source = "../../subnet" + + rg_name = module.local_rg.name + name = "vnet-${random_string.postfix.result}-sql-default" + vnet_name = module.local_vnet.name + address_prefixes = ["10.0.6.0/24"] +} + +# DNS zones + +module "local_pdnsz_sql_blob" { + source = "../../private-dns-zone" + + rg_name = module.local_rg.name + dns_zones = [local.dns_sql_server] + vnet_id = module.local_vnet.id } \ No newline at end of file diff --git a/terraform/sql-database/test/variables.tf b/terraform/sql-database/test/variables.tf index 3eb385a1..9b065427 100644 --- a/terraform/sql-database/test/variables.tf +++ b/terraform/sql-database/test/variables.tf @@ -9,16 +9,6 @@ variable "location" { default = "North Europe" } -variable "rg_name" { - type = string - default = "rg-adl-modules-test-01" -} - -variable "rg_name_dns" { - type = string - default = "rg-adl-modules-test-01-global-dns" -} - variable "server_name" { type = string default = "" diff --git a/terraform/sql-database/variables.tf b/terraform/sql-database/variables.tf index bb68fe2b..57273e78 100644 --- a/terraform/sql-database/variables.tf +++ b/terraform/sql-database/variables.tf @@ -22,6 +22,7 @@ variable "tags" { variable "module_enabled" { type = bool description = "Variable to enable or disable the module" + default = true } variable "server_name" { diff --git a/terraform/storage-account/main.tf b/terraform/storage-account/main.tf index ff6896e0..6addb1e6 100644 --- a/terraform/storage-account/main.tf +++ b/terraform/storage-account/main.tf @@ -99,7 +99,7 @@ resource "azurerm_private_endpoint" "st_pe_blob" { private_dns_zone_ids = var.private_dns_zone_ids_blob } - count = var.is_sec_module && var.module_enabled ? 1 : 0 + count = var.is_sec_module && var.module_enabled && var.private_dns_zone_ids_blob != [] ? 1 : 0 tags = var.tags } @@ -122,7 +122,7 @@ resource "azurerm_private_endpoint" "st_pe_file" { private_dns_zone_ids = var.private_dns_zone_ids_file } - count = var.is_sec_module && var.module_enabled ? 1 : 0 + count = var.is_sec_module && var.module_enabled && var.private_dns_zone_ids_file != [] ? 1 : 0 tags = var.tags } @@ -145,7 +145,7 @@ resource "azurerm_private_endpoint" "st_pe_dfs" { private_dns_zone_ids = var.private_dns_zone_ids_dfs } - count = var.is_sec_module && var.module_enabled ? 1 : 0 + count = var.is_sec_module && var.module_enabled && var.private_dns_zone_ids_dfs != [] ? 1 : 0 tags = var.tags } \ No newline at end of file diff --git a/terraform/storage-account/test/locals.tf b/terraform/storage-account/test/locals.tf index 5c19862e..f629abcb 100644 --- a/terraform/storage-account/test/locals.tf +++ b/terraform/storage-account/test/locals.tf @@ -1,6 +1,10 @@ locals { - snet_name = "snet-adl-modules-test-default" - vnet_name = "vnet-adl-modules-test" + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "storage-account" + Toolkit = "Terraform" + } + dns_st_blob = "privatelink.blob.core.windows.net" dns_st_file = "privatelink.file.core.windows.net" dns_st_dfs = "privatelink.dfs.core.windows.net" diff --git a/terraform/storage-account/test/main.tf b/terraform/storage-account/test/providers.tf similarity index 93% rename from terraform/storage-account/test/main.tf rename to terraform/storage-account/test/providers.tf index 1a3dc71d..d4cbc767 100644 --- a/terraform/storage-account/test/main.tf +++ b/terraform/storage-account/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/storage-account/test/storage_account.tf b/terraform/storage-account/test/storage_account.tf index 96de98a0..0e614520 100644 --- a/terraform/storage-account/test/storage_account.tf +++ b/terraform/storage-account/test/storage_account.tf @@ -2,47 +2,79 @@ module "storage_account" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location - subnet_id = data.azurerm_subnet.snet_default.id - private_dns_zone_ids_blob = [data.azurerm_private_dns_zone.st_blob.id] - private_dns_zone_ids_file = [data.azurerm_private_dns_zone.st_file.id] - private_dns_zone_ids_dfs = [data.azurerm_private_dns_zone.st_dfs.id] + subnet_id = module.local_snet_default.id + private_dns_zone_ids_blob = [module.local_pdnsz_st_blob.list[local.dns_st_blob].id] + private_dns_zone_ids_file = [module.local_pdnsz_st_file.list[local.dns_st_file].id] + private_dns_zone_ids_dfs = [module.local_pdnsz_st_dfs.list[local.dns_st_dfs].id] hns_enabled = true firewall_default_action = var.firewall_default_action - firewall_ip_rules = var.firewall_ip_rules + firewall_ip_rules = [data.http.ip.response_body] firewall_bypass = var.firewall_bypass firewall_virtual_network_subnet_ids = var.firewall_virtual_network_subnet_ids - is_sec_module = var.is_sec_module - module_enabled = true + is_sec_module = var.is_sec_module tags = {} } -# Data dependencies +# Modules dependencies -data "azurerm_subnet" "snet_default" { - name = local.snet_name - virtual_network_name = local.vnet_name - resource_group_name = var.rg_name +module "local_rg" { + source = "../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags } -data "azurerm_private_dns_zone" "st_blob" { - name = local.dns_st_blob - resource_group_name = var.rg_name_dns +module "local_vnet" { + source = "../../virtual-network" + + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location + + address_space = ["10.0.0.0/16"] } -data "azurerm_private_dns_zone" "st_file" { - name = local.dns_st_file - resource_group_name = var.rg_name_dns +module "local_snet_default" { + source = "../../subnet" + + rg_name = module.local_rg.name + name = "vnet-${random_string.postfix.result}-st-default" + vnet_name = module.local_vnet.name + address_prefixes = ["10.0.6.0/24"] } -data "azurerm_private_dns_zone" "st_dfs" { - name = local.dns_st_dfs - resource_group_name = var.rg_name_dns +# DNS zones + +module "local_pdnsz_st_blob" { + source = "../../private-dns-zone" + + rg_name = module.local_rg.name + dns_zones = [local.dns_st_blob] + vnet_id = module.local_vnet.id +} + +module "local_pdnsz_st_dfs" { + source = "../../private-dns-zone" + + rg_name = module.local_rg.name + dns_zones = [local.dns_st_dfs] + vnet_id = module.local_vnet.id +} + +module "local_pdnsz_st_file" { + source = "../../private-dns-zone" + + rg_name = module.local_rg.name + dns_zones = [local.dns_st_file] + vnet_id = module.local_vnet.id } data "http" "ip" { diff --git a/terraform/storage-account/test/variables.tf b/terraform/storage-account/test/variables.tf index fcf7f813..b7908d4b 100644 --- a/terraform/storage-account/test/variables.tf +++ b/terraform/storage-account/test/variables.tf @@ -9,16 +9,6 @@ variable "location" { default = "North Europe" } -variable "rg_name" { - type = string - default = "rg-adl-modules-test-01" -} - -variable "rg_name_dns" { - type = string - default = "rg-adl-modules-test-01-global-dns" -} - variable "is_sec_module" { type = bool description = "Is secure module?" diff --git a/terraform/storage-account/variables.tf b/terraform/storage-account/variables.tf index 63a87dc0..622e6091 100644 --- a/terraform/storage-account/variables.tf +++ b/terraform/storage-account/variables.tf @@ -22,6 +22,7 @@ variable "tags" { variable "module_enabled" { type = bool description = "Variable to enable or disable the module" + default = true } variable "is_sec_module" { @@ -33,6 +34,7 @@ variable "is_sec_module" { variable "subnet_id" { type = string description = "The ID of the subnet from which private IP addresses will be allocated for this Private Endpoint" + default = "" } variable "account_tier" { @@ -92,14 +94,17 @@ variable "min_tls_version" { variable "private_dns_zone_ids_blob" { type = list(string) description = "Specifies the list of Private DNS Zones to include" + default = [] } variable "private_dns_zone_ids_file" { type = list(string) description = "Specifies the list of Private DNS Zones to include" + default = [] } variable "private_dns_zone_ids_dfs" { type = list(string) description = "Specifies the list of Private DNS Zones to include" + default = [] } \ No newline at end of file diff --git a/terraform/subnet-network-security-group-association/test/locals.tf b/terraform/subnet-network-security-group-association/test/locals.tf index 644fba04..aa19983c 100644 --- a/terraform/subnet-network-security-group-association/test/locals.tf +++ b/terraform/subnet-network-security-group-association/test/locals.tf @@ -1,2 +1,7 @@ locals { + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "subnet-network-security-group-association" + Toolkit = "Terraform" + } } \ No newline at end of file diff --git a/terraform/subnet-network-security-group-association/test/main.tf b/terraform/subnet-network-security-group-association/test/providers.tf similarity index 93% rename from terraform/subnet-network-security-group-association/test/main.tf rename to terraform/subnet-network-security-group-association/test/providers.tf index cc1a3def..6018ecae 100644 --- a/terraform/subnet-network-security-group-association/test/main.tf +++ b/terraform/subnet-network-security-group-association/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/subnet-network-security-group-association/test/subnet_network_security_group_association.tf b/terraform/subnet-network-security-group-association/test/subnet_network_security_group_association.tf index dac16a6a..2d95cf14 100644 --- a/terraform/subnet-network-security-group-association/test/subnet_network_security_group_association.tf +++ b/terraform/subnet-network-security-group-association/test/subnet_network_security_group_association.tf @@ -1,16 +1,44 @@ module "subnet_network_security_group_association" { source = "../" - subnet_id = module.local_subnet.id + subnet_id = module.local_snet_default.id network_security_group_id = module.local_network_security_group.id } -# Module dependencies +# Modules dependencies -module "local_subnet" { - source = "../../subnet/test" +module "local_rg" { + source = "../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags +} + +module "local_vnet" { + source = "../../virtual-network" + + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location + + address_space = ["10.0.0.0/16"] +} + +module "local_snet_default" { + source = "../../subnet" + + rg_name = module.local_rg.name + name = "vnet-${random_string.postfix.result}-snet-nsg-association-default" + vnet_name = module.local_vnet.name + address_prefixes = ["10.0.6.0/24"] } module "local_network_security_group" { - source = "../../network-security-group/test" + source = "../../network-security-group" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location } \ No newline at end of file diff --git a/terraform/subnet-network-security-group-association/test/variables.tf b/terraform/subnet-network-security-group-association/test/variables.tf new file mode 100644 index 00000000..b025435b --- /dev/null +++ b/terraform/subnet-network-security-group-association/test/variables.tf @@ -0,0 +1,10 @@ +resource "random_string" "postfix" { + length = 8 + special = false + upper = false +} + +variable "location" { + type = string + default = "North Europe" +} \ No newline at end of file diff --git a/terraform/subnet-network-security-group-association/variables.tf b/terraform/subnet-network-security-group-association/variables.tf index ad4eff13..cf1c66b5 100644 --- a/terraform/subnet-network-security-group-association/variables.tf +++ b/terraform/subnet-network-security-group-association/variables.tf @@ -1,6 +1,6 @@ variable "subnet_id" { type = string - description = "he ID of the Network Security Group which should be associated with the Subnet" + description = "The ID of the Network Security Group which should be associated with the Subnet" } variable "network_security_group_id" { diff --git a/terraform/subnet-route-table-association/test/locals.tf b/terraform/subnet-route-table-association/test/locals.tf index 644fba04..fd615af7 100644 --- a/terraform/subnet-route-table-association/test/locals.tf +++ b/terraform/subnet-route-table-association/test/locals.tf @@ -1,2 +1,7 @@ locals { + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "subnet-route-table-association" + Toolkit = "Terraform" + } } \ No newline at end of file diff --git a/terraform/subnet-route-table-association/test/main.tf b/terraform/subnet-route-table-association/test/providers.tf similarity index 93% rename from terraform/subnet-route-table-association/test/main.tf rename to terraform/subnet-route-table-association/test/providers.tf index 7bf46382..d9832704 100644 --- a/terraform/subnet-route-table-association/test/main.tf +++ b/terraform/subnet-route-table-association/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/subnet-route-table-association/test/subnet_route_table_association.tf b/terraform/subnet-route-table-association/test/subnet_route_table_association.tf index 9ff2afb6..e54e0596 100644 --- a/terraform/subnet-route-table-association/test/subnet_route_table_association.tf +++ b/terraform/subnet-route-table-association/test/subnet_route_table_association.tf @@ -1,16 +1,44 @@ module "subnet_route_table_association" { source = "../" - subnet_id = module.local_subnet.id + subnet_id = module.local_snet_default.id route_table_id = module.local_route_table.id } -# Module dependencies +# Modules dependencies -module "local_subnet" { - source = "../../subnet/test" +module "local_rg" { + source = "../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags +} + +module "local_vnet" { + source = "../../virtual-network" + + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location + + address_space = ["10.0.0.0/16"] +} + +module "local_snet_default" { + source = "../../subnet" + + rg_name = module.local_rg.name + name = "vnet-${random_string.postfix.result}-rt-default" + vnet_name = module.local_vnet.name + address_prefixes = ["10.0.6.0/24"] } module "local_route_table" { - source = "../../route-table/test" + source = "../../route-table" + + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location } \ No newline at end of file diff --git a/terraform/subnet-route-table-association/test/variables.tf b/terraform/subnet-route-table-association/test/variables.tf new file mode 100644 index 00000000..b025435b --- /dev/null +++ b/terraform/subnet-route-table-association/test/variables.tf @@ -0,0 +1,10 @@ +resource "random_string" "postfix" { + length = 8 + special = false + upper = false +} + +variable "location" { + type = string + default = "North Europe" +} \ No newline at end of file diff --git a/terraform/subnet/main.tf b/terraform/subnet/main.tf index 4245769c..99444000 100644 --- a/terraform/subnet/main.tf +++ b/terraform/subnet/main.tf @@ -6,8 +6,8 @@ resource "azurerm_subnet" "adl_snet" { virtual_network_name = var.vnet_name address_prefixes = var.address_prefixes - enforce_private_link_endpoint_network_policies = var.enforce_private_link_endpoint_network_policies - enforce_private_link_service_network_policies = var.enforce_private_link_service_network_policies + private_endpoint_network_policies_enabled = var.private_endpoint_network_policies_enabled + private_link_service_network_policies_enabled = var.private_link_service_network_policies_enabled service_endpoints = var.service_endpoints service_endpoint_policy_ids = length(var.service_endpoint_policy_ids) > 0 ? var.service_endpoint_policy_ids : null diff --git a/terraform/subnet/outputs.tf b/terraform/subnet/outputs.tf index d2d12f73..70dc5eb4 100644 --- a/terraform/subnet/outputs.tf +++ b/terraform/subnet/outputs.tf @@ -1,3 +1,7 @@ output "id" { value = azurerm_subnet.adl_snet.id +} + +output "name" { + value = azurerm_subnet.adl_snet.name } \ No newline at end of file diff --git a/terraform/subnet/test/locals.tf b/terraform/subnet/test/locals.tf index e3181f29..fa05c060 100644 --- a/terraform/subnet/test/locals.tf +++ b/terraform/subnet/test/locals.tf @@ -1,3 +1,7 @@ locals { - vnet_name = "vnet-adl-modules-test" + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "subnet" + Toolkit = "Terraform" + } } \ No newline at end of file diff --git a/terraform/subnet/test/main.tf b/terraform/subnet/test/providers.tf similarity index 92% rename from terraform/subnet/test/main.tf rename to terraform/subnet/test/providers.tf index f08895c1..48abfb46 100644 --- a/terraform/subnet/test/main.tf +++ b/terraform/subnet/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/subnet/test/subnet.tf b/terraform/subnet/test/subnet.tf index d0adf48c..50c41188 100644 --- a/terraform/subnet/test/subnet.tf +++ b/terraform/subnet/test/subnet.tf @@ -1,16 +1,30 @@ module "subnet" { source = "../" - rg_name = var.rg_name + rg_name = module.local_rg.name name = "snet-test" - vnet_name = data.azurerm_virtual_network.vnet_default.name - address_prefixes = ["10.0.3.0/27"] + vnet_name = module.local_vnet.name + address_prefixes = var.address_prefixes } -# Data dependencies +# Modules dependencies -data "azurerm_virtual_network" "vnet_default" { - name = local.vnet_name - resource_group_name = var.rg_name +module "local_rg" { + source = "../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags +} + +module "local_vnet" { + source = "../../virtual-network" + + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location + + address_space = ["10.0.0.0/16"] } \ No newline at end of file diff --git a/terraform/subnet/test/variables.tf b/terraform/subnet/test/variables.tf index 9145696c..01e885df 100644 --- a/terraform/subnet/test/variables.tf +++ b/terraform/subnet/test/variables.tf @@ -4,7 +4,13 @@ resource "random_string" "postfix" { upper = false } -variable "rg_name" { +variable "location" { type = string - default = "rg-adl-modules-test-01" + default = "North Europe" +} + +variable "address_prefixes" { + type = list(string) + description = "value" + default = ["10.0.1.0/24"] } \ No newline at end of file diff --git a/terraform/subnet/variables.tf b/terraform/subnet/variables.tf index 01717e1c..7424fc30 100644 --- a/terraform/subnet/variables.tf +++ b/terraform/subnet/variables.tf @@ -24,13 +24,13 @@ variable "address_prefixes" { description = "value" } -variable "enforce_private_link_endpoint_network_policies" { +variable "private_endpoint_network_policies_enabled" { type = bool description = "value" default = false } -variable "enforce_private_link_service_network_policies" { +variable "private_link_service_network_policies_enabled" { type = bool description = "value" default = false diff --git a/terraform/synapse/synapse-private-link-hub/test/locals.tf b/terraform/synapse/synapse-private-link-hub/test/locals.tf index e29d2a96..17aee73a 100644 --- a/terraform/synapse/synapse-private-link-hub/test/locals.tf +++ b/terraform/synapse/synapse-private-link-hub/test/locals.tf @@ -1,5 +1,9 @@ locals { - snet_name = "snet-adl-modules-test-default" - vnet_name = "vnet-adl-modules-test" + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "synapse-private-link-hub" + Toolkit = "Terraform" + } + dns_syn_web = "privatelink.azuresynapse.net" } \ No newline at end of file diff --git a/terraform/synapse/synapse-private-link-hub/test/main.tf b/terraform/synapse/synapse-private-link-hub/test/providers.tf similarity index 93% rename from terraform/synapse/synapse-private-link-hub/test/main.tf rename to terraform/synapse/synapse-private-link-hub/test/providers.tf index 1b33de35..6d450469 100644 --- a/terraform/synapse/synapse-private-link-hub/test/main.tf +++ b/terraform/synapse/synapse-private-link-hub/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/synapse/synapse-private-link-hub/test/synapse_private_link_hub.tf b/terraform/synapse/synapse-private-link-hub/test/synapse_private_link_hub.tf index 3594cad1..bd14b04b 100644 --- a/terraform/synapse/synapse-private-link-hub/test/synapse_private_link_hub.tf +++ b/terraform/synapse/synapse-private-link-hub/test/synapse_private_link_hub.tf @@ -2,26 +2,51 @@ module "synapse_private_link_hub" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location - subnet_id = data.azurerm_subnet.snet_default.id - private_dns_zone_ids = [data.azurerm_private_dns_zone.syn_web.id] - - module_enabled = true + subnet_id = module.local_snet_default.id + private_dns_zone_ids = [module.local_pdnsz_syn_web.list[local.dns_syn_web].id] tags = {} } -# Data dependencies +# Module dependencies + +module "local_rg" { + source = "../../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags +} + +module "local_vnet" { + source = "../../../virtual-network" -data "azurerm_subnet" "snet_default" { - name = local.snet_name - virtual_network_name = local.vnet_name - resource_group_name = var.rg_name + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location + + address_space = ["10.0.0.0/16"] +} + +module "local_snet_default" { + source = "../../../subnet" + + rg_name = module.local_rg.name + name = "vnet-${random_string.postfix.result}-syn-default" + vnet_name = module.local_vnet.name + address_prefixes = ["10.0.6.0/24"] } -data "azurerm_private_dns_zone" "syn_web" { - name = local.dns_syn_web - resource_group_name = var.rg_name_dns +# DNS zones + +module "local_pdnsz_syn_web" { + source = "../../../private-dns-zone" + + rg_name = module.local_rg.name + dns_zones = [local.dns_syn_web] + vnet_id = module.local_vnet.id } \ No newline at end of file diff --git a/terraform/synapse/synapse-private-link-hub/test/variables.tf b/terraform/synapse/synapse-private-link-hub/test/variables.tf index c2d60718..b025435b 100644 --- a/terraform/synapse/synapse-private-link-hub/test/variables.tf +++ b/terraform/synapse/synapse-private-link-hub/test/variables.tf @@ -7,14 +7,4 @@ resource "random_string" "postfix" { variable "location" { type = string default = "North Europe" -} - -variable "rg_name" { - type = string - default = "rg-adl-modules-test-01" -} - -variable "rg_name_dns" { - type = string - default = "rg-adl-modules-test-01-global-dns" } \ No newline at end of file diff --git a/terraform/synapse/synapse-private-link-hub/variables.tf b/terraform/synapse/synapse-private-link-hub/variables.tf index f869d43f..bd820c28 100644 --- a/terraform/synapse/synapse-private-link-hub/variables.tf +++ b/terraform/synapse/synapse-private-link-hub/variables.tf @@ -22,6 +22,7 @@ variable "tags" { variable "module_enabled" { type = bool description = "Variable to enable or disable the module" + default = true } variable "subnet_id" { diff --git a/terraform/synapse/synapse-spark-pool/test/locals.tf b/terraform/synapse/synapse-spark-pool/test/locals.tf index cee46446..a9f79b1a 100644 --- a/terraform/synapse/synapse-spark-pool/test/locals.tf +++ b/terraform/synapse/synapse-spark-pool/test/locals.tf @@ -1,3 +1,7 @@ locals { - syn_name = "syn-adl-modules-test" + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "synapse-spark-pool" + Toolkit = "Terraform" + } } \ No newline at end of file diff --git a/terraform/synapse/synapse-spark-pool/test/main.tf b/terraform/synapse/synapse-spark-pool/test/providers.tf similarity index 93% rename from terraform/synapse/synapse-spark-pool/test/main.tf rename to terraform/synapse/synapse-spark-pool/test/providers.tf index 004655bc..0be34e05 100644 --- a/terraform/synapse/synapse-spark-pool/test/main.tf +++ b/terraform/synapse/synapse-spark-pool/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/synapse/synapse-spark-pool/test/synapse_spark_pool.tf b/terraform/synapse/synapse-spark-pool/test/synapse_spark_pool.tf index b2d7895f..30670759 100644 --- a/terraform/synapse/synapse-spark-pool/test/synapse_spark_pool.tf +++ b/terraform/synapse/synapse-spark-pool/test/synapse_spark_pool.tf @@ -2,14 +2,51 @@ module "synapse_spark_pool" { source = "../" basename = random_string.postfix.result - synapse_workspace_id = data.azurerm_synapse_workspace.syn_default.id + synapse_workspace_id = module.local_synapse_workspace.id +} + +# Module dependencies + +module "local_rg" { + source = "../../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags +} + +module "local_synapse_workspace" { + source = "../../synapse-workspace" - module_enabled = true + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location + + adls_id = module.local_storage_account.adls_id + storage_account_id = module.local_storage_account.id + storage_account_name = module.local_storage_account.name + + synadmin_username = var.synadmin_username + synadmin_password = var.synadmin_password + + set_aad_login = false + is_sec_module = false + + tags = {} } -# Data dependencies +# Storage Account + +module "local_storage_account" { + source = "../../../storage-account" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location + + hns_enabled = true + firewall_default_action = "Allow" -data "azurerm_synapse_workspace" "syn_default" { - name = local.syn_name - resource_group_name = var.rg_name + is_sec_module = false } \ No newline at end of file diff --git a/terraform/synapse/synapse-spark-pool/test/variables.tf b/terraform/synapse/synapse-spark-pool/test/variables.tf index 9145696c..7763c9b4 100644 --- a/terraform/synapse/synapse-spark-pool/test/variables.tf +++ b/terraform/synapse/synapse-spark-pool/test/variables.tf @@ -4,7 +4,17 @@ resource "random_string" "postfix" { upper = false } -variable "rg_name" { +variable "location" { type = string - default = "rg-adl-modules-test-01" + default = "North Europe" +} + +variable "synadmin_username" { + type = string + default = "sqladminuser" +} + +variable "synadmin_password" { + type = string + default = "ThisIsNotVerySecure!" } \ No newline at end of file diff --git a/terraform/synapse/synapse-spark-pool/variables.tf b/terraform/synapse/synapse-spark-pool/variables.tf index 4e810922..26f748e9 100644 --- a/terraform/synapse/synapse-spark-pool/variables.tf +++ b/terraform/synapse/synapse-spark-pool/variables.tf @@ -23,4 +23,5 @@ variable "node_size" { variable "module_enabled" { type = bool description = "Variable to enable or disable Synapse Spark pool deployment" + default = true } diff --git a/terraform/synapse/synapse-sql-pool/test/locals.tf b/terraform/synapse/synapse-sql-pool/test/locals.tf index cee46446..7dfc1696 100644 --- a/terraform/synapse/synapse-sql-pool/test/locals.tf +++ b/terraform/synapse/synapse-sql-pool/test/locals.tf @@ -1,3 +1,7 @@ locals { - syn_name = "syn-adl-modules-test" + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "synapse-sql-pool" + Toolkit = "Terraform" + } } \ No newline at end of file diff --git a/terraform/synapse/synapse-sql-pool/test/main.tf b/terraform/synapse/synapse-sql-pool/test/providers.tf similarity index 93% rename from terraform/synapse/synapse-sql-pool/test/main.tf rename to terraform/synapse/synapse-sql-pool/test/providers.tf index a4d9be81..c7ae8c0b 100644 --- a/terraform/synapse/synapse-sql-pool/test/main.tf +++ b/terraform/synapse/synapse-sql-pool/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/synapse/synapse-sql-pool/test/synapse_sql_pool.tf b/terraform/synapse/synapse-sql-pool/test/synapse_sql_pool.tf index c444b550..c09fc6fc 100644 --- a/terraform/synapse/synapse-sql-pool/test/synapse_sql_pool.tf +++ b/terraform/synapse/synapse-sql-pool/test/synapse_sql_pool.tf @@ -2,14 +2,51 @@ module "synapse_sql_pool" { source = "../" basename = random_string.postfix.result - synapse_workspace_id = data.azurerm_synapse_workspace.syn_default.id + synapse_workspace_id = module.local_synapse_workspace.id +} + +# Module dependencies + +module "local_rg" { + source = "../../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags +} + +module "local_synapse_workspace" { + source = "../../synapse-workspace" - module_enabled = true + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location + + adls_id = module.local_storage_account.adls_id + storage_account_id = module.local_storage_account.id + storage_account_name = module.local_storage_account.name + + synadmin_username = var.synadmin_username + synadmin_password = var.synadmin_password + + set_aad_login = false + is_sec_module = false + + tags = {} } -# Data dependencies +# Storage Account + +module "local_storage_account" { + source = "../../../storage-account" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location + + hns_enabled = true + firewall_default_action = "Allow" -data "azurerm_synapse_workspace" "syn_default" { - name = local.syn_name - resource_group_name = var.rg_name + is_sec_module = false } \ No newline at end of file diff --git a/terraform/synapse/synapse-sql-pool/test/variables.tf b/terraform/synapse/synapse-sql-pool/test/variables.tf index 9145696c..7763c9b4 100644 --- a/terraform/synapse/synapse-sql-pool/test/variables.tf +++ b/terraform/synapse/synapse-sql-pool/test/variables.tf @@ -4,7 +4,17 @@ resource "random_string" "postfix" { upper = false } -variable "rg_name" { +variable "location" { type = string - default = "rg-adl-modules-test-01" + default = "North Europe" +} + +variable "synadmin_username" { + type = string + default = "sqladminuser" +} + +variable "synadmin_password" { + type = string + default = "ThisIsNotVerySecure!" } \ No newline at end of file diff --git a/terraform/synapse/synapse-sql-pool/variables.tf b/terraform/synapse/synapse-sql-pool/variables.tf index 582136a2..26dd45b7 100644 --- a/terraform/synapse/synapse-sql-pool/variables.tf +++ b/terraform/synapse/synapse-sql-pool/variables.tf @@ -23,5 +23,5 @@ variable "create_mode" { variable "module_enabled" { type = bool description = "Variable to enable or disable Synapse Dedicated SQL pool deployment" - default = false + default = true } \ No newline at end of file diff --git a/terraform/synapse/synapse-workspace/main.tf b/terraform/synapse/synapse-workspace/main.tf index 781eb42e..cfe1223a 100644 --- a/terraform/synapse/synapse-workspace/main.tf +++ b/terraform/synapse/synapse-workspace/main.tf @@ -18,13 +18,7 @@ resource "azurerm_synapse_workspace" "adl_syn" { managed_virtual_network_enabled = var.is_sec_module ? true : false managed_resource_group_name = "${var.rg_name}-syn-managed" - public_network_access_enabled = var.is_sec_module ? false : true - - aad_admin { - login = var.aad_login.name - object_id = var.aad_login.object_id - tenant_id = var.aad_login.tenant_id - } + public_network_access_enabled = true identity { type = "SystemAssigned" @@ -35,13 +29,24 @@ resource "azurerm_synapse_workspace" "adl_syn" { tags = var.tags } +# AAD login + +resource "azurerm_synapse_workspace_aad_admin" "syn_aad_login" { + synapse_workspace_id = azurerm_synapse_workspace.adl_syn[0].id + login = "AzureAD Admin" + object_id = var.aad_login.object_id + tenant_id = var.aad_login.tenant_id + + count = var.set_aad_login ? 1 : 0 +} + # Virtual Network & Firewall configuration resource "azurerm_synapse_firewall_rule" "allow_my_ip" { name = "AllowAll" synapse_workspace_id = azurerm_synapse_workspace.adl_syn[0].id - start_ip_address = var.is_sec_module ? data.http.ip.body : "0.0.0.0" - end_ip_address = var.is_sec_module ? data.http.ip.body : "255.255.255.255" + start_ip_address = var.is_sec_module ? data.http.ip.response_body : "0.0.0.0" + end_ip_address = var.is_sec_module ? data.http.ip.response_body : "255.255.255.255" count = var.module_enabled ? 1 : 0 } @@ -140,7 +145,7 @@ resource "azurerm_synapse_role_assignment" "syn_ws_role_default_user" { role_name = "Synapse Administrator" principal_id = var.aad_login.object_id - count = var.module_enabled ? 1 : 0 + count = var.module_enabled && var.set_aad_login ? 1 : 0 depends_on = [time_sleep.wait_40_seconds] } diff --git a/terraform/synapse/synapse-workspace/test/locals.tf b/terraform/synapse/synapse-workspace/test/locals.tf index 08147340..40072f37 100644 --- a/terraform/synapse/synapse-workspace/test/locals.tf +++ b/terraform/synapse/synapse-workspace/test/locals.tf @@ -1,6 +1,12 @@ locals { - snet_name = "snet-adl-modules-test-default" - vnet_name = "vnet-adl-modules-test" + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "synapse-workspace" + Toolkit = "Terraform" + } + + dns_st_blob = "privatelink.blob.core.windows.net" + dns_st_dfs = "privatelink.dfs.core.windows.net" dns_syn_sql = "privatelink.sql.azuresynapse.net" dns_syn_dev = "privatelink.dev.azuresynapse.net" } \ No newline at end of file diff --git a/terraform/synapse/synapse-workspace/test/main.tf b/terraform/synapse/synapse-workspace/test/providers.tf similarity index 93% rename from terraform/synapse/synapse-workspace/test/main.tf rename to terraform/synapse/synapse-workspace/test/providers.tf index 8da32b64..a2d68c17 100644 --- a/terraform/synapse/synapse-workspace/test/main.tf +++ b/terraform/synapse/synapse-workspace/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/synapse/synapse-workspace/test/synapse_workspace.tf b/terraform/synapse/synapse-workspace/test/synapse_workspace.tf index e5aa6abf..7f310ec1 100644 --- a/terraform/synapse/synapse-workspace/test/synapse_workspace.tf +++ b/terraform/synapse/synapse-workspace/test/synapse_workspace.tf @@ -2,59 +2,111 @@ module "synapse_workspace" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location - subnet_id = data.azurerm_subnet.snet_default.id - private_dns_zone_ids_sql = [data.azurerm_private_dns_zone.syn_sql.id] - private_dns_zone_ids_dev = [data.azurerm_private_dns_zone.syn_dev.id] - - adls_id = module.local_storage_account.adls_id + subnet_id = module.local_snet_default.id + private_dns_zone_ids_sql = [module.local_pdnsz_syn_sql.list[local.dns_syn_sql].id] + private_dns_zone_ids_dev = [module.local_pdnsz_syn_dev.list[local.dns_syn_dev].id] + adls_id = module.local_storage_account.adls_id storage_account_id = module.local_storage_account.id storage_account_name = module.local_storage_account.name - key_vault_id = module.local_key_vault.id - key_vault_name = module.local_key_vault.name - synadmin_username = var.synadmin_username synadmin_password = var.synadmin_password - aad_login = { - name = var.aad_login.name - object_id = var.aad_login.object_id - tenant_id = var.aad_login.tenant_id - } - - module_enabled = true + set_aad_login = false + is_sec_module = true tags = {} } -# Data dependencies +# Module dependencies + +module "local_rg" { + source = "../../../resource-group" -data "azurerm_subnet" "snet_default" { - name = local.snet_name - virtual_network_name = local.vnet_name - resource_group_name = var.rg_name + basename = random_string.postfix.result + location = var.location + + tags = local.tags } -data "azurerm_private_dns_zone" "syn_sql" { - name = local.dns_syn_sql - resource_group_name = var.rg_name_dns +module "local_storage_account" { + source = "../../../storage-account" + + basename = random_string.postfix.result + rg_name = module.local_rg.name + location = var.location + + subnet_id = module.local_snet_default.id + private_dns_zone_ids_blob = [module.local_pdnsz_st_blob.list[local.dns_st_blob].id] + private_dns_zone_ids_dfs = [module.local_pdnsz_st_dfs.list[local.dns_st_dfs].id] + + hns_enabled = true + firewall_default_action = "Allow" + firewall_ip_rules = [data.http.ip.response_body] + firewall_bypass = ["AzureServices"] + + is_sec_module = true } -data "azurerm_private_dns_zone" "syn_dev" { - name = local.dns_syn_dev - resource_group_name = var.rg_name_dns +data "http" "ip" { + url = "https://ifconfig.me" } -# Module dependencies +# Network Configuration -module "local_storage_account" { - source = "../../../storage-account/test" +module "local_vnet" { + source = "../../../virtual-network" + + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location + + address_space = ["10.0.0.0/16"] } -module "local_key_vault" { - source = "../../../key-vault/test" +module "local_snet_default" { + source = "../../../subnet" + + rg_name = module.local_rg.name + name = "vnet-${random_string.postfix.result}-syn-default" + vnet_name = module.local_vnet.name + address_prefixes = ["10.0.6.0/24"] +} + +# DNS zones + +module "local_pdnsz_st_blob" { + source = "../../../private-dns-zone" + + rg_name = module.local_rg.name + dns_zones = [local.dns_st_blob] + vnet_id = module.local_vnet.id +} + +module "local_pdnsz_st_dfs" { + source = "../../../private-dns-zone" + + rg_name = module.local_rg.name + dns_zones = [local.dns_st_dfs] + vnet_id = module.local_vnet.id +} + +module "local_pdnsz_syn_sql" { + source = "../../../private-dns-zone" + + rg_name = module.local_rg.name + dns_zones = [local.dns_syn_sql] + vnet_id = module.local_vnet.id +} + +module "local_pdnsz_syn_dev" { + source = "../../../private-dns-zone" + + rg_name = module.local_rg.name + dns_zones = [local.dns_syn_dev] + vnet_id = module.local_vnet.id } \ No newline at end of file diff --git a/terraform/synapse/synapse-workspace/test/variables.tf b/terraform/synapse/synapse-workspace/test/variables.tf index 8ae502fa..7763c9b4 100644 --- a/terraform/synapse/synapse-workspace/test/variables.tf +++ b/terraform/synapse/synapse-workspace/test/variables.tf @@ -9,16 +9,6 @@ variable "location" { default = "North Europe" } -variable "rg_name" { - type = string - default = "rg-adl-modules-test-01" -} - -variable "rg_name_dns" { - type = string - default = "rg-adl-modules-test-01-global-dns" -} - variable "synadmin_username" { type = string default = "sqladminuser" @@ -27,17 +17,4 @@ variable "synadmin_username" { variable "synadmin_password" { type = string default = "ThisIsNotVerySecure!" -} - -variable "aad_login" { - type = object({ - name = string - object_id = string - tenant_id = string - }) - default = { - name = "AzureAD Admin" - object_id = "00000000-0000-0000-0000-000000000000" - tenant_id = "00000000-0000-0000-0000-000000000000" - } } \ No newline at end of file diff --git a/terraform/synapse/synapse-workspace/variables.tf b/terraform/synapse/synapse-workspace/variables.tf index 62309cfe..1424baf5 100644 --- a/terraform/synapse/synapse-workspace/variables.tf +++ b/terraform/synapse/synapse-workspace/variables.tf @@ -22,6 +22,7 @@ variable "tags" { variable "module_enabled" { type = bool description = "Variable to enable or disable the module" + default = true } variable "is_sec_module" { @@ -33,6 +34,7 @@ variable "is_sec_module" { variable "subnet_id" { type = string description = "The ID of the subnet from which private IP addresses will be allocated for this Private Endpoint" + default = "" } variable "adls_id" { @@ -50,16 +52,6 @@ variable "storage_account_name" { description = "The name of the storage account associated with the syn workspace" } -variable "key_vault_id" { - type = string - description = "The ID of the key vault associated with the syn workspace" -} - -variable "key_vault_name" { - type = string - description = "The name of the key vault associated with the syn workspace" -} - variable "synadmin_username" { type = string description = "The Login Name of the SQL administrator" @@ -70,6 +62,11 @@ variable "synadmin_password" { description = "The Password associated with the sql_administrator_login for the SQL administrator" } +variable "set_aad_login" { + type = bool + default = false +} + variable "aad_login" { description = "AAD login" type = object({ @@ -87,9 +84,11 @@ variable "aad_login" { variable "private_dns_zone_ids_sql" { type = list(string) description = "Specifies the list of Private DNS Zones to include" + default = [] } variable "private_dns_zone_ids_dev" { type = list(string) description = "Specifies the list of Private DNS Zones to include" + default = [] } \ No newline at end of file diff --git a/terraform/user-assigned-identity/test/locals.tf b/terraform/user-assigned-identity/test/locals.tf new file mode 100644 index 00000000..3c789d86 --- /dev/null +++ b/terraform/user-assigned-identity/test/locals.tf @@ -0,0 +1,7 @@ +locals { + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "user-assigned-identity" + Toolkit = "Terraform" + } +} \ No newline at end of file diff --git a/terraform/user-assigned-identity/test/main.tf b/terraform/user-assigned-identity/test/providers.tf similarity index 93% rename from terraform/user-assigned-identity/test/main.tf rename to terraform/user-assigned-identity/test/providers.tf index 04f19e8f..faed0bbb 100644 --- a/terraform/user-assigned-identity/test/main.tf +++ b/terraform/user-assigned-identity/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/user-assigned-identity/test/user_assigned_identity.tf b/terraform/user-assigned-identity/test/user_assigned_identity.tf index 27d9197e..953ff908 100644 --- a/terraform/user-assigned-identity/test/user_assigned_identity.tf +++ b/terraform/user-assigned-identity/test/user_assigned_identity.tf @@ -2,8 +2,19 @@ module "user_assigned_identity" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location tags = {} +} + +# Modules dependencies + +module "local_rg" { + source = "../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags } \ No newline at end of file diff --git a/terraform/user-assigned-identity/test/variables.tf b/terraform/user-assigned-identity/test/variables.tf index edf7f3e0..b025435b 100644 --- a/terraform/user-assigned-identity/test/variables.tf +++ b/terraform/user-assigned-identity/test/variables.tf @@ -7,9 +7,4 @@ resource "random_string" "postfix" { variable "location" { type = string default = "North Europe" -} - -variable "rg_name" { - type = string - default = "rg-adl-modules-test-01" } \ No newline at end of file diff --git a/terraform/virtual-machine/test/locals.tf b/terraform/virtual-machine/test/locals.tf index cb89cf14..520d4e8b 100644 --- a/terraform/virtual-machine/test/locals.tf +++ b/terraform/virtual-machine/test/locals.tf @@ -1,4 +1,7 @@ locals { - snet_name = "snet-adl-modules-test-default" - vnet_name = "vnet-adl-modules-test" + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "virtual-machine" + Toolkit = "Terraform" + } } \ No newline at end of file diff --git a/terraform/virtual-machine/test/main.tf b/terraform/virtual-machine/test/providers.tf similarity index 93% rename from terraform/virtual-machine/test/main.tf rename to terraform/virtual-machine/test/providers.tf index 9c66a525..eb18b5f8 100644 --- a/terraform/virtual-machine/test/main.tf +++ b/terraform/virtual-machine/test/providers.tf @@ -9,7 +9,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } diff --git a/terraform/virtual-machine/test/variables.tf b/terraform/virtual-machine/test/variables.tf index 29e21027..8b36ebcf 100644 --- a/terraform/virtual-machine/test/variables.tf +++ b/terraform/virtual-machine/test/variables.tf @@ -9,11 +9,6 @@ variable "location" { default = "North Europe" } -variable "rg_name" { - type = string - default = "rg-adl-modules-test-01" -} - variable "jumphost_username" { type = string description = "VM username" diff --git a/terraform/virtual-machine/test/virtual_machine.tf b/terraform/virtual-machine/test/virtual_machine.tf index b35783b8..26c56dca 100644 --- a/terraform/virtual-machine/test/virtual_machine.tf +++ b/terraform/virtual-machine/test/virtual_machine.tf @@ -2,24 +2,43 @@ module "virtual_machine" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location - subnet_id = data.azurerm_subnet.snet_default.id + subnet_id = module.local_snet_default.id jumphost_username = var.jumphost_username jumphost_password = var.jumphost_password - module_enabled = true - tags = {} } -# Data dependencies +# Module dependencies + +module "local_rg" { + source = "../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags +} + +module "local_vnet" { + source = "../../virtual-network" + + rg_name = module.local_rg.name + basename = random_string.postfix.result + location = var.location -data "azurerm_subnet" "snet_default" { - name = local.snet_name - virtual_network_name = local.vnet_name - resource_group_name = var.rg_name + address_space = ["10.0.0.0/16"] } +module "local_snet_default" { + source = "../../subnet" + + rg_name = module.local_rg.name + name = "vnet-${random_string.postfix.result}-vm-default" + vnet_name = module.local_vnet.name + address_prefixes = ["10.0.6.0/24"] +} \ No newline at end of file diff --git a/terraform/virtual-machine/variables.tf b/terraform/virtual-machine/variables.tf index 370cc984..7612a1bf 100644 --- a/terraform/virtual-machine/variables.tf +++ b/terraform/virtual-machine/variables.tf @@ -22,6 +22,7 @@ variable "tags" { variable "module_enabled" { type = bool description = "Variable to enable or disable the module" + default = true } variable "jumphost_username" { diff --git a/terraform/virtual-network/main.tf b/terraform/virtual-network/main.tf index 2d1fbb90..15ee423a 100644 --- a/terraform/virtual-network/main.tf +++ b/terraform/virtual-network/main.tf @@ -2,9 +2,19 @@ resource "azurerm_virtual_network" "adl_vnet" { name = "vnet-${var.basename}" - address_space = var.address_space location = var.location resource_group_name = var.rg_name + address_space = var.address_space + dns_servers = var.dns_servers + + dynamic "ddos_protection_plan" { + for_each = var.ddos_protection_plan + content { + id = lookup(ddos_protection_plan.value, "id", null) + enable = lookup(ddos_protection_plan.value, "enable", false) + } + } + tags = var.tags } \ No newline at end of file diff --git a/terraform/virtual-network/test/locals.tf b/terraform/virtual-network/test/locals.tf new file mode 100644 index 00000000..fd875c2b --- /dev/null +++ b/terraform/virtual-network/test/locals.tf @@ -0,0 +1,7 @@ +locals { + tags = { + Project = "Azure/azure-data-labs-modules" + Module = "virtual-network" + Toolkit = "Terraform" + } +} \ No newline at end of file diff --git a/terraform/virtual-network/test/main.tf b/terraform/virtual-network/test/providers.tf similarity index 92% rename from terraform/virtual-network/test/main.tf rename to terraform/virtual-network/test/providers.tf index 5cadeb1e..e99c0aae 100644 --- a/terraform/virtual-network/test/main.tf +++ b/terraform/virtual-network/test/providers.tf @@ -9,11 +9,12 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "= 3.31.0" + version = "= 3.32.0" } } } + provider "azurerm" { features {} } \ No newline at end of file diff --git a/terraform/virtual-network/test/variables.tf b/terraform/virtual-network/test/variables.tf index edf7f3e0..b025435b 100644 --- a/terraform/virtual-network/test/variables.tf +++ b/terraform/virtual-network/test/variables.tf @@ -7,9 +7,4 @@ resource "random_string" "postfix" { variable "location" { type = string default = "North Europe" -} - -variable "rg_name" { - type = string - default = "rg-adl-modules-test-01" } \ No newline at end of file diff --git a/terraform/virtual-network/test/virtual_network.tf b/terraform/virtual-network/test/virtual_network.tf index 6e7d754a..b7f098b2 100644 --- a/terraform/virtual-network/test/virtual_network.tf +++ b/terraform/virtual-network/test/virtual_network.tf @@ -2,10 +2,21 @@ module "virtual_network" { source = "../" basename = random_string.postfix.result - rg_name = var.rg_name + rg_name = module.local_rg.name location = var.location address_space = ["10.0.0.0/16"] - tags = {} + tags = local.tags +} + +# Module dependencies + +module "local_rg" { + source = "../../resource-group" + + basename = random_string.postfix.result + location = var.location + + tags = local.tags } \ No newline at end of file diff --git a/terraform/virtual-network/variables.tf b/terraform/virtual-network/variables.tf index 5280257c..70c363b8 100644 --- a/terraform/virtual-network/variables.tf +++ b/terraform/virtual-network/variables.tf @@ -22,4 +22,16 @@ variable "tags" { variable "address_space" { type = list(string) description = "The address space that is used the virtual network" +} + +variable "dns_servers" { + description = "List of dns servers to use for virtual network" + type = list(string) + default = [] +} + +variable "ddos_protection_plan" { + description = "A ddos_protection_plan id " + type = map(string) + default = {} } \ No newline at end of file