sg rule add

This commit is contained in:
2022-12-28 22:50:49 +09:00
parent 0b1946ecb3
commit 6fab570c69
6 changed files with 80 additions and 16 deletions

View File

@ -1,11 +1,13 @@
resource "aws_security_group_rule" "sg-rule-add" {
description = "Security groups rule add"
# description = "Security groups rule add"
type = var.type
from_port = var.set_ports.http
to_port = var.set_ports.http
protocol = var.set_ports.protocol_tcp #tcp
from_port = var.from_port
to_port = var.to_port
protocol = var.protocol
cidr_blocks = var.cidr_blocks
security_group_id = var.sg_id
security_group_id = var.security_group_id
description = "${var.tag_name}-sg-rule"
}

View File

@ -1,10 +0,0 @@
//sg-output
output "vpc_hq_id" {
description = "The name of vpc hq id"
value = aws_vpc.vpc-hq.id
}
output "vpc_name" {
value = var.tag_name
}

View File

@ -6,3 +6,23 @@ variable "from_port" {
description = "from port"
type = number
}
variable "to_port" {
description = "to_port"
type = number
}
variable "protocol" {
description = "protocol"
type = string
}
variable "cidr_blocks" {
description = "cidr_blocks"
type = list(string)
}
variable "security_group_id" {
}
variable "tag_name" {
description = "tag_name"
type = string
}

View File

@ -1,5 +1,6 @@
resource "aws_security_group" "sg" {
description = "Security groups"
name = var.sg_name
vpc_id = var.vpc_id
}

View File

@ -2,3 +2,8 @@ variable "sg_name" {
description = "security group name"
type = string
}
variable "vpc_id" {
description = "vpc_id"
type = string
}