Skip to content

Commit

Permalink
feat: add type definitions all usages (#34)
Browse files Browse the repository at this point in the history
Co-authored-by: dkool <dkool@dkools-MacBook-Pro.local>
  • Loading branch information
dkooll and dkool authored Dec 6, 2024
1 parent fbacb9e commit 007158c
Show file tree
Hide file tree
Showing 8 changed files with 153 additions and 321 deletions.
86 changes: 8 additions & 78 deletions examples/default/README.md
Original file line number Diff line number Diff line change
@@ -1,83 +1,13 @@
This example illustrates the default recovery services vault setup, in its simplest form.
# Default

## Usage: default
This example illustrates the default setup, in its simplest form.

```hcl
module "rsv" {
source = "cloudnationhq/rsv/azure"
version = "~> 0.5"
vault = {
name = module.naming.recovery_services_vault.name
location = module.rg.groups.demo.location
resourcegroup = module.rg.groups.demo.name
}
}
```

## Usage: multiple

Additionally, for certain scenarios, the example below highlights the ability to use multiple vaults, enabling a broader setup.

```hcl
module "rsv" {
source = "cloudnationhq/rsv/azure"
version = "~> 0.1"
for_each = local.vault
naming = local.naming
vault = each.value
}
```

The module uses a local to iterate, generating a recovery services vault for each key.
## Types

```hcl
locals {
vault = {
vault1 = {
name = "rsv-demo-dev-weu"
location = module.rg.groups.demo.location
resourcegroup = module.rg.groups.demo.name
policies = {
vms = {
weu = {
timezone = "W. Europe Standard Time"
backup = {
frequency = "Daily"
time = "23:00"
}
retention = {
daily = {
count = 7
}
}
}
}
}
}
vault2 = {
name = "rsv-demo-dev-sea"
location = module.rg.groups.demo2.location
resourcegroup = module.rg.groups.demo2.name
policies = {
vms = {
sea = {
timezone = "Singapore Standard Time"
backup = {
frequency = "Daily"
time = "23:00"
}
retention = {
daily = {
count = 7
}
}
}
}
}
}
}
}
vault = object({
name = string
location = string
resource_group = string
})
```
111 changes: 38 additions & 73 deletions examples/policies/README.md
Original file line number Diff line number Diff line change
@@ -1,78 +1,43 @@
This example highlights recovery services vault policies using different types.
# Policies

## Usage: vm
This deploys policies using different types

```hcl
module "rsv" {
source = "cloudnationhq/rsv/azure"
version = "~> 0.5"
naming = local.naming
vault = {
name = module.naming.recovery_services_vault.name
location = module.rg.groups.demo.location
resourcegroup = module.rg.groups.demo.name
policies = {
vms = {
pol1 = {
timezone = "UTC"
backup = {
frequency = "Daily"
time = "23:00"
}
retention = {
daily = {
count = 7
}
}
}
}
}
}
}
```

## Usage: file shares
## Types

```hcl
module "rsv" {
source = "cloudnationhq/rsv/azure"
version = "~> 0.1"
naming = local.naming
vault = {
name = module.naming.recovery_services_vault.name
location = module.rg.groups.demo.location
resourcegroup = module.rg.groups.demo.name
policies = {
file_shares = {
pol1 = {
timezone = "UTC"
backup = {
frequency = "Daily"
time = "23:00"
}
retention = {
daily = {
count = 3
}
weekly = {
count = 2
weekdays = ["Monday", "Tuesday"]
}
monthly = {
count = 1
weekdays = ["Monday"]
weeks = ["First"]
}
}
}
}
}
}
}
vault = object({
name = string
location = string
resource_group = string
policies = optional(object({
file_shares = optional(map(object({
name = optional(string)
timezone = optional(string)
backup = object({
frequency = string
time = string
})
retention = object({
daily = object({
count = number
})
weekly = optional(object({
count = number
weekdays = list(string)
}))
monthly = optional(object({
count = number
weekdays = list(string)
weeks = list(string)
}))
yearly = optional(object({
count = number
weekdays = list(string)
weeks = list(string)
months = list(string)
}))
})
})))
}))
})
```
61 changes: 12 additions & 49 deletions examples/private-endpoint/README.md
Original file line number Diff line number Diff line change
@@ -1,54 +1,17 @@
This example details a recovery services vault setup with a private endpoint, enhancing security by restricting data access to a private network.
# Private Endpoint

## Usage: private endpoint
This deploys private endpoints

```hcl
module "privatelink" {
source = "cloudnationhq/pe/azure"
version = "~> 0.5"
resourcegroup = module.rg.groups.demo.name
location = module.rg.groups.demo.location
endpoints = local.endpoints
}
```

The module uses the below locals for configuration:
## Types

```hcl
locals {
endpoints = {
vault = {
name = module.naming.private_endpoint.name
subnet_id = module.network.subnets.sn1.id
private_connection_resource_id = module.rsv.vault.id
private_dns_zone_ids = [module.private_dns.zones.vault.id]
subresource_names = ["AzureBackup"]
}
}
}
```

The below module call is used to manage the private DNS zone:

```hcl
module "private_dns" {
source = "cloudnationhq/pdns/azure"
version = "~> 0.1"
resourcegroup = module.rg.groups.demo.name
zones = {
vault = {
name = "privatelink.we.backup.windowsazure.com"
virtual_network_links = {
link1 = {
virtual_network_id = module.network.vnet.id
registration_enabled = true
}
}
}
}
}
resource_group = string
location = string
endpoints = map(object({
name = string
subnet_id = string
private_connection_resource_id = string
private_dns_zone_ids = list(string)
subresource_names = list(string)
}))
```
10 changes: 9 additions & 1 deletion examples/private-endpoint/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,13 @@ module "privatelink" {
resource_group = module.rg.groups.demo.name
location = module.rg.groups.demo.location

endpoints = local.endpoints
endpoints = {
vault = {
name = module.naming.private_endpoint.name
subnet_id = module.network.subnets.sn1.id
private_connection_resource_id = module.rsv.vault.id
private_dns_zone_ids = [module.private_dns.private_zones.vault.id]
subresource_names = ["AzureBackup"]
}
}
}
48 changes: 47 additions & 1 deletion examples/protected_file_shares/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,47 @@
wip
# Protected File Shares

This deploys policies and associations to include file shares

## Types

```hcl
vault = object({
name = string
location = string
resource_group = string
policies = optional(object({
file_shares = optional(map(object({
name = optional(string)
timezone = optional(string)
backup = object({
frequency = string
time = string
})
retention = object({
daily = object({
count = number
})
weekly = optional(object({
count = number
weekdays = list(string)
}))
monthly = optional(object({
count = number
weekdays = list(string)
weeks = list(string)
}))
yearly = optional(object({
count = number
weekdays = list(string)
weeks = list(string)
months = list(string)
}))
})
protected_shares = optional(map(object({
name = string
storage_account_id = string
})))
})))
}))
})
```
2 changes: 1 addition & 1 deletion examples/protected_file_shares/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module "rg" {

module "storage" {
source = "cloudnationhq/sa/azure"
version = "~> 2.0"
version = "~> 3.0"

naming = local.naming

Expand Down
Loading

0 comments on commit 007158c

Please sign in to comment.