feat(terraform): add support for terraform repos

Add terraform as a project type, make the language optional, and add a
.gitignore and justfile template for Terraform repositories.
This commit is contained in:
Oliver Davies 2023-09-27 18:57:04 +01:00
parent 9176f34444
commit af24a4b4fa
5 changed files with 79 additions and 2 deletions

View file

@ -115,6 +115,13 @@ final class CreateListOfFilesToGenerate
); );
} }
break; break;
case (strtolower(ProjectType::Terraform->name)):
$filesToGenerate = collect([
new TemplateFile(data: 'terraform/.gitignore', name: '.gitignore'),
new TemplateFile(data: 'terraform/justfile', name: 'justfile'),
]);
break;
} }
$filesToGenerate[] = new TemplateFile( $filesToGenerate[] = new TemplateFile(

View file

@ -47,14 +47,13 @@ final class Config
public array $experimental; public array $experimental;
#[Assert\Choice(choices: ['javascript', 'php', 'typescript'])] #[Assert\Choice(choices: ['javascript', 'php', 'typescript'])]
#[Assert\NotBlank]
public string $language; public string $language;
#[Assert\Length(min: 1)] #[Assert\Length(min: 1)]
#[Assert\NotBlank] #[Assert\NotBlank]
public string $name; public string $name;
#[Assert\Choice(choices: ['astro', 'drupal', 'fractal', 'laravel', 'php-library', 'vuejs'])] #[Assert\Choice(choices: ['astro', 'drupal', 'fractal', 'laravel', 'php-library', 'terraform', 'vuejs'])]
#[Assert\NotBlank] #[Assert\NotBlank]
public string $type; public string $type;

View file

@ -9,4 +9,5 @@ enum ProjectType
case Astro; case Astro;
case Drupal; case Drupal;
case Fractal; case Fractal;
case Terraform;
} }

View file

@ -0,0 +1,45 @@
# {{ managedText }}
# Created by https://www.toptal.com/developers/gitignore/api/terraform
# Edit at https://www.toptal.com/developers/gitignore?templates=terraform
### Terraform ###
# Local .terraform directories
**/.terraform/*
# Plans
terraform.tfplan
# .tfstate files
*.tfstate
*.tfstate.*
# Crash log files
crash.log
crash.*.log
# Exclude all .tfvars files, which are likely to contain sensitive data, such as
# password, private keys, and other secrets. These should not be part of version
# control as they are data points which are potentially sensitive and subject
# to change depending on the environment.
*.tfvars
*.tfvars.json
# Ignore override files as they are usually used to override resources locally and so
# are not checked in
override.tf
override.tf.json
*_override.tf
*_override.tf.json
# Include override files you do wish to add to version control using negated pattern
# !example_override.tf
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
# example: *tfplan*
# Ignore CLI configuration files
.terraformrc
terraform.rc
# End of https://www.toptal.com/developers/gitignore/api/terraform

View file

@ -0,0 +1,25 @@
# {{ managedText|raw }}
default:
@just --list
# Enable or disable Git hooks
git-hooks command:
#!/usr/bin/env bash
set -euo pipefail
case "{{ '{{ command }}'|raw }}" in
"on")
echo "Enabling Git hooks..."
git config core.hooksPath .githooks
;;
"off")
echo "Disabling Git hooks..."
git config --unset core.hooksPath
;;
*)
echo "Error: Invalid argument. Must be either 'on' or 'off'"
;;
esac
# vim: ft=just