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: Added support for linux and windows web app #13

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 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
4 changes: 4 additions & 0 deletions .deepsource.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
version = 1

[[analyzers]]
name = "terraform"
14 changes: 14 additions & 0 deletions .github/workflows/auto_assignee.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Auto Assign PRs

on:
pull_request:
types: [opened, reopened]

workflow_dispatch:
jobs:
assignee:
uses: clouddrove/github-shared-workflows/.github/workflows/[email protected]
secrets:
GITHUB: ${{ secrets.GITHUB }}
with:
assignees: 'clouddrove-ci'
12 changes: 12 additions & 0 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: Auto merge
on:
pull_request:
jobs:
auto-merge:
uses: clouddrove/github-shared-workflows/.github/workflows/[email protected]
secrets:
GITHUB: ${{ secrets.GITHUB }}
with:
tfcheck: 'basic-example / Check code format'
...
2 changes: 1 addition & 1 deletion .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ on:
workflow_dispatch:
jobs:
call-workflow-changelog:
uses: clouddrove/github-shared-workflows/.github/workflows/changelog.yml@master
uses: clouddrove/github-shared-workflows/.github/workflows/changelog.yml@1.2.7
with:
branch: 'master'
11 changes: 5 additions & 6 deletions .github/workflows/readme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,28 @@ jobs:
uses: actions/checkout@master

- name: 'Set up Python 3.7'
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: '3.x'

- name: 'create readme'
uses: 'clouddrove/github-actions@v9.0.2'
uses: 'clouddrove/github-actions@9.0.3'
with:
actions_subcommand: 'readme'
github_token: '${{ secrets.GITHUB }}'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


- name: 'pre-commit check errors'
uses: pre-commit/action@v2.0.0
uses: pre-commit/action@v3.0.1
continue-on-error: true

- name: 'pre-commit fix erros'
uses: pre-commit/action@v2.0.0
uses: pre-commit/action@v3.0.1
continue-on-error: true

- name: 'push readme'
uses: 'clouddrove/github-actions@v9.0.2'
uses: 'clouddrove/github-actions@9.0.3'
continue-on-error: true
with:
actions_subcommand: 'push'
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/tf-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: tf-checks
on:
push:
branches: [ master ]
pull_request:
workflow_dispatch:
complete-linux-example:
uses: clouddrove/github-shared-workflows/.github/workflows/[email protected]
with:
working_directory: './_example/complete/linux_web_app/'

complete-windows-example:
uses: clouddrove/github-shared-workflows/.github/workflows/[email protected]
with:
working_directory: './_example/complete/windows_web_app/'
11 changes: 11 additions & 0 deletions .github/workflows/tflint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: tf-lint
on:
push:
branches: [ master ]
pull_request:
workflow_dispatch:
jobs:
tf-lint:
uses: clouddrove/github-shared-workflows/.github/workflows/[email protected]
secrets:
GITHUB: ${{ secrets.GITHUB }}
2 changes: 1 addition & 1 deletion .github/workflows/tfsec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
workflow_dispatch:
jobs:
tfsec:
uses: clouddrove/github-shared-workflows/.github/workflows/tfsec.yml@master
uses: clouddrove/github-shared-workflows/.github/workflows/tfsec.yml@1.2.7
secrets: inherit
with:
working_directory: '.'
125 changes: 125 additions & 0 deletions _example/complete/linux_web_app/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
provider "azurerm" {
features {}
}

##-----------------------------------------------------------------------------
## Resource group
##-----------------------------------------------------------------------------
module "resource_group" {
source = "clouddrove/resource-group/azure"
version = "1.0.2"

label_order = ["name", "environment"]
name = "rg-example"
environment = "test"
location = "Canada Central"
}

##-----------------------------------------------------------------------------
## Log Analytics
##-----------------------------------------------------------------------------
module "log-analytics" {
source = "clouddrove/log-analytics/azure"
version = "1.0.1"
name = "app"
environment = "test"
label_order = ["name", "environment"]
create_log_analytics_workspace = true
log_analytics_workspace_sku = "PerGB2018"
resource_group_name = module.resource_group.resource_group_name
log_analytics_workspace_location = module.resource_group.resource_group_location
}

