This repository has been archived by the owner on Jun 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds examples and updates README to reflect actual
- Loading branch information
Showing
6 changed files
with
129 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Example - Create a vnet | ||
|
||
> Create a new azure virtual network | ||
|
||
## Command | ||
|
||
```shell | ||
# Create a new default vnet | ||
fusion new azure vnet | ||
``` | ||
|
||
## Output | ||
|
||
```json | ||
resource "azurerm_resource_group" "this" { | ||
name = "resource_group_name" | ||
location = "centralus" | ||
} | ||
|
||
resource "azurerm_virtual_network" "this" { | ||
name = "vnet_name" | ||
resource_group_name = azurerm_resource_group.this.name | ||
location = azurerm_resource_group.this.location | ||
address_space = ["0.0.0.0/0"] | ||
} | ||
|
||
resource "azurerm_subnet" "this" { | ||
for_each = { for subnet in var.virtual_network_settings.subnets : subnet.name => subnet } | ||
name = each.value["name"] | ||
resource_group_name = azurerm_resource_group.this.name | ||
virtual_network_name = azurerm_virtual_network.this.name | ||
address_prefixes = [each.value["cidr_block"]] | ||
dynamic "delegation" { | ||
for_each = each.value.delegation_name != null ? [1] : [] | ||
content { | ||
name = each.value.delegation_name | ||
service_delegation { | ||
name = each.value.service_delegation_name | ||
} | ||
} | ||
} | ||
} | ||
|
||
## The following variable should be separated out into a different file (ex. variables.tf) | ||
variable "virtual_network_settings" { | ||
description = "An object map of lists that contains the network CIDR block, and subnets" | ||
type = object({ | ||
address_space = list(string) | ||
subnets = list( | ||
object({ | ||
name = string | ||
cidr_block = string | ||
security_group = string | ||
delegation_name = string | ||
service_delegation_name = string | ||
}) | ||
) | ||
}) | ||
} | ||
``` |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Example - Create a load-balancer | ||
|
||
> Create a new gcp load-balancer | ||
|
||
## Command | ||
|
||
```shell | ||
# Create a new default load-balancer | ||
fusion new gcp lb | ||
``` | ||
|
||
## Output | ||
|
||
```json | ||
resource "google_compute_forwarding_rule" "default" { | ||
name = "internal-loadbalancer" | ||
region = "us-central1" | ||
|
||
load_balancing_scheme = "INTERNAL" | ||
backend_service = google_compute_region_backend_service.backend.id | ||
all_ports = true | ||
network = google_compute_network.default.name | ||
subnetwork = google_compute_subnetwork.default.name | ||
} | ||
|
||
resource "google_compute_region_backend_service" "backend" { | ||
name = "backend_service" | ||
region = "us-central1" | ||
health_checks = [google_compute_health_check.hc.id] | ||
} | ||
|
||
resource "google_compute_health_check" "hc" { | ||
name = "health_check" | ||
check_interval_sec = 1 | ||
timeout_sec = 1 | ||
|
||
tcp_health_check { | ||
port = "80" | ||
} | ||
} | ||
|
||
resource "google_compute_network" "default" { | ||
name = "network" | ||
auto_create_subnetworks = false | ||
} | ||
|
||
resource "google_compute_subnetwork" "default" { | ||
name = "subnet" | ||
ip_cidr_range = "0.0.0.0/0" | ||
region = "us-central1" | ||
network = google_compute_network.default.id | ||
} | ||
``` |