Skip to content
This repository was archived by the owner on May 1, 2023. It is now read-only.

Commit 5025ac3

Browse files
committed
feat: initial commit
1 parent 4fae9f5 commit 5025ac3

File tree

7 files changed

+168
-0
lines changed

7 files changed

+168
-0
lines changed

.drone.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
kind: pipeline
2+
name: aws-networking-readonly
3+
steps:
4+
- commands:
5+
- apk add git
6+
- npm install @semantic-release/changelog -D
7+
- npm install @semantic-release/git -D
8+
- npx semantic-release@15
9+
environment:
10+
GITHUB_TOKEN:
11+
from_secret: github_token
12+
image: node:alpine
13+
name: release
14+
trigger:
15+
branch:
16+
- main
17+
event:
18+
- push
19+
type: kubernetes

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
repos:
2+
- hooks:
3+
- id: terraform_docs
4+
repo: git://github.com/antonbabenko/pre-commit-terraform
5+
rev: v1.50.0

.releaserc

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"branches": [
3+
"main"
4+
],
5+
"plugins": [
6+
"@semantic-release/commit-analyzer",
7+
"@semantic-release/github",
8+
"@semantic-release/release-notes-generator",
9+
[
10+
"@semantic-release/changelog",
11+
{
12+
"changelogFile": "docs/CHANGELOG.md"
13+
}
14+
],
15+
[
16+
"@semantic-release/git",
17+
{
18+
"assets": [
19+
"docs/CHANGELOG.md"
20+
]
21+
}
22+
]
23+
]
24+
}

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
2+
## Requirements
3+
4+
| Name | Version |
5+
|------|---------|
6+
| aws | ~> 3.64.2 |
7+
8+
## Providers
9+
10+
| Name | Version |
11+
|------|---------|
12+
| aws | ~> 3.64.2 |
13+
14+
## Inputs
15+
16+
| Name | Description | Type | Default | Required |
17+
|------|-------------|------|---------|:--------:|
18+
| availability\_zones | Select subnets only in the given AZs | `set(string)` | `[]` | no |
19+
| vpc\_name | The name of the VPC | `string` | n/a | yes |
20+
21+
## Outputs
22+
23+
| Name | Description |
24+
|------|-------------|
25+
| dns\_hostnames\_enabled | Indicates if instances launched in this VPC will have public DNS hostnames |
26+
| dns\_support\_enabled | Indicates if DNS support is enabled for this VPC |
27+
| private\_subnets | List of private subnets in this VPC |
28+
| public\_subnets | List of public subnets in this VPC |
29+
| vpc\_arn | Arn of this VPC |
30+
| vpc\_cidr\_block | CIDR range for this VPC |
31+
| vpc\_id | The ID of the VPC |
32+
33+
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

main.tf

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
terraform {
2+
required_providers {
3+
aws = {
4+
source = "hashicorp/aws"
5+
version = "~> 3.64.2"
6+
}
7+
}
8+
}
9+
10+
data "aws_availability_zones" "this" {
11+
filter {
12+
name = "zone-name"
13+
values = var.availability_zones
14+
}
15+
}
16+
17+
data "aws_vpc" "this" {
18+
filter {
19+
name = "tag:Name"
20+
values = [var.vpc_name]
21+
}
22+
23+
state = "available"
24+
}
25+
26+
data "aws_subnet_ids" "this" {
27+
dynamic "filter" {
28+
for_each = length(data.aws_availability_zones.this.names) > 0 ? range(1) : range(0)
29+
30+
content {
31+
name = "availability-zone"
32+
values = data.aws_availability_zones.this.names
33+
}
34+
}
35+
36+
vpc_id = data.aws_vpc.this.id
37+
}
38+
39+
data "aws_subnet" "this" {
40+
for_each = data.aws_subnet_ids.this.ids
41+
42+
id = each.value
43+
}

outputs.tf

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
output "dns_hostnames_enabled" {
2+
description = "Indicates if instances launched in this VPC will have public DNS hostnames"
3+
value = data.aws_vpc.this.enable_dns_hostnames
4+
}
5+
6+
output "dns_support_enabled" {
7+
description = "Indicates if DNS support is enabled for this VPC"
8+
value = data.aws_vpc.this.enable_dns_support
9+
}
10+
11+
output "private_subnets" {
12+
description = "List of private subnets in this VPC"
13+
value = sort([for subnet in data.aws_subnet.this : subnet.id if !subnet.map_public_ip_on_launch])
14+
}
15+
16+
output "public_subnets" {
17+
description = "List of public subnets in this VPC"
18+
value = sort([for subnet in data.aws_subnet.this : subnet.id if subnet.map_public_ip_on_launch])
19+
}
20+
21+
output "vpc_arn" {
22+
description = "Arn of this VPC"
23+
value = data.aws_vpc.this.arn
24+
}
25+
26+
output "vpc_cidr_block" {
27+
description = "CIDR range for this VPC"
28+
value = data.aws_vpc.this.cidr_block
29+
}
30+
31+
output "vpc_id" {
32+
description = "The ID of the VPC"
33+
value = data.aws_vpc.this.id
34+
}

variables.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
variable "availability_zones" {
2+
default = []
3+
description = "Select subnets only in the given AZs"
4+
type = set(string)
5+
}
6+
7+
variable "vpc_name" {
8+
description = "The name of the VPC"
9+
type = string
10+
}

0 commit comments

Comments
 (0)