Skip to content

Commit 29f9ddb

Browse files
committed
Initial commit
0 parents  commit 29f9ddb

12 files changed

Lines changed: 249 additions & 0 deletions

.gitignore

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Local .terraform directories
2+
**/.terraform/*
3+
4+
# .tfstate files
5+
*.tfstate
6+
*.tfstate.*
7+
8+
# Crash log files
9+
crash.log
10+
11+
# Ignore any .tfvars files that are generated automatically for each Terraform run. Most
12+
# .tfvars files are managed as part of configuration and so should be included in
13+
# version control.
14+
#
15+
# example.tfvars
16+
17+
# Ignore override files as they are usually used to override resources locally and so
18+
# are not checked in
19+
override.tf
20+
override.tf.json
21+
*_override.tf
22+
*_override.tf.json
23+
24+
# Include override files you do wish to add to version control using negated pattern
25+
#
26+
# !example_override.tf
27+
28+
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
29+
# example: *tfplan*

.pre-commit-config.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
repos:
2+
- repo: https://github.com/antonbabenko/pre-commit-terraform
3+
rev: v1.75.0
4+
hooks:
5+
- id: terraform_fmt
6+
- id: terraform_docs
7+
args: ['--args=--lockfile=false']
8+
- id: terraform_tflint
9+
- repo: https://github.com/pre-commit/pre-commit-hooks
10+
rev: v4.3.0
11+
hooks:
12+
- id: check-merge-conflict
13+
- id: trailing-whitespace
14+
- id: end-of-file-fixer
15+
- id: check-added-large-files
16+
- id: detect-private-key

README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# DevSecOps Dev Kit - Template terraform module
2+
3+
Template of terraform module
4+
5+
## Features
6+
7+
## Usage
8+
9+
## (Resource) Best Practices
10+
11+
## Examples
12+
13+
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
14+
## Requirements
15+
16+
| Name | Version |
17+
|------|---------|
18+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
19+
| <a name="requirement_null"></a> [null](#requirement\_null) | >= 3.0 |
20+
21+
## Providers
22+
23+
| Name | Version |
24+
|------|---------|
25+
| <a name="provider_null"></a> [null](#provider\_null) | >= 3.0 |
26+
27+
## Modules
28+
29+
No modules.
30+
31+
## Resources
32+
33+
| Name | Type |
34+
|------|------|
35+
| [null_resource.template_null_resource](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource |
36+
37+
## Inputs
38+
39+
| Name | Description | Type | Default | Required |
40+
|------|-------------|------|---------|:--------:|
41+
| <a name="input_tags"></a> [tags](#input\_tags) | A map of tags to add to all resources. | `map(string)` | `{}` | no |
42+
| <a name="input_template_variable_boolean"></a> [template\_variable\_boolean](#input\_template\_variable\_boolean) | Template variable of type boolean | `bool` | `true` | no |
43+
| <a name="input_template_variable_map"></a> [template\_variable\_map](#input\_template\_variable\_map) | Template variable of type map | `map(string)` | `{}` | no |
44+
| <a name="input_template_variable_number"></a> [template\_variable\_number](#input\_template\_variable\_number) | Template variable of type number | `number` | `123` | no |
45+
| <a name="input_template_variable_string"></a> [template\_variable\_string](#input\_template\_variable\_string) | Template variable of type boolean | `string` | `""` | no |
46+
| <a name="input_triggers"></a> [triggers](#input\_triggers) | A map of arbitrary strings that, when changed, will force the null resource to be replaced, re-running any associated provisioners | `map(string)` | `{}` | no |
47+
48+
## Outputs
49+
50+
| Name | Description |
51+
|------|-------------|
52+
| <a name="output_template_null_resource_id"></a> [template\_null\_resource\_id](#output\_template\_null\_resource\_id) | The ID of the null resource |
53+
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
54+
55+
## Authors
56+
57+
## License

examples/README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# DevSecOps Dev Kit - Template terraform module example
2+
3+
This example creates 3 null resources.
4+
5+
## Usage
6+
7+
To run this example you need to execute:
8+
9+
```bash
10+
$ terraform init
11+
$ terraform plan
12+
$ terraform apply
13+
```
14+
15+
After testing with this example is completed, run ```$ terraform destroy```
16+
17+
## Authors
18+
19+
* andreouellet
20+
21+
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
22+
## Requirements
23+
24+
| Name | Version |
25+
|------|---------|
26+
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
27+
| <a name="requirement_null"></a> [null](#requirement\_null) | >= 3.0 |
28+
29+
## Providers
30+
31+
No providers.
32+
33+
## Modules
34+
35+
| Name | Source | Version |
36+
|------|--------|---------|
37+
| <a name="module_template_null_resource"></a> [template\_null\_resource](#module\_template\_null\_resource) | ../ | n/a |
38+
39+
## Resources
40+
41+
No resources.
42+
43+
## Inputs
44+
45+
No inputs.
46+
47+
## Outputs
48+
49+
| Name | Description |
50+
|------|-------------|
51+
| <a name="output_template_null_resource_id"></a> [template\_null\_resource\_id](#output\_template\_null\_resource\_id) | The ID of the null resource |
52+
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

examples/deploy.tf

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
provider "null" {
2+
}
3+
4+
#provider "aws" {
5+
# region = "ca-central-1"
6+
#}
7+
8+
##################################################
9+
# Null Resource Module
10+
##################################################
11+
12+
module "template_null_resource" {
13+
source = "../"
14+
15+
triggers = {
16+
name = "dsodk-template-code-terraform-module"
17+
trigger = "Change this text to trigger the module to replace null resources with new ones"
18+
}
19+
}

examples/outputs.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
output "template_null_resource_id" {
2+
description = "The ID of the null resource"
3+
value = module.template_null_resource.template_null_resource_id
4+
}

examples/variables.tf

Whitespace-only changes.

examples/versions.tf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
terraform {
2+
required_version = ">= 1.0"
3+
4+
required_providers {
5+
# aws = {
6+
# source = "hashicorp/aws"
7+
# version = ">= 4.0"
8+
# },
9+
null = {
10+
source = "hashicorp/null"
11+
version = ">= 3.0"
12+
}
13+
}
14+
}

main.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
resource "null_resource" "template_null_resource" {
2+
count = 3
3+
4+
triggers = var.triggers
5+
}

outputs.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
output "template_null_resource_id" {
2+
description = "The ID of the null resource"
3+
value = try(null_resource.template_null_resource[0].id, "")
4+
}

0 commit comments

Comments
 (0)