-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci added | gitignore update | test configuration
- Loading branch information
1 parent
dff080f
commit cc8ccf0
Showing
17 changed files
with
201 additions
and
2 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: Validate Terraform | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- main | ||
- develop | ||
|
||
pull_request: | ||
branches: | ||
- master | ||
- main | ||
- develop | ||
|
||
workflow_dispatch: | ||
|
||
# schedule: | ||
# - cron: '0 0 * * 0' | ||
|
||
jobs: | ||
build-webapp: | ||
name: Validate Terraform | ||
runs-on: ${{ matrix.environment }} | ||
strategy: | ||
matrix: | ||
environment: | ||
- ubuntu-latest | ||
|
||
env: | ||
DOTNET_NOLOGO: 1 | ||
DOTNET_CLI_TELEMETRY_OPTOUT: 1 | ||
ACTIONS_RUNNER_DEBUG: true | ||
TF_LOG: INFO | ||
ARM_CLIENT_ID: "" | ||
ARM_CLIENT_SECRET: ${{ secrets.TF_ARM_CLIENT_SECRET }} | ||
ARM_SUBSCRIPTION_ID: "" | ||
ARM_TENANT_ID: "" | ||
WORKING_DIR: "./" | ||
|
||
steps: | ||
- name: Fetch Sources | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup Terraform | ||
uses: hashicorp/setup-terraform@v2 | ||
with: | ||
terraform_version: latest | ||
|
||
- name: Terraform Version | ||
run: terraform -v | ||
working-directory: ${{ env.WORKING_DIR }} | ||
|
||
- name: Terraform Init | ||
run: terraform init -backend=false | ||
working-directory: ${{ env.WORKING_DIR }} | ||
|
||
- name: Terraform Validate | ||
run: terraform validate | ||
working-directory: ${{ env.WORKING_DIR }} | ||
|
||
- name: Terraform Format | ||
run: terraform fmt -check | ||
working-directory: ${{ env.WORKING_DIR }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
.idea | ||
.ssh | ||
*.conf | ||
.terraform | ||
*.tfplan | ||
*.tfstate | ||
*.lock.info | ||
*.tfstate.backup |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
trigger: | ||
batch: true | ||
branches: | ||
include: | ||
- master | ||
paths: | ||
include: | ||
- '*' | ||
|
||
pr: | ||
branches: | ||
include: | ||
- '*' | ||
|
||
variables: | ||
- name: TF_LOG | ||
value: INFO | ||
- name: WORKING_DIR | ||
value: '$(System.DefaultWorkingDirectory)' | ||
|
||
stages: | ||
- stage: "Terraform_CI" | ||
displayName: "Terraform Validate" | ||
jobs: | ||
- job: Terraform_CI | ||
displayName: "Terraform Validate" | ||
pool: | ||
vmImage: "ubuntu-latest" | ||
steps: | ||
- checkout: self | ||
fetchDepth: 0 | ||
|
||
- task: TerraformInstaller@0 | ||
displayName: 'Terraform Installer' | ||
inputs: | ||
terraformVersion: 'latest' | ||
|
||
- script: terraform -v | ||
displayName: 'Terraform Version' | ||
workingDirectory: '$(WORKING_DIR)' | ||
|
||
- script: terraform init -backend=false | ||
displayName: 'Terraform Init' | ||
workingDirectory: '$(WORKING_DIR)' | ||
|
||
- script: terraform validate | ||
displayName: 'Terraform Validate' | ||
workingDirectory: '$(WORKING_DIR)' | ||
|
||
- script: terraform fmt -check | ||
displayName: 'Terraform Format' | ||
workingDirectory: '$(WORKING_DIR)' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
locals { | ||
rg_name = "${var.resource_group_name}-${var.prefix}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
data "azurerm_client_config" "current" {} | ||
|
||
resource "azurerm_resource_group" "public" { | ||
location = var.resource_group_location | ||
name = local.rg_name | ||
} | ||
|
||
module "resource_group" { | ||
source = "./modules/example_submodule" | ||
resource_group_location = "northeurope" | ||
resource_group_name = "rg-from-module" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
locals { | ||
rg_name = var.resource_group_name | ||
} | ||
|
||
resource "azurerm_resource_group" "public" { | ||
location = var.resource_group_location | ||
name = local.rg_name | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
output "rg_id" { | ||
value = azurerm_resource_group.public.id | ||
} |
4 changes: 2 additions & 2 deletions
4
modules/variables.tf → modules/example_submodule/variables.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
variable "resourece_group_name" { | ||
variable "resource_group_name" { | ||
type = string | ||
description = "Resource group name" | ||
} | ||
|
||
variable "resourece_group_location" { | ||
variable "resource_group_location" { | ||
type = string | ||
description = "Resource group location" | ||
} |
Empty file.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
provider "azurerm" { | ||
features { | ||
resource_group { | ||
prevent_deletion_if_contains_resources = false | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"resource_group_name": "rg-terraform-template", | ||
"resource_group_location": "northeurope", | ||
"prefix": "tf01" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
variable "resource_group_name" { | ||
type = string | ||
description = "Resource group name" | ||
} | ||
|
||
variable "resource_group_location" { | ||
type = string | ||
description = "Resource group location" | ||
} | ||
|
||
variable "prefix" { | ||
type = string | ||
description = "Prefix for all resources" | ||
} |
File renamed without changes.