##-----------------------------------------------------------------------------
## Linux web app
##-----------------------------------------------------------------------------
module "linux-web-app" {
source = "../../.."
enable = true
name = "app"
environment = "testing"
label_order = ["name", "environment", ]
resource_group_name = module.resource_group.resource_group_name
location = module.resource_group.resource_group_location

os_type = var.os_type
sku_name = var.linux_sku_name



##-----------------------------------------------------------------------------
## To Deploy Container
##-----------------------------------------------------------------------------
use_docker = true
docker_image_name = var.docker_image_name
docker_registry_url = "<registryname>.azurecr.io"
docker_registry_username = "<registryname>"
docker_registry_password = "<docker_registry_password>"
acr_id = "<acr_id>"

##-----------------------------------------------------------------------------
## Node application
##-----------------------------------------------------------------------------
use_node = false
node_version = var.node_version

##-----------------------------------------------------------------------------
## Dot net application
##-----------------------------------------------------------------------------
use_dotnet = false
dotnet_version = var.dotnet_version

##-----------------------------------------------------------------------------
## Java application
##-----------------------------------------------------------------------------
use_java = false
java_version = var.java_version
java_server = var.java_server
java_server_version = var.java_server_version


##-----------------------------------------------------------------------------
## python application
##-----------------------------------------------------------------------------

use_python = false
python_version = var.python_version

##-----------------------------------------------------------------------------
## php application
##-----------------------------------------------------------------------------

use_php = false
php_version = var.php_version

##-----------------------------------------------------------------------------
## Ruby application
##-----------------------------------------------------------------------------

use_ruby = false
ruby_version = var.ruby_version

##-----------------------------------------------------------------------------
## Go application
##-----------------------------------------------------------------------------

use_go = false
go_version = var.go_version

site_config = var.site_config
app_settings = var.app_settings

##-----------------------------------------------------------------------------
## App service logs
##-----------------------------------------------------------------------------

app_service_logs = var.app_service_logs


##-----------------------------------------------------------------------------
## log analytics
##-----------------------------------------------------------------------------
log_analytics_workspace_id = module.log-analytics.workspace_id
app_insights_workspace_id = module.log-analytics.workspace_id # log analytics workspace id in app insights
}

98 changes: 98 additions & 0 deletions _example/complete/linux_web_app/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
##-----------------------------------------------------------------------------
## App Service
##-----------------------------------------------------------------------------

variable "linux_sku_name" {
default = "B1"

}

variable "os_type" {
default = "Linux"
}

variable "enable" {
default = true
}

variable "is_linux_webapp" {
default = true
}

variable "dotnet_version" {
default = "8.0"
}

variable "node_version" {
default = "20-lts"
}

variable "site_config" {
default = {
container_registry_use_managed_identity = true # Set to true
}
}

variable "app_settings" {
type = map(string)
description = "A map of settings for the application"
default = {
foo = "bar"
}
}

variable "php_version" {
type = string
default = "8.2"
}

variable "python_version" {
type = string
default = "3.12"
}

variable "go_version" {
type = string
default = "1.19"
}

variable "ruby_version" {
type = string
default = "2.7"
}

variable "java_version" {
type = string
default = "17"
}

variable "java_server" {
type = string
default = "JAVA"
# Possible values include JAVA, TOMCAT, and JBOSSEAP ( Its in premium sku ).
}

variable "java_server_version" {
type = string
default = "17"
}

variable "docker_image_name" {
default = "nginx:latest"
}

variable "app_service_logs" {
default = {
detailed_error_messages = false
failed_request_tracing = false
application_logs = {
file_system_level = "Information"
}
http_logs = {
file_system = {
retention_in_days = 7
retention_in_mb = 35
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
terraform {
required_version = ">= 1.3.6"
required_version = ">= 1.9.0"
}

terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">=3.0.0"
version = "=3.109.0" #3.100.0
NotMaharshi marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
Loading
Loading