Skip to content

Instantly share code, notes, and snippets.

View soerenmartius's full-sized avatar
🎯
focused

Sören Martius soerenmartius

🎯
focused
View GitHub Profile
@soerenmartius
soerenmartius / providers.hcl.tm
Last active July 14, 2022 12:00
Terramate provider definition in providers.hcl.tm
# File: /projects/providers.tm.hcl
globals {
# The default project_id to configure the provider with.
# The provider_id can be set at any level in the hierarchy.
# If no project_id the provider fallbacks are used.
terraform_google_provider_project = tm_try(global.project_id, null)
# The default region to configure
terraform_google_provider_region = "europe-north1"
@soerenmartius
soerenmartius / stack.hcl.tm
Created July 14, 2022 11:55
Example Terramate Stack Definition
# File: /projects/<project>/<stack>/stack.tm.hcl
stack {
name = "My awesome <stack>"
description = "This stack defines awesome resources"
}
@soerenmartius
soerenmartius / provider.tf
Created July 14, 2022 11:21
Terraform provider.tf example
# File: /projects/my-project-<env>/<stack>/provider.tf
provider "google" {
project = "my-project-<env>"
region = "europe-north1"
}
terraform {
required_providers {
google = {
@soerenmartius
soerenmartius / example_terraform_google_cloud_project_structure.sh
Created July 14, 2022 11:19
Example Terraform Google Cloud Project Structure
projects/
├── my-project-prod/
│   ├── stack-1/
│   │ ├── main.tf
│   │ ├── provider.tf
│   │ └── backend.tf
│   └── stack-2/
│   │ ├── main.tf
│   │ ├── provider.tf
│   │ └── backend.tf
@soerenmartius
soerenmartius / globals.hcl.tm
Last active July 14, 2022 11:18
Terramate Globals Examples
globals {
env = "staging"
}
@soerenmartius
soerenmartius / github_as_code_user_management.hcl
Created July 11, 2022 16:36
GitHub as Code configuration example
# This file is part of Terramate Configuration.
# Terramate is an orchestrator and code generator for Terraform.
# Please see https://github.com/mineiros-io/terramate for more information.
#
# To generate/update Terraform code within the stacks run `terramate generate` from the repositories root directory.
### USER MAPS ################################################################
#
# As GitHub usernames are hard to maintain we generate mappings here to real names.
# This will help maintain large lists of users and improve on-/off-boardings.
@soerenmartius
soerenmartius / settings.json
Created June 29, 2022 12:47
Configure *.tm.hcl files with the Terramate Language Server in VSCode
"files.associations": {
"*.tm.hcl": "terramate"
}
@soerenmartius
soerenmartius / install_terramate_with_go.sh
Created June 29, 2022 12:37
Install the Terramate Language Server from the sources with Go
go install github.com/mineiros-io/terramate-ls/cmd/terramate-ls@v0.0.2
@soerenmartius
soerenmartius / install_terramate_via_github.sh
Last active June 29, 2022 12:33
Install Terramate Language Server via GitHub Releases
curl -L -o terramate-ls.tar.gz https://github.com/mineiros-io/terramate-ls/releases/download/v0.0.2/terramate-ls_0.0.2_linux_x86_64.tar.gz
tar xvf terramate-ls.tar.gz
sudo cp terramate-ls /usr/bin
@soerenmartius
soerenmartius / terramate.tm.hcl
Created May 5, 2022 12:30
This examples shows how to define the order of execution in Terramate using the after block
stack {
name = "My production VPC"
after = [
"/stacks/gcp-projects/my-staging/my-vpc",
]
}