Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Documentation Updates #12

Merged
merged 1 commit into from
Jan 23, 2024
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
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,23 @@ Getting started with fusion is as simple as naming the type of cloud resource yo
See available commands with `--help`

```
fusion —help
fusion —-help

Usage: fusion <command>

Generate secure by default cloud infrastructure configuration

Flags:
-h, --help Show context-sensitive help.
-v, --verbose Enable verbose logging
-n, --no-color Disable colorful output ($NO_COLOR)
-h, --help Show context-sensitive help.
--version Show version information
-v, --verbose Enable verbose logging
-n, --no-color Disable colorful output ($NO_COLOR)
--no-format Disable code formatting ($NO_FORMAT)
--config=CONFIG-FLAG Provide a JSON file which will populate flags and their values

Commands:
new Create new cloud resources with Terraform
gen Generate snippets and shell completions

Run "fusion <command> --help" for more information on a command.
```
Expand Down
12 changes: 6 additions & 6 deletions _example/aws/lambda.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

```shell
# Create a new default lambda
fusion new aws lambda
fusion new aws resource lambda
```

## Output
Expand All @@ -34,13 +34,13 @@ EOF
}

resource "aws_lambda_function" "my_lambda" {
filename = "foo.zip"
function_name = "MyLambda"
filename = "my_lambda.zip"
function_name = "my_lambda"
role = aws_iam_role.iam_for_lambda.arn
handler = "handler.index"
source_code_hash = filebase64sha256("foo.zip")
handler = "handler.index.js"
source_code_hash = filebase64sha256("my_lambda.zip")

runtime = "NODE_14.x"
runtime = "nodejs14.x"

environment {
variables = {}
Expand Down
Empty file removed _example/azure/.gitkeep
Empty file.
61 changes: 61 additions & 0 deletions _example/azure/vnet.md
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 removed _example/gcp/.gitkeep
Empty file.
54 changes: 54 additions & 0 deletions _example/gcp/lb.md
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
}
```