Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions .github/workflows/terraform-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,44 @@ on:

jobs:

check-terraform-fmt:
terraform-tflint:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Setup TFLint
uses: terraform-linters/setup-tflint@v6
with:
cache: true
- name: Show version
run: tflint --version
# - name: help
# run: tflint -help
- name: Run
run: tflint --chdir=terraform --recursive

terraform-check-fmt:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Install Terraform
uses: hashicorp/setup-terraform@v2

- name: Check Terraform formatting
run: |
bash terraform/repo-scripts/check-terraform-fmt.sh terraform

check-terraform-variables-tailscale-install-scripts:
terraform-check-variables-tailscale-install-scripts:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4

# - name: tree
# working-directory: terraform
# run: |
# apt-get -y update
# apt-get -y install tree
# tree -a

- name: Check variables-tailscale-install-scripts.tf files
run: |
bash terraform/repo-scripts/check-variables-tailscale-install-scripts.sh terraform
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
default: help

.PHONY: terraform-tflint
terraform-tflint: ## Run 'terraform-tflint' github actions with https://github.com/nektos/act
act -j terraform-tflint

.PHONY: check-terraform-examples
check-terraform-examples: ## Run specific 'check' github actions with https://github.com/nektos/act
act -j check-terraform-fmt
act -j check-variables-tailscale-install-scripts
terraform-check-examples: ## Run specific 'check' github actions with https://github.com/nektos/act
act -j terraform-check-fmt
act -j terraform-check-variables-tailscale-install-scripts

.PHONY: help
help: ## Display this information. Default target.
Expand Down
4 changes: 4 additions & 0 deletions terraform/.tflint.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
plugin "terraform" {
enabled = true
preset = "all"
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 6.0, < 7.0"
}
tailscale = {
source = "tailscale/tailscale"
version = ">= 0.24"
}
}

required_version = ">= 1.0, < 2.0"
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 6.0, < 7.0"
}
tailscale = {
source = "tailscale/tailscale"
version = ">= 0.24"
}
}

required_version = ">= 1.0, < 2.0"
}
6 changes: 6 additions & 0 deletions terraform/aws/aws-ec2-autoscaling/versions.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 6.0, < 7.0"
}
tailscale = {
source = "tailscale/tailscale"
version = ">= 0.24"
}
}

required_version = ">= 1.0, < 2.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ output "nat_public_ips" {
}

output "instance_ids" {
value = module.tailscale_aws_ec2.*.instance_id
value = module.tailscale_aws_ec2[*].instance_id
}

output "user_data_md5" {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 6.0, < 7.0"
}
tailscale = {
source = "tailscale/tailscale"
version = ">= 0.24"
}
}

required_version = ">= 1.0, < 2.0"
}
2 changes: 1 addition & 1 deletion terraform/aws/aws-ec2-instance/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ output "nat_public_ips" {
}

output "instance_ids" {
value = module.tailscale_aws_ec2.*.instance_id
value = module.tailscale_aws_ec2[*].instance_id
}

output "user_data_md5" {
Expand Down
6 changes: 6 additions & 0 deletions terraform/aws/aws-ec2-instance/versions.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = ">= 6.0, < 7.0"
}
tailscale = {
source = "tailscale/tailscale"
version = ">= 0.24"
}
}

required_version = ">= 1.0, < 2.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ terraform {
version = ">= 6.0, < 7.0"
}
}

required_version = ">= 1.0, < 2.0"
}
2 changes: 2 additions & 0 deletions terraform/aws/internal-modules/aws-ec2-instance/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ terraform {
version = ">= 6.0, < 7.0"
}
}

required_version = ">= 1.0, < 2.0"
}
6 changes: 6 additions & 0 deletions terraform/aws/internal-modules/aws-vpc/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,11 @@ terraform {
source = "hashicorp/aws"
version = ">= 6.0, < 7.0"
}
random = {
source = "hashicorp/random"
version = ">= 3.0, < 4.0"
}
}

required_version = ">= 1.0, < 2.0"
}
1 change: 0 additions & 1 deletion terraform/azure/azure-linux-vm/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ locals {
location = azurerm_resource_group.main.location

vpc_cidr_block = module.vpc.vnet_address_space
vpc_id = module.vpc.vnet_id
subnet_id = module.vpc.public_subnet_id
network_security_group_id = azurerm_network_security_group.tailscale_ingress.id
instance_type = "Standard_D2as_v6"
Expand Down
6 changes: 6 additions & 0 deletions terraform/azure/azure-linux-vm/versions.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">= 4.0, < 5.0"
}
tailscale = {
source = "tailscale/tailscale"
version = ">= 0.24"
}
}

required_version = ">= 1.0, < 2.0"
}
2 changes: 2 additions & 0 deletions terraform/azure/internal-modules/azure-linux-vm/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ terraform {
version = ">= 4.0, < 5.0"
}
}

required_version = ">= 1.0, < 2.0"
}
4 changes: 2 additions & 2 deletions terraform/azure/internal-modules/azure-network/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ output "private_dns_resolver_inbound_endpoint_ip" {
}

output "nat_public_ips" {
value = azurerm_public_ip.nat.*.ip_address
value = azurerm_public_ip.nat[*].ip_address
}

output "nat_ids" {
description = "Useful for using within `depends_on` for other resources"
value = azurerm_nat_gateway.nat.*.id
value = azurerm_nat_gateway.nat[*].id
}
6 changes: 6 additions & 0 deletions terraform/azure/internal-modules/azure-network/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,11 @@ terraform {
source = "hashicorp/azurerm"
version = ">= 4.0, < 5.0"
}
random = {
source = "hashicorp/random"
version = ">= 3.0, < 4.0"
}
}

required_version = ">= 1.0, < 2.0"
}
6 changes: 6 additions & 0 deletions terraform/google/google-compute-instance/versions.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
terraform {
required_providers {
google = {
source = "hashicorp/google"
version = ">= 7.0, < 8.0"
}
tailscale = {
source = "tailscale/tailscale"
version = ">= 0.24"
}
}

required_version = ">= 1.0, < 2.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ module "tailscale_install_scripts" {
additional_after_scripts = var.additional_after_scripts
}

data "google_compute_subnetwork" "selected" {
self_link = "https://www.googleapis.com/compute/v1/${var.subnet}" # requires full URL - https://github.com/hashicorp/terraform-provider-google/issues/9919
}

data "google_compute_image" "ubuntu" {
project = "ubuntu-os-cloud"
family = "ubuntu-2404-lts-amd64"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ terraform {
version = ">= 7.0, < 8.0"
}
}
}

required_version = ">= 1.0, < 2.0"
}
7 changes: 6 additions & 1 deletion terraform/google/internal-modules/google-vpc/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ terraform {
source = "hashicorp/google"
version = ">= 7.0, < 8.0"
}
random = {
source = "hashicorp/random"
version = ">= 3.0, < 4.0"
}
}
}

required_version = ">= 1.0, < 2.0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
terraform {
required_version = ">= 1.0, < 2.0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
terraform {
required_version = ">= 1.0, < 2.0"
}
Loading