Skip to content

Commit f165945

Browse files
committed
feat: initial commit
0 parents  commit f165945

File tree

13 files changed

+511
-0
lines changed

13 files changed

+511
-0
lines changed

.github/workflows/ci.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Continuous Integration
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
terraform-validation:
16+
name: Terraform Validation
17+
runs-on: ubuntu-latest
18+
strategy:
19+
matrix: { env: ["aws/s3-bucket-object", "aws/vpc-endpoint"] }
20+
defaults:
21+
run:
22+
working-directory: "${{ matrix.env }}"
23+
steps:
24+
- name: Checkout
25+
id: checkout
26+
uses: actions/checkout@v4
27+
28+
- name: Setup Terraform
29+
id: setup-terraform
30+
uses: hashicorp/setup-terraform@v3
31+
with:
32+
terraform_wrapper: false
33+
34+
- name: Terraform Format
35+
run: terraform fmt -check
36+
37+
- name: Terraform Init
38+
run: terraform init
39+
40+
- name: Terraform Validate
41+
run: terraform validate -no-color
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Terraform Module Releaser
2+
on:
3+
pull_request:
4+
types: [opened, edited, synchronize, closed] # Closed required
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
jobs:
13+
release:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Terraform Module Releaser
20+
uses: techpivot/terraform-module-releaser@v1

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Terraform Module Releaser — Demo Monorepo
2+
3+
This repository serves as a demo for the **[Terraform Module Releaser GitHub Action](https://github.com/techpivot/terraform-module-releaser)**, designed to simplify the management, versioning, and release of multiple Terraform modules within a monorepo. By automating the tagging, releasing, and documentation generation process, the action ensures seamless module management for large Terraform infrastructures.
4+
5+
## How It Works
6+
7+
This demo repository leverages the [Terraform Module Releaser](https://github.com/techpivot/terraform-module-releaser) GitHub Action to:
8+
9+
- Automatically determine and apply semantic versioning (major, minor, patch) to individual modules based on commit messages.
10+
- Create and manage module-specific tags, GitHub releases, and documentation.
11+
- Generate detailed wikis, including changelogs, usage examples, and `terraform-docs` output.
12+
13+
For more details on the underlying GitHub Action, please visit the [Terraform Module Releaser GitHub Action repository](https://github.com/techpivot/terraform-module-releaser).
14+
15+
## Demo
16+
17+
To see the action in use, please refer to the following:
18+
19+
- [**Pull Requests**](https://github.com/techpivot/terraform-modules-demo/pulls): Check out the pull requests in this repository to observe the action's automated tagging, release, and comment generation.
20+
- [**Releases**](https://github.com/techpivot/terraform-modules-demo/releases): Visit the Releases tab for detailed changelogs associated with various Terraform modules, including dynamically generated release notes for each module.
21+
- [**Wiki**](https://github.com/techpivot/terraform-modules-demo/wiki): The generated module documentation, including changelogs and usage details, is available in the repository's Wiki. This is automatically updated with each release.
22+
23+
## Screenshots
24+
25+
Below are examples of the outputs generated by the Terraform Module Releaser in this demo:
26+
27+
- **Release Notes**: Each module's release details are summarized in the pull request comments and the GitHub releases section.
28+
- **Version Tags**: Observe how module-specific tags are applied based on the changes made.
29+
- **Wiki Entries**: Beautifully crafted module documentation, updated automatically with each release.
30+
31+
_(Include relevant screenshots of the workflow in action, pull request comments, release notes, and wiki entries here.)_
32+
33+
## Getting Started
34+
35+
To run this action in your own monorepo, follow the instructions in the **[Terraform Module Releaser GitHub Action README](https://github.com/techpivot/terraform-module-releaser)**.
36+
37+
We welcome feedback, issues, and contributions to enhance the Terraform Module Releaser experience. Please visit the action's repository for more information on how to integrate it into your own workflows.
38+
39+
Happy Terraforming!

aws/s3-bucket-object/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# AWS S3 Bucket Object Terraform Example Module
2+
3+
Creates S3 bucket objects with different configurations.

aws/s3-bucket-object/main.tf

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
resource "aws_s3_object" "this" {
2+
count = var.create ? 1 : 0
3+
4+
bucket = var.bucket
5+
key = var.key
6+
force_destroy = var.force_destroy
7+
8+
acl = var.acl
9+
storage_class = try(upper(var.storage_class), var.storage_class)
10+
11+
source = var.file_source
12+
content = var.content
13+
content_base64 = var.content_base64
14+
etag = var.etag
15+
16+
cache_control = var.cache_control
17+
content_disposition = var.content_disposition
18+
content_encoding = var.content_encoding
19+
content_language = var.content_language
20+
content_type = var.content_type
21+
website_redirect = var.website_redirect
22+
metadata = var.metadata
23+
24+
server_side_encryption = var.server_side_encryption
25+
kms_key_id = var.kms_key_id
26+
bucket_key_enabled = var.bucket_key_enabled
27+
28+
object_lock_legal_hold_status = try(tobool(var.object_lock_legal_hold_status) ? "ON" : upper(var.object_lock_legal_hold_status), var.object_lock_legal_hold_status)
29+
object_lock_mode = try(upper(var.object_lock_mode), var.object_lock_mode)
30+
object_lock_retain_until_date = var.object_lock_retain_until_date
31+
32+
source_hash = var.source_hash
33+
34+
tags = var.tags
35+
36+
dynamic "override_provider" {
37+
for_each = var.override_default_tags ? [true] : []
38+
39+
content {
40+
default_tags {
41+
tags = {}
42+
}
43+
}
44+
}
45+
46+
lifecycle {
47+
ignore_changes = [object_lock_retain_until_date]
48+
}
49+
}

aws/s3-bucket-object/outputs.tf

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
output "s3_object_id" {
2+
description = "The key of S3 object"
3+
value = try(aws_s3_object.this[0].id, "")
4+
}
5+
6+
output "s3_object_etag" {
7+
description = "The ETag generated for the object (an MD5 sum of the object content)."
8+
value = try(aws_s3_object.this[0].etag, "")
9+
}
10+
11+
output "s3_object_version_id" {
12+
description = "A unique version ID value for the object, if bucket versioning is enabled."
13+
value = try(aws_s3_object.this[0].version_id, "")
14+
}

aws/s3-bucket-object/variables.tf

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
variable "create" {
2+
description = "Whether to create this resource or not?"
3+
type = bool
4+
default = true
5+
}
6+
7+
variable "bucket" {
8+
description = "The name of the bucket to put the file in. Alternatively, an S3 access point ARN can be specified."
9+
type = string
10+
default = ""
11+
}
12+
13+
variable "key" {
14+
description = "The name of the object once it is in the bucket."
15+
type = string
16+
default = ""
17+
}
18+
19+
variable "file_source" {
20+
description = "The path to a file that will be read and uploaded as raw bytes for the object content."
21+
type = string
22+
default = null
23+
}
24+
25+
variable "content" {
26+
description = "Literal string value to use as the object content, which will be uploaded as UTF-8-encoded text."
27+
type = string
28+
default = null
29+
}
30+
31+
variable "content_base64" {
32+
description = "Base64-encoded data that will be decoded and uploaded as raw bytes for the object content. This allows safely uploading non-UTF8 binary data, but is recommended only for small content such as the result of the gzipbase64 function with small text strings. For larger objects, use source to stream the content from a disk file."
33+
type = string
34+
default = null
35+
}
36+
37+
variable "acl" {
38+
description = "The canned ACL to apply. Valid values are private, public-read, public-read-write, aws-exec-read, authenticated-read, bucket-owner-read, and bucket-owner-full-control. Defaults to private."
39+
type = string
40+
default = null
41+
}
42+
43+
variable "cache_control" {
44+
description = "Specifies caching behavior along the request/reply chain."
45+
type = string # map?
46+
default = null
47+
}
48+
49+
variable "content_disposition" {
50+
description = "Specifies presentational information for the object."
51+
type = string # map?
52+
default = null
53+
}
54+
55+
variable "content_encoding" {
56+
description = "Specifies what content encodings have been applied to the object and thus what decoding mechanisms must be applied to obtain the media-type referenced by the Content-Type header field."
57+
type = string
58+
default = null
59+
}
60+
61+
variable "content_language" {
62+
description = "The language the content is in e.g. en-US or en-GB."
63+
type = string
64+
default = null
65+
}
66+
67+
variable "content_type" {
68+
description = "A standard MIME type describing the format of the object data, e.g. application/octet-stream. All Valid MIME Types are valid for this input."
69+
type = string
70+
default = null
71+
}
72+
73+
variable "website_redirect" {
74+
description = "Specifies a target URL for website redirect."
75+
type = string
76+
default = null
77+
}
78+
79+
variable "storage_class" {
80+
description = "Specifies the desired Storage Class for the object. Can be either STANDARD, REDUCED_REDUNDANCY, ONEZONE_IA, INTELLIGENT_TIERING, GLACIER, DEEP_ARCHIVE, or STANDARD_IA. Defaults to STANDARD."
81+
type = string
82+
default = null
83+
}
84+
85+
variable "etag" {
86+
description = "Used to trigger updates. This attribute is not compatible with KMS encryption, kms_key_id or server_side_encryption = \"aws:kms\"."
87+
type = string
88+
default = null
89+
}
90+
91+
variable "server_side_encryption" {
92+
description = "Specifies server-side encryption of the object in S3. Valid values are \"AES256\" and \"aws:kms\"."
93+
type = string
94+
default = null
95+
}
96+
97+
variable "kms_key_id" {
98+
description = "Amazon Resource Name (ARN) of the KMS Key to use for object encryption. If the S3 Bucket has server-side encryption enabled, that value will automatically be used. If referencing the aws_kms_key resource, use the arn attribute. If referencing the aws_kms_alias data source or resource, use the target_key_arn attribute. Terraform will only perform drift detection if a configuration value is provided."
99+
type = string
100+
default = null
101+
}
102+
103+
variable "bucket_key_enabled" {
104+
description = "Whether or not to use Amazon S3 Bucket Keys for SSE-KMS."
105+
type = bool
106+
default = null
107+
}
108+
109+
variable "metadata" {
110+
description = "A map of keys/values to provision metadata (will be automatically prefixed by x-amz-meta-, note that only lowercase label are currently supported by the AWS Go API)."
111+
type = map(string)
112+
default = {}
113+
}
114+
115+
variable "tags" {
116+
description = "A map of tags to assign to the object."
117+
type = map(string)
118+
default = {}
119+
}
120+
121+
variable "force_destroy" {
122+
description = "Allow the object to be deleted by removing any legal hold on any object version. Default is false. This value should be set to true only if the bucket has S3 object lock enabled."
123+
type = bool
124+
default = false
125+
}
126+
127+
variable "object_lock_legal_hold_status" {
128+
description = "The legal hold status that you want to apply to the specified object. Valid values are ON and OFF."
129+
type = string
130+
default = null
131+
}
132+
133+
variable "object_lock_mode" {
134+
description = "The object lock retention mode that you want to apply to this object. Valid values are GOVERNANCE and COMPLIANCE."
135+
type = string
136+
default = null
137+
}
138+
139+
variable "object_lock_retain_until_date" {
140+
description = "The date and time, in RFC3339 format, when this object's object lock will expire."
141+
type = string
142+
default = null
143+
}
144+
145+
variable "source_hash" {
146+
description = "Triggers updates like etag but useful to address etag encryption limitations. Set using filemd5(\"path/to/source\") (Terraform 0.11.12 or later). (The value is only stored in state and not saved by AWS.)"
147+
type = string
148+
default = null
149+
}
150+
151+
variable "override_default_tags" {
152+
description = "Ignore provider default_tags. S3 objects support a maximum of 10 tags."
153+
type = bool
154+
default = false
155+
}

aws/s3-bucket-object/versions.tf

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

aws/vpc-endpoint/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# AWS VPC Endpoints Terraform Example Module
2+
3+
Sample Terraform module which creates VPC endpoint resources on AWS.

0 commit comments

Comments
 (0)