-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Organize codes sturcture and enable services
Signed-off-by: karim mdmirajul <[email protected]>
- Loading branch information
1 parent
d55ed4b
commit 31b01ce
Showing
6 changed files
with
114 additions
and
34 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,46 @@ | ||
# SPDX-FileCopyrightText: 2023 Technology Innovation Institute (TII) | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
terraform { | ||
required_providers { | ||
azurerm = { | ||
source = "hashicorp/azurerm" | ||
} | ||
sops = { | ||
source = "carlpett/sops" | ||
} | ||
} | ||
} | ||
|
||
data "sops_file" "ghaf-infra" { | ||
source_file = "secrets.yaml" | ||
# Resource group | ||
resource "azurerm_resource_group" "rg" { | ||
name = "ghaf-infra-terraform-dev" | ||
location = var.resource_group_location | ||
} | ||
|
||
provider "azurerm" { | ||
features {} | ||
# Create VN | ||
resource "azurerm_virtual_network" "ghaf-infra-vnet" { | ||
name = "ghaf-infra-terraform-dev-vnet" | ||
address_space = ["10.3.0.0/24"] | ||
location = azurerm_resource_group.rg.location | ||
resource_group_name = azurerm_resource_group.rg.name | ||
} | ||
|
||
|
||
# Backend for storing tfstate | ||
|
||
terraform { | ||
backend "azurerm" { | ||
resource_group_name = "ghaf-infra-storage" | ||
storage_account_name = "ghafinfrastatestorage" | ||
container_name = "ghaf-infra-tfstate-container" | ||
key = "ghaf-infra.tfstate" | ||
} | ||
# Create public IPs | ||
resource "azurerm_public_ip" "ghafhydra_terraform_public_ip" { | ||
name = "ghaf-infra-terraform-dev-ip" | ||
location = azurerm_resource_group.rg.location | ||
resource_group_name = azurerm_resource_group.rg.name | ||
allocation_method = "Dynamic" | ||
} | ||
|
||
|
||
# Resource group | ||
|
||
variable "resource_group_location" { | ||
type = string | ||
default = "northeurope" | ||
description = "Location of the resource group." | ||
# Create Network SG and rule | ||
resource "azurerm_network_security_group" "ghafhydra_terraform_nsg" { | ||
name = "ghaf-infra-terraform-dev-nsg" | ||
location = azurerm_resource_group.rg.location | ||
resource_group_name = azurerm_resource_group.rg.name | ||
|
||
security_rule { | ||
name = "SSH" | ||
priority = 300 | ||
direction = "Inbound" | ||
access = "Allow" | ||
protocol = "Tcp" | ||
source_port_range = "*" | ||
destination_port_range = "22" | ||
source_address_prefix = "*" | ||
destination_address_prefix = "*" | ||
} | ||
} | ||
|
||
resource "azurerm_resource_group" "rg" { | ||
name = "ghaf-infra-terraform-dev" | ||
location = var.resource_group_location | ||
} |
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,13 @@ | ||
# SPDX-FileCopyrightText: 2023 Technology Innovation Institute (TII) | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
|
||
terraform { | ||
backend "azurerm" { | ||
resource_group_name = "ghaf-infra-storage" | ||
storage_account_name = "ghafinfrastatestorage" | ||
container_name = "ghaf-infra-tfstate-container" | ||
key = "ghaf-infra.tfstate" | ||
} | ||
} |
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 @@ | ||
# SPDX-FileCopyrightText: 2023 Technology Innovation Institute (TII) | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
data "sops_file" "ghaf-infra" { | ||
source_file = "secrets.yaml" | ||
} |
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 @@ | ||
# SPDX-FileCopyrightText: 2023 Technology Innovation Institute (TII) | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
output "resource_group_name" { | ||
value = azurerm_resource_group.rg.name | ||
} | ||
|
||
output "resource_group_location" { | ||
value = azurerm_resource_group.rg.location | ||
} |
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,19 @@ | ||
# SPDX-FileCopyrightText: 2023 Technology Innovation Institute (TII) | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
provider "azurerm" { | ||
features {} | ||
} | ||
|
||
terraform { | ||
required_providers { | ||
azurerm = { | ||
source = "hashicorp/azurerm" | ||
} | ||
sops = { | ||
source = "carlpett/sops" | ||
} | ||
} | ||
} | ||
|
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,31 @@ | ||
# SPDX-FileCopyrightText: 2023 Technology Innovation Institute (TII) | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
variable "resource_group_location" { | ||
type = string | ||
default = "swedencentral" | ||
description = "Location of the resource group." | ||
} | ||
|
||
|
||
variable "resourcegroup" { | ||
description = "The Azure Resource Group Name within your Subscription in which this resource will be created." | ||
default = "ghaf-infra-swe" | ||
} | ||
|
||
variable "resource_group_name_prefix" { | ||
type = string | ||
default = "rg" | ||
description = "Prefix of the resource group name that's combined with a random ID so name is unique in your Azure subscription." | ||
} | ||
|
||
variable "location" { | ||
description = "Location for resources" | ||
default = "eastus" | ||
} | ||
|
||
variable "subnet_address_prefix" { | ||
description = "Address prefix for subnet" | ||
default = "10.0.1.0/24" | ||
} |