-
Notifications
You must be signed in to change notification settings - Fork 12
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
Implement Terraform #512
Open
sbathgate
wants to merge
22
commits into
master
Choose a base branch
from
terraform
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Implement Terraform #512
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
7f4f089
Update ghp-import from 0.5.5 to 0.6.0
pyup-bot af0e05d
Update isort from 5.2.2 to 5.3.2
pyup-bot 09180b9
Update sendgrid from 6.4.4 to 6.4.5
pyup-bot d93bf06
Update kombu from 4.6.11 to 5.0.0
pyup-bot 655455a
Ignore Kombu v5.0 update
sbathgate d61bdee
Add Terraform IaC
sbathgate 35ff247
Update formatting, Update variables
sbathgate 0a1dfc3
Update random_id generator
sbathgate 85eca65
Add AKS configuration
sbathgate e831f77
Add Cloudflare configuration
sbathgate 97e93d4
Add cloudflare terraform
sbathgate 5ed6970
Add Terraform to CI/CD
68db66f
Add tstate RG
dd13984
Clean up terraform configs
e21270d
Add AZURE_STORAGE_ACCOUNT env
650f6f8
Remove AKS and Cloudflare
f59d851
Add new line at end of file
e538831
Update working-directory, extract fmt
4d469dd
Add terraform fmt and validate
eeaf94e
Remove default values to make more readable
2f0184d
Update terraform file name
62d9e25
Update terraform file name
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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,17 @@ | ||
# Configure Azure storage to manage Terraform State | ||
# ref: https://docs.microsoft.com/en-us/azure/developer/terraform/store-state-in-azure-storage | ||
terraform { | ||
backend "azurerm" { | ||
resource_group_name = "tstate" | ||
storage_account_name = "tstate31414" | ||
container_name = "tstate" | ||
key = "terraform.tfstate" | ||
} | ||
} | ||
|
||
# Configure the Microsoft Azure Provider | ||
provider "azurerm" { | ||
version = "=2.23.0" | ||
|
||
features {} | ||
} |
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,166 @@ | ||
# ------------------------------ | ||
# Data Resource Group | ||
# ------------------------------ | ||
|
||
# Create a data resource group if it doesn't exist | ||
resource "azurerm_resource_group" "data" { | ||
name = "${var.RESOURCE_GROUP_NAME}data" | ||
location = var.location | ||
|
||
tags = {} | ||
} | ||
|
||
# Generate random text for a unique storage account name | ||
resource "random_id" "randomId" { | ||
keepers = { | ||
# Generate a new ID only when a new resource group is defined | ||
resource_group = azurerm_resource_group.vm.name | ||
} | ||
|
||
byte_length = 3 | ||
} | ||
|
||
# Create server table storage account if it doesn't exist | ||
resource "azurerm_storage_account" "serverTablesName" { | ||
name = "${var.serverTablesName}${random_id.randomId.hex}" | ||
resource_group_name = azurerm_resource_group.data.name | ||
location = azurerm_resource_group.data.location | ||
account_kind = "Storage" | ||
account_tier = "Standard" | ||
account_replication_type = "GRS" | ||
} | ||
|
||
# Create server blob storage account if it doesn't exist | ||
resource "azurerm_storage_account" "serverBlobsName" { | ||
name = "${var.serverBlobsName}${random_id.randomId.hex}" | ||
resource_group_name = azurerm_resource_group.data.name | ||
location = azurerm_resource_group.data.location | ||
account_kind = "Storage" | ||
account_tier = "Standard" | ||
account_replication_type = "GRS" | ||
} | ||
|
||
# Create client blob storage account if it doesn't exist | ||
resource "azurerm_storage_account" "clientBlobsName" { | ||
name = "${var.clientBlobsName}${random_id.randomId.hex}" | ||
resource_group_name = azurerm_resource_group.data.name | ||
location = azurerm_resource_group.data.location | ||
account_kind = "Storage" | ||
account_tier = "Standard" | ||
account_replication_type = "GRS" | ||
} | ||
|
||
resource "azurerm_storage_container" "clientsauth" { | ||
name = "clientsauth" | ||
storage_account_name = azurerm_storage_account.serverTablesName.name | ||
container_access_type = "private" | ||
} | ||
|
||
resource "azurerm_storage_container" "pendingemails" { | ||
name = "pendingemails" | ||
storage_account_name = azurerm_storage_account.serverTablesName.name | ||
container_access_type = "private" | ||
} | ||
|
||
resource "azurerm_storage_container" "users" { | ||
name = "users" | ||
storage_account_name = azurerm_storage_account.serverTablesName.name | ||
container_access_type = "private" | ||
} | ||
|
||
resource "azurerm_storage_container" "emails" { | ||
name = "emails" | ||
storage_account_name = azurerm_storage_account.serverBlobsName.name | ||
container_access_type = "private" | ||
} | ||
|
||
resource "azurerm_storage_container" "mailbox" { | ||
name = "mailbox" | ||
storage_account_name = azurerm_storage_account.serverBlobsName.name | ||
container_access_type = "private" | ||
} | ||
|
||
resource "azurerm_storage_container" "secretsopwencluster" { | ||
name = "secretsopwencluster" | ||
storage_account_name = azurerm_storage_account.serverBlobsName.name | ||
container_access_type = "private" | ||
} | ||
|
||
resource "azurerm_storage_container" "sendgridinboundemails" { | ||
name = "sendgridinboundemails" | ||
storage_account_name = azurerm_storage_account.serverBlobsName.name | ||
container_access_type = "private" | ||
} | ||
|
||
resource "azurerm_storage_container" "compressedpackages" { | ||
name = "compressedpackages" | ||
storage_account_name = azurerm_storage_account.clientBlobsName.name | ||
container_access_type = "private" | ||
} | ||
|
||
# Create a server queue if it doesn't exist | ||
resource "azurerm_servicebus_namespace" "data" { | ||
name = var.serverQueuesName | ||
location = azurerm_resource_group.data.location | ||
resource_group_name = azurerm_resource_group.data.name | ||
sku = "Standard" | ||
zone_redundant = false | ||
} | ||
|
||
resource "azurerm_servicebus_namespace_authorization_rule" "data" { | ||
name = var.serverQueuesSasName | ||
namespace_name = azurerm_servicebus_namespace.data.name | ||
resource_group_name = azurerm_resource_group.data.name | ||
send = true | ||
listen = true | ||
manage = true | ||
} | ||
|
||
resource "azurerm_servicebus_queue" "serverQueueSendgridMime" { | ||
name = var.serverQueueSendgridMime | ||
resource_group_name = azurerm_resource_group.data.name | ||
namespace_name = azurerm_servicebus_namespace.data.name | ||
max_size_in_megabytes = 512 | ||
} | ||
|
||
resource "azurerm_servicebus_queue" "serverQueueEmailSend" { | ||
name = var.serverQueueEmailSend | ||
resource_group_name = azurerm_resource_group.data.name | ||
namespace_name = azurerm_servicebus_namespace.data.name | ||
max_size_in_megabytes = 5120 | ||
} | ||
|
||
resource "azurerm_servicebus_queue" "serverQueueClientPackage" { | ||
name = var.serverQueueClientPackage | ||
resource_group_name = azurerm_resource_group.data.name | ||
namespace_name = azurerm_servicebus_namespace.data.name | ||
max_size_in_megabytes = 5120 | ||
} | ||
|
||
resource "azurerm_servicebus_queue" "mailboxreceived" { | ||
name = "mailboxreceived" | ||
resource_group_name = azurerm_resource_group.data.name | ||
namespace_name = azurerm_servicebus_namespace.data.name | ||
max_size_in_megabytes = 1024 | ||
} | ||
|
||
resource "azurerm_servicebus_queue" "mailboxsent" { | ||
name = "mailboxsent" | ||
resource_group_name = azurerm_resource_group.data.name | ||
namespace_name = azurerm_servicebus_namespace.data.name | ||
max_size_in_megabytes = 1024 | ||
} | ||
|
||
resource "azurerm_servicebus_queue" "register" { | ||
name = "register" | ||
resource_group_name = azurerm_resource_group.data.name | ||
namespace_name = azurerm_servicebus_namespace.data.name | ||
max_size_in_megabytes = 1024 | ||
} | ||
|
||
resource "azurerm_servicebus_queue" "service" { | ||
name = "service" | ||
resource_group_name = azurerm_resource_group.data.name | ||
namespace_name = azurerm_servicebus_namespace.data.name | ||
max_size_in_megabytes = 1024 | ||
} |
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,11 @@ | ||
# ------------------------------ | ||
# Server Resource Group | ||
# ------------------------------ | ||
|
||
# Create the server resource group if it doesn't exist | ||
resource "azurerm_resource_group" "server" { | ||
name = "${var.RESOURCE_GROUP_NAME}server" | ||
location = var.location | ||
|
||
tags = {} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thoughts on making the key dynamic, e.g. based on branch name via the
GITHUB_REF
environment variable, so that we can run this potentially for multiple deployments (e.g. for work-in-progress code) without risking to override the production resources.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure can! That makes a lot of sense.