Skip to content

Commit e84f99b

Browse files
committed
Initial commit
0 parents  commit e84f99b

File tree

10 files changed

+145
-0
lines changed

10 files changed

+145
-0
lines changed

.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

Whitespace-only changes.

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# My new created Terraform module
2+
3+
Introduce your module briefly.
4+
5+
## Usage
6+
7+
Provide the sample code to use your module.
8+
9+
## Scenarios
10+
11+
Provide advanced use cases here.
12+
13+
## Examples
14+
15+
Paste the links to your sample code in `examples` folder.
16+
17+
## Inputs
18+
19+
List all input variables of your module.
20+
21+
## Outputs
22+
23+
List all output variables of your module.

examples/simple/main.tf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module "compute" {
2+
source = "../../"
3+
compute_name = "BLUE"
4+
instance_count = 2
5+
image_name = "cirros"
6+
flavor_name = "m1.tiny"
7+
keypair = "shepherd"
8+
}

examples/simple/outputs.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
output "ids" {
2+
description = "List of IDs of instances"
3+
value = "${module.compute.ids}"
4+
}
5+
6+
output "names" {
7+
description = "List of IDs of instances"
8+
value = "${module.compute.names}"
9+
}

main.tf

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
data "openstack_compute_flavor_v2" "this" {
2+
name = "${var.flavor_name}"
3+
}
4+
5+
data "openstack_images_image_v2" "this" {
6+
name = "${var.image_name}"
7+
most_recent = true
8+
}
9+
10+
resource "openstack_compute_instance_v2" "this" {
11+
count = "${var.instance_count}"
12+
13+
name = "${var.compute_name}-${count.index}"
14+
image_name = "${data.openstack_images_image_v2.this.name}"
15+
flavor_id = "${data.openstack_compute_flavor_v2.this.id}"
16+
key_pair = "${var.keypair}"
17+
}

outputs.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
output "ids" {
2+
description = "List of IDs of instances"
3+
value = "${openstack_compute_instance_v2.this.*.id}"
4+
}
5+
6+
output "names" {
7+
description = "List of IDs of instances"
8+
value = "${openstack_compute_instance_v2.this.*.name}"
9+
}

variables.tf

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
variable "compute_name" {
2+
type = "string"
3+
description = "The name (prefix) of the compute instance to create."
4+
}
5+
6+
variable "instance_count" {
7+
description = "Number of instances to launch"
8+
default = 1
9+
}
10+
11+
variable "image_name" {
12+
type = "string"
13+
description = "The Glance image name to use."
14+
}
15+
16+
variable "flavor_name" {
17+
type = "string"
18+
default = "m1.tiny"
19+
description = "The name of the flavor to use to create compute"
20+
}
21+
22+
variable "keypair" {
23+
type = "string"
24+
description = "The name of the keypair to use"
25+
}

0 commit comments

Comments
 (0)