diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..56beb9d --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,20 @@ +name: "Terraform Module Release" + +permissions: + id-token: write + issues: write + contents: write + pull-requests: write + +on: + workflow_dispatch: + push: + branches: + - main + - master +jobs: + terraform_module_release: + if: github.repository != 'burib/terraform-aws-module-template' + uses: BuriCloud/github-workflows/.github/workflows/release.yml@main + with: + release-type: "terraform-module" diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e05e334 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.idea +.vscode +.terraform +.terraform.lock.hcl diff --git a/README.md b/README.md new file mode 100644 index 0000000..c7115aa --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# terraform-aws-module-template + +## github template to start writing versioned terraform module diff --git a/data.tf b/data.tf new file mode 100644 index 0000000..038d1e2 --- /dev/null +++ b/data.tf @@ -0,0 +1,2 @@ +data "aws_caller_identity" "current" {} +data "aws_region" "current" {} diff --git a/locals.tf b/locals.tf new file mode 100644 index 0000000..42bc069 --- /dev/null +++ b/locals.tf @@ -0,0 +1,4 @@ +locals { + region = data.aws_region.current.name + account_id = data.aws_caller_identity.current.account_id +} diff --git a/main.tf b/main.tf new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/main.tf @@ -0,0 +1 @@ + diff --git a/outputs.tf b/outputs.tf new file mode 100644 index 0000000..58903f3 --- /dev/null +++ b/outputs.tf @@ -0,0 +1,14 @@ +output "environment" { + value = var.environment + description = "Environment where this stack has been deployed to." +} + +output "region" { + value = local.region + description = "AWS Region code where this stack has been deployed to." +} + +output "account_id" { + value = local.account_id + description = "AWS Account ID where this stack has been deployed to." +} diff --git a/providers.tf b/providers.tf new file mode 100644 index 0000000..7d0f5d4 --- /dev/null +++ b/providers.tf @@ -0,0 +1,10 @@ +terraform { + required_version = "~> 1.0" # allow only 1.x versions. + + required_providers { + aws = { + source = "hashicorp/aws" + version = ">= 5.0" # minimum 5.x is required to be able to use this module + } + } +} diff --git a/variables.tf b/variables.tf new file mode 100644 index 0000000..d86acfa --- /dev/null +++ b/variables.tf @@ -0,0 +1,15 @@ +variable "environment" { + description = <