Skip to content

Commit 3be719f

Browse files
committed
init
1 parent e1daea0 commit 3be719f

10 files changed

Lines changed: 162 additions & 0 deletions

File tree

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Set the default behavior, in case people don't have core.autocrlf set.
2+
* text=lf

.gitignore

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# .tfvars files
2+
*.tfvars
3+
4+
# Exclude for testing stuff.
5+
!testing.tfvars
6+
7+
# .tfstate files
8+
*.tfstate
9+
*.tfstate.*
10+
11+
# Go vendor directory
12+
vendor/
13+
14+
# Files generated by terratest
15+
.test-data/
16+
17+
# Local .terraform directory
18+
**/.terraform/*
19+
20+
# IDE config files
21+
**/.idea/*
22+
**/.vscode/*
23+
24+
# MacOS files
25+
.DS_Store
26+
27+
# Ruby downloaded package lock file.
28+
Gemfile.lock
29+
30+
# Local test-kitchen files.
31+
**/.kitchen/*

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2019 Rachide <rachide.ouattara@runadium.fr>
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

Makefile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
.PHONY: help install build
2+
.DEFAULT_GOAL= help
3+
4+
help:
5+
@grep -E '(^[a-zA-Z_-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-10s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/'
6+
7+
init: ## Initialize a new or existing Terraform working directory by creating initial files
8+
terraform init
9+
10+
validate: ## Validate configuration files
11+
terraform validate
12+
13+
plan: init validate ## Generates an execution plan for Terraform.
14+
terraform plan
15+
16+
apply: plan ## Builds or changes infrastructure according to Terraform configuration files in DIR.
17+
terraform apply -auto-approve
18+
19+
destroy: ## Destroy Terraform-managed infrastructure.
20+
terraform destroy
21+
22+
clean: ## Clean unused
23+
rm -rf .terraform
24+
rm -rf **/.terraform

examples/simple/Makefile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
.PHONY: help install build
2+
.DEFAULT_GOAL= help
3+
4+
help:
5+
@grep -E '(^[a-zA-Z_-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-10s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/'
6+
7+
init: ## Initialize a new or existing Terraform working directory by creating initial files
8+
terraform init
9+
10+
validate: ## Validate configuration files
11+
terraform validate
12+
13+
plan: init validate ## Generates an execution plan for Terraform.
14+
terraform plan
15+
16+
apply: plan ## Builds or changes infrastructure according to Terraform configuration files in DIR.
17+
terraform apply -auto-approve
18+
19+
destroy: ## Destroy Terraform-managed infrastructure.
20+
terraform destroy
21+
22+
clean: ## Clean unused
23+
rm -rf .terraform
24+
rm -rf **/.terraform

examples/simple/main.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module "shepherdcloud_apps" {
2+
source = "../../"
3+
project_name = "lcm"
4+
project_router_id = "bcd84ec2-1d45-4645-ac1f-e2c90f73b4aa"
5+
}

examples/simple/outputs.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
output "apps_network_id" {
2+
value = "${module.shepherdcloud_apps.apps_network_id}"
3+
description = "The id of the CICD Network being created"
4+
}
5+
6+
output "apps_subnet_ids" {
7+
value = "${module.shepherdcloud_apps.apps_subnet_ids[0]}"
8+
description = "The id of all CICD subnets being created"
9+
}

main.tf

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#**************************** Management network ******************************
2+
module "apps_network" {
3+
source = "../terraform-os-network/"
4+
network_name = "${var.project_name}-apps-net"
5+
network_tags = ["${var.project_name}", "apps", "shepherdcloud"]
6+
network_description = "${var.network_description}"
7+
8+
subnets = [
9+
{
10+
subnet_name = "${var.project_name}-apps-subnet"
11+
subnet_cidr = "10.10.12.0/24"
12+
subnet_ip_version = 4
13+
subnet_tags = "${var.project_name}, apps, shepherdcloud"
14+
}
15+
]
16+
}
17+
18+
#**************************** Router setup *******************************
19+
resource "openstack_networking_router_interface_v2" "router_interface_apps" {
20+
router_id = "${var.project_router_id}"
21+
subnet_id = "${module.apps_network.subnet_ids[0]}"
22+
}

outputs.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
output "apps_network_id" {
2+
value = "${module.apps_network.network_id}"
3+
description = "The id of the CICD Network being created"
4+
}
5+
6+
output "apps_subnet_ids" {
7+
value = "${module.apps_network.subnet_ids}"
8+
description = "The id of all CICD subnets being created"
9+
}

variables.tf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
variable "project_name" {
2+
type = "string"
3+
description = "The name of the project. it will be used as preffix for most resource"
4+
}
5+
6+
variable "project_router_id" {
7+
type = "string"
8+
description = "The Id of the project router"
9+
}
10+
11+
variable "network_description" {
12+
type = "string"
13+
description = "The network dedicated to CICD"
14+
default = "The network dedicated to CICD"
15+
}

0 commit comments

Comments
 (0)