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

Fixing the format for TF #40

Merged
merged 1 commit into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all 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: 2 additions & 2 deletions terraform/aws/modules/efs/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ variable "encryption_set" {
default = true
}
variable "subnet_id" {
type = list(string)
type = list(string)
default = []

}
variable "security_groups" {
type = list(string)
type = list(string)
default = []
}

24 changes: 12 additions & 12 deletions terraform/aws/modules/eks/eks-node-group.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
resource "aws_iam_role" "nodes_general" {
name = "eks-node-groupgeneral"
name = "eks-node-groupgeneral"
assume_role_policy = <<POLICY
{
"Version": "2012-10-17",
Expand Down Expand Up @@ -35,7 +35,7 @@ resource "aws_eks_node_group" "nodes_general" {
cluster_name = var.eks_cluster_name
node_group_name = var.node_group_name
node_role_arn = aws_iam_role.nodes_general.arn
subnet_ids = concat(
subnet_ids = concat(
var.private_subnet_ids,
var.public_subnet_ids
)
Expand All @@ -47,18 +47,18 @@ resource "aws_eks_node_group" "nodes_general" {
}

lifecycle {
ignore_changes = [
scaling_config[0].desired_size,
]
}
ignore_changes = [
scaling_config[0].desired_size,
]
}

ami_type = var.node_group_ami_type
capacity_type = var.node_group_capacity_type
disk_size = var.node_group_disk_size
ami_type = var.node_group_ami_type
capacity_type = var.node_group_capacity_type
disk_size = var.node_group_disk_size
force_update_version = false
instance_types = var.node_group_instance_types
labels = var.node_group_labels
version = var.node_group_version
instance_types = var.node_group_instance_types
labels = var.node_group_labels
version = var.node_group_version

depends_on = [
aws_eks_cluster.default,
Expand Down
36 changes: 18 additions & 18 deletions terraform/aws/modules/eks/eks.tf
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
resource "aws_security_group" "eks_cluster_sg" {
name = var.security_group_name
description = "EKS Cluster Security Group"
vpc_id = var.vpc_id
vpc_id = var.vpc_id

ingress {
from_port = 443
to_port = 443
protocol = "tcp"
cidr_blocks = var.allowed_mgmt_cidr
}
from_port = 443
to_port = 443
protocol = "tcp"
cidr_blocks = var.allowed_mgmt_cidr
}

ingress {
from_port = 80
to_port = 80
protocol = "tcp"
cidr_blocks = var.allowed_http_cidr
}
ingress {
from_port = 80
to_port = 80
protocol = "tcp"
cidr_blocks = var.allowed_http_cidr
}

ingress {
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}
ingress {
from_port = 22
to_port = 22
protocol = "tcp"
cidr_blocks = ["0.0.0.0/0"]
}

egress {
from_port = 0
Expand Down
8 changes: 4 additions & 4 deletions terraform/aws/modules/eks/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ variable "availability_zones" {
default = []
}
variable "ipv4_additional_cidr" {
type = list(string)
default = []
type = list(string)
default = []
}
variable "security_group_name" {
description = "Name for the EKS cluster security group"
Expand All @@ -111,8 +111,8 @@ variable "allowed_http_cidr" {
variable "vpc_id" {
}
variable "public_subnet_ids" {

}
variable "private_subnet_ids" {

}
10 changes: 5 additions & 5 deletions terraform/aws/modules/lambda/lambda.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
resource "aws_lambda_function" "lambda" {
function_name = var.function_name
description = var.description
description = var.description
handler = var.handler
runtime = var.runtime
filename = var.source_code_path
Expand All @@ -9,8 +9,8 @@ resource "aws_lambda_function" "lambda" {
environment {
variables = var.environment_variables
}
timeout = var.timeout
memory_size = var.memory_size
timeout = var.timeout
memory_size = var.memory_size
tags = {
Name = "${var.name_prefix}-lambda"
}
Expand All @@ -36,10 +36,10 @@ resource "aws_iam_role" "lambda_execution_role" {
Name = "${var.name_prefix}-lambda-role"
}
}
# Attach IAM policies dynamically
# Attach IAM policies dynamically
resource "aws_iam_policy_attachment" "lambda_policy_attachment" {
count = length(var.policy_arns)
name = "lambda-policy-attachment-${count.index}" # Unique name for each attachment
name = "lambda-policy-attachment-${count.index}" # Unique name for each attachment
policy_arn = var.policy_arns[count.index]
roles = [aws_iam_role.lambda_execution_role.name]
}
2 changes: 1 addition & 1 deletion terraform/aws/modules/lambda/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ variable "name_prefix" {
}
variable "description" {
description = "description of the lambda-function"

}
2 changes: 1 addition & 1 deletion terraform/aws/modules/vpc/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ variable "ipv4_primary_cidr_block" {

variable "ipv4_additional_cidr_block_associations" {
type = list(string)
default = [""]
default = []
}

variable "instance_tenancy" {
Expand Down
8 changes: 4 additions & 4 deletions terraform/azure/examples/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ terraform {
provider "azurerm" {
features {}

client_id = " "
client_secret = " "
tenant_id = " "
subscription_id = " "
client_id = " "
client_secret = " "
tenant_id = " "
subscription_id = " "
skip_provider_registration = true
}
68 changes: 34 additions & 34 deletions terraform/azure/modules/vnet/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -42,52 +42,52 @@ variable "nsg_name" {

variable "inbound_rules" {
description = "A map of inbound security rules"
default = {
default = {
rule1 = {
name = "inbound_rule1"
priority = 100
access = "Allow"
protocol = "TCP"
source_port_range = "*"
destination_port_range = "80"
source_address_prefix = "1.2.3.4"
destination_address_prefix = "10.0.1.0/24"
name = "inbound_rule1"
priority = 100
access = "Allow"
protocol = "TCP"
source_port_range = "*"
destination_port_range = "80"
source_address_prefix = "1.2.3.4"
destination_address_prefix = "10.0.1.0/24"
}
}
type = map(object({
name = string
priority = number
access = string
protocol = string
source_port_range = string
destination_port_range = string
source_address_prefix = string
destination_address_prefix = string
name = string
priority = number
access = string
protocol = string
source_port_range = string
destination_port_range = string
source_address_prefix = string
destination_address_prefix = string
}))
}

variable "outbound_rules" {
description = "A map of outbound security rules"
default = {
default = {
rule1 = {
name = "outbound_rule1"
priority = 100
access = "Allow"
protocol = "TCP"
source_port_range = "*"
destination_port_range = "443"
source_address_prefix = "10.0.1.0/24"
destination_address_prefix = "5.6.7.8"
name = "outbound_rule1"
priority = 100
access = "Allow"
protocol = "TCP"
source_port_range = "*"
destination_port_range = "443"
source_address_prefix = "10.0.1.0/24"
destination_address_prefix = "5.6.7.8"
}
}
type = map(object({
name = string
priority = number
access = string
protocol = string
source_port_range = string
destination_port_range = string
source_address_prefix = string
destination_address_prefix = string
name = string
priority = number
access = string
protocol = string
source_port_range = string
destination_port_range = string
source_address_prefix = string
destination_address_prefix = string
}))
}
14 changes: 7 additions & 7 deletions terraform/azure/modules/vnet/vnet.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
resource "azurerm_resource_group" "resourcegroup" {
name = var.resource_group_name
location = var.location

tags = {
Name = var.resource_group_name
Environment = "${local.environment}"
Expand All @@ -19,7 +19,7 @@ resource "azurerm_virtual_network" "Vnet" {
tags = {
Name = var.vnet_name
Environment = "${local.environment}"
}
}
}

#To create subnets
Expand All @@ -29,18 +29,18 @@ resource "azurerm_subnet" "subnets" {
resource_group_name = azurerm_resource_group.resourcegroup.name
virtual_network_name = azurerm_virtual_network.Vnet.name
address_prefixes = [var.subnet_address_prefixes[count.index]]
}
}

#To create network security group
resource "azurerm_network_security_group" "default_nsg" {
name = var.nsg_name
location = var.location
resource_group_name = azurerm_resource_group.resourcegroup.name

tags = {
Name = var.nsg_name
Environment = "${local.environment}"
}
}
}

#To add inbound rules
Expand Down Expand Up @@ -68,10 +68,10 @@ resource "azurerm_network_security_rule" "outbound" {
priority = each.value.priority
direction = "Outbound"
access = each.value.access
protocol = each.value.protocol
protocol = each.value.protocol
source_port_range = each.value.source_port_range
destination_port_range = each.value.destination_port_range
source_address_prefix = each.value.source_address_prefix
source_address_prefix = each.value.source_address_prefix
destination_address_prefix = each.value.destination_address_prefix
resource_group_name = azurerm_resource_group.resourcegroup.name
network_security_group_name = azurerm_network_security_group.default_nsg.name
Expand Down
34 changes: 17 additions & 17 deletions terraform/gcp/examples/cloud_run_v2/main.tf
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
module "run_v2_service" {
source = "/.../.../gcp/modules/cloud_run_v2"
service_name = "test-service"
location = "asia-south1"
vpc_connector = "run-connector"
make_public = true
img_url = "us-docker.pkg.dev/cloudrun/container/hello"
source = "/.../.../gcp/modules/cloud_run_v2"
service_name = "test-service"
location = "asia-south1"
vpc_connector = "run-connector"
make_public = true
img_url = "us-docker.pkg.dev/cloudrun/container/hello"
container_port = 8080
}
}

module "run_v2_service2" {
source = "/.../.../gcp/modules/cloud_run_v2"
service_name = "test-service2"
location = "us-central1"
make_public = true
img_url = "dpage/pgadmin4"
source = "/.../.../gcp/modules/cloud_run_v2"
service_name = "test-service2"
location = "us-central1"
make_public = true
img_url = "dpage/pgadmin4"
min_instance_count = 1
max_instance_count = 3
container_port = 80
container_env = [{key = "PGADMIN_DEFAULT_EMAIL", value = "[email protected]"},
{key = "PGADMIN_DEFAULT_PASSWORD", value = "Admin123"},
{key = "PGADMIN_LISTEN_PORT", value = "80"}]
}
container_port = 80
container_env = [{ key = "PGADMIN_DEFAULT_EMAIL", value = "[email protected]" },
{ key = "PGADMIN_DEFAULT_PASSWORD", value = "Admin123" },
{ key = "PGADMIN_LISTEN_PORT", value = "80" }]
}



Expand Down