Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add template parameters #12

Merged
merged 1 commit into from
Mar 28, 2024
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
30 changes: 30 additions & 0 deletions .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: terraform
on: push

jobs:
tfsec:
uses: skyleague/node-standards/.github/workflows/reusable-tfsec.yml@main
with:
terraform-version: "1.7.1"
working-directory: "./"
# tfsec-var-files: '["test/default.tfvars", "test/a.tfvars"]'

tests:
name: tests
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: setup terraform and cache
uses: skyleague/node-standards/.github/actions/setup-terraform@main
with:
terraform-version: "1.7.1"
working-directory: "./test"
github-app-id: ${{ secrets.GITHUB_APP_ID }}
github-app-pem: ${{ secrets.GITHUB_APP_PEM }}
- name: terraform init
run: terraform init
working-directory: "./test"
- name: terraform test
run: terraform test
working-directory: "./test"
10 changes: 0 additions & 10 deletions .github/workflows/tfsec.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"editor.tabSize": 2
},
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
"source.fixAll.eslint": "explicit"
},
"editor.formatOnSave": true,
"editor.wordSeparators": "`~!@#%^&*()-=+[{]}\\|;:'\",.<>/?",
Expand Down
10 changes: 6 additions & 4 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ data "external" "definition" {
])
}
locals {
raw_definition = endswith(var.definition.file, ".json") ? jsondecode(templatefile(var.definition.file, {
template_parameters = merge(coalesce(try(var.definition.template_parameters, null), {}), {
aws_region = data.aws_region.current.name
aws_account_id = data.aws_caller_identity.current.account_id
})) : data.external.definition[0].result
lambda_arns = jsondecode(local.raw_definition.lambda_arns)
definition = jsondecode(local.raw_definition.definition)
})
file_definition = endswith(var.definition.file, ".json") ? jsondecode(templatefile(var.definition.file, local.template_parameters)) : null
raw_definition = endswith(var.definition.file, ".json") ? local.file_definition : data.external.definition[0].result
lambda_arns = jsondecode(local.raw_definition.lambda_arns)
definition = jsondecode(local.raw_definition.definition)
}

resource "aws_sfn_state_machine" "this" {
Expand Down
1 change: 1 addition & 0 deletions scripts/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ yalc.lock
!.github
!.vscode
!.npmrc
!.husky

!.gitignore
!.gitkeep
Expand Down
1 change: 1 addition & 0 deletions scripts/.husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx --no -- commitlint --edit $1
1 change: 1 addition & 0 deletions scripts/.husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx --no -- lint-staged --concurrent=true --allow-empty
2 changes: 1 addition & 1 deletion scripts/LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2023, SkyLeague Technologies B.V.. 'SkyLeague' and the astronaut logo are trademarks of SkyLeague Technologies, registered at Chamber of Commerce in The Netherlands under number 86650564.
Copyright (c) 2024, SkyLeague Technologies B.V.. 'SkyLeague' and the astronaut logo are trademarks of SkyLeague Technologies, registered at Chamber of Commerce in The Netherlands under number 86650564.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
Loading
Loading