Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"makefile.extensionOutputFolder": "./.vscode"
}
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export GENIE_PATH ?= $(shell 'pwd')/../../../genie
include $(GENIE_PATH)/Makefile
136 changes: 135 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,135 @@
# terraform-module-template
<!-- This file was automatically generated by the `geine`. Make all changes to `README.yaml` and run `make readme` to rebuild this file. -->


<h1 align="center">
Terraform AZURE VIRTUAL-NETWORK
</h1>

<p align="center" style="font-size: 1.2rem;">
Terraform module to create VIRTUAL-NETWORK resource on AZURE.
</p>

<p align="center">

<a href="https://www.terraform.io">
<img src="https://img.shields.io/badge/Terraform-v1.0.0-green" alt="Terraform">
</a>
<a href="LICENSE.md">
<img src="https://img.shields.io/badge/License-APACHE-blue.svg" alt="Licence">
</a>


</p>
<p align="center">

<a href='https://facebook.com/sharer/sharer.php?u=https://github.com/clouddrove/terraform-azure-virtual-network'>
<img title="Share on Facebook" src="https://user-images.githubusercontent.com/50652676/62817743-4f64cb80-bb59-11e9-90c7-b057252ded50.png" />
</a>
<a href='https://www.linkedin.com/shareArticle?mini=true&title=Terraform+AZURE+VIRTUAL-NETWORK&url=https://github.com/clouddrove/terraform-azure-virtual-network'>
<img title="Share on LinkedIn" src="https://user-images.githubusercontent.com/50652676/62817742-4e339e80-bb59-11e9-87b9-a1f68cae1049.png" />
</a>
<a href='https://twitter.com/intent/tweet/?text=Terraform+AZURE+VIRTUAL-NETWORK&url=https://github.com/clouddrove/terraform-azure-virtual-network'>
<img title="Share on Twitter" src="https://user-images.githubusercontent.com/50652676/62817740-4c69db00-bb59-11e9-8a79-3580fbbf6d5c.png" />
</a>

</p>
<hr>





## Prerequisites

This module has a few dependencies:








**IMPORTANT:** Since the `master` branch used in `source` varies based on new modifications, we suggest that you use the release versions [here](https://github.com/clouddrove/terraform-azure-virtual-network/releases).


### Simple Example
Here is an example of how you can use this module in your inventory structure:
```hcl
module "virtual-network" {
source = "clouddrove/virtual-network/azure"
environment = "test"
label_order = ["name", "environment"]
name = "example"
resource_group_name = module.resource_group.resource_group_name
location = module.resource_group.resource_group_location
address_space = "10.0.0.0/16"
subnet_names = ["subnet1"]
subnet_prefixes = ["10.0.1.0/24"]
enable_ddos_pp = true
}
```






## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| address\_space | The address space that is used by the virtual network. | `string` | `""` | no |
| address\_spaces | The list of the address spaces that is used by the virtual network. | `list(string)` | `[]` | no |
| attributes | Additional attributes (e.g. `1`). | `list(any)` | `[]` | no |
| delimiter | Delimiter to be used between `organization`, `environment`, `name` and `attributes`. | `string` | `"-"` | no |
| dns\_servers | The DNS servers to be used with vNet. | `list(string)` | `[]` | no |
| enable | Flag to control the module creation | `bool` | `true` | no |
| enable\_ddos\_pp | Flag to control the resource creation | `bool` | `false` | no |
| environment | Environment (e.g. `prod`, `dev`, `staging`). | `string` | `""` | no |
| label\_order | Label order, e.g. `name`,`application`. | `list(any)` | `[]` | no |
| location | The location/region where the virtual network is created. Changing this forces a new resource to be created. | `string` | `""` | no |
| managedby | ManagedBy, eg 'CloudDrove'. | `string` | `"[email protected]"` | no |
| name | Name (e.g. `app` or `cluster`). | `string` | `""` | no |
| repository | Terraform current module repo | `string` | `"https://github.com/clouddrove/terraform-azure-virtual-network"` | no |
| resource\_group\_name | The name of an existing resource group to be imported. | `string` | `""` | no |
| subnet\_enforce\_private\_link\_endpoint\_network\_policies | A map with key (string) `subnet name`, value (bool) `true` or `false` to indicate enable or disable network policies for the private link endpoint on the subnet. Default value is false. | `map(bool)` | `{}` | no |
| subnet\_names | A list of public subnets inside the vNet. | `list(string)` | `[]` | no |
| subnet\_prefixes | The address prefix to use for the subnet. | `list(string)` | `[]` | no |
| subnet\_service\_endpoints | A map with key (string) `subnet name`, value (list(string)) to indicate enabled service endpoints on the subnet. Default value is []. | `map(list(string))` | `{}` | no |
| tags | Additional tags (e.g. map(`BusinessUnit`,`XYZ`). | `map(any)` | `{}` | no |

## Outputs

| Name | Description |
|------|-------------|
| vnet\_address\_space | The address space of the newly created vNet |
| vnet\_id | The id of the newly created vNet |
| vnet\_location | The location of the newly created vNet |
| vnet\_name | The name of the newly created vNet |
| vnet\_subnets | The ids of subnets created inside the newly created vNet |






## Feedback
If you come accross a bug or have any feedback, please log it in our [issue tracker](https://github.com/clouddrove/terraform-azure-virtual-network/issues), or feel free to drop us an email at [[email protected]](mailto:[email protected]).

If you have found it worth your time, go ahead and give us a ★ on [our GitHub](https://github.com/clouddrove/terraform-azure-virtual-network)!

## About us

At [CloudDrove][website], we offer expert guidance, implementation support and services to help organisations accelerate their journey to the cloud. Our services include docker and container orchestration, cloud migration and adoption, infrastructure automation, application modernisation and remediation, and performance engineering.

<p align="center">We are <b> The Cloud Experts!</b></p>
<hr />
<p align="center">We ❤️ <a href="https://github.com/clouddrove">Open Source</a> and you can check out <a href="https://github.com/clouddrove">our other modules</a> to get help with your new Cloud ideas.</p>

[website]: https://clouddrove.com
[github]: https://github.com/clouddrove
[linkedin]: https://cpco.io/linkedin
[twitter]: https://twitter.com/clouddrove/
[email]: https://clouddrove.com/contact-us.html
[terraform_modules]: https://github.com/clouddrove?utf8=%E2%9C%93&q=terraform-&type=&language=
52 changes: 52 additions & 0 deletions README.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
#
# This is the canonical configuration for the `README.md`
# Run `make readme` to rebuild the `README.md`
#


# Name of this project
name: Terraform AZURE VIRTUAL-NETWORK

# License of this project
license: "APACHE"

# Canonical GitHub repo
github_repo: clouddrove/terraform-azure-virtual-network

# Badges to display
badges:
- name: "Terraform"
image: "https://img.shields.io/badge/Terraform-v1.1.7-green"
url: "https://www.terraform.io"
- name: "Licence"
image: "https://img.shields.io/badge/License-APACHE-blue.svg"
url: "LICENSE.md"

# description of this project
description: |-
Terraform module to create VIRTUAL-NETWORK resource on AZURE.

# extra content
include:
- "terraform.md"

# How to use this project
# yamllint disable rule:line-length
usage: |-
### Simple Example
Here is an example of how you can use this module in your inventory structure:
```hcl
module "virtual-network" {
source = "clouddrove/virtual-network/azure"
environment = "test"
label_order = ["name", "environment"]
name = "example"
resource_group_name = module.resource_group.resource_group_name
location = module.resource_group.resource_group_location
address_space = "10.0.0.0/16"
subnet_names = ["subnet1"]
subnet_prefixes = ["10.0.1.0/24"]
enable_ddos_pp = true
}
```
3 changes: 0 additions & 3 deletions _example/README.md

This file was deleted.

Empty file removed _example/complete/README.md
Empty file.
1 change: 0 additions & 1 deletion _example/complete/main.tf

This file was deleted.

Empty file removed _example/complete/outputs.tf
Empty file.
Empty file.
Empty file removed _example/complete/variables.tf
Empty file.
10 changes: 0 additions & 10 deletions _example/complete/versions.tf

This file was deleted.

24 changes: 24 additions & 0 deletions _example/example.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
provider "azurerm" {
features {}
}

module "resource_group" {
source = "git::https://github.com/clouddrove/terraform-azure-resource-group.git"

name = "testrg"
environment = "test"
label_order = ["environment", "name"]

enabled = true
location = "North Europe"
}

module "log_analytics" {
source = "../"
name = "acctest-01"
location = module.resource_group.resource_group_location
resource_group_name = module.resource_group.resource_group_name
sku = "PerGB2018"
retention_in_days = 30

}
13 changes: 13 additions & 0 deletions _example/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Terraform version
terraform {
required_version = ">= 1.0.0"
}

terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">=2.90.0"
}
}
}
33 changes: 33 additions & 0 deletions _test/virtual_network_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Managed By : CloudDrove
// Description : This Terratest is used to test the Terraform VPC module.
// Copyright @ CloudDrove. All Right Reserved.
package test

import (
"testing"
"github.com/gruntwork-io/terratest/modules/terraform"
"github.com/stretchr/testify/assert"
)

func Test(t *testing.T) {
t.Parallel()

terraformOptions := &terraform.Options{
// Source path of Terraform directory.
TerraformDir: "../_example",
}

// This will run 'terraform init' and 'terraform application' and will fail the test if any errors occur
terraform.InitAndApply(t, terraformOptions)

// To clean up any resources that have been created, run 'terraform destroy' towards the end of the test
defer terraform.Destroy(t, terraformOptions)

// To get the value of an output variable, run 'terraform output'
Id := terraform.Output(t, terraformOptions, "virtual_network_id")
Tags := terraform.OutputMap(t, terraformOptions, "tags")

// Check that we get back the outputs that we expect
assert.Equal(t, "test-clouddrove-virtual-network", Tags["Name"])
assert.Contains(t, Id, "/subscriptions")
}
28 changes: 27 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
@@ -1 +1,27 @@
locals {}
## Managed By : CloudDrove
## Copyright @ CloudDrove. All Right Reserved.

# Module : labels
# Description : Terraform module to create consistent naming for multiple names.

module "labels" {
source = "clouddrove/labels/azure"
version = "1.0.0"

name = var.name
environment = var.environment
managedby = var.managedby
label_order = var.label_order
repository = var.repository
}


resource "azurerm_log_analytics_workspace" "example" {
count = var.enabled && var.log_analytics_enabled ? 1 : 0
name = format("%s-log-analytics", module.labels.id)
location = var.location
resource_group_name = var.resource_group_name
sku = var.sku
retention_in_days = var.retention_in_days

}
Empty file removed outputs.tf
Empty file.
Loading