example stage to test modules
This commit is contained in:
parent
4e9fc826bf
commit
45df23a750
4 changed files with 131 additions and 0 deletions
32
example/main.tf
Normal file
32
example/main.tf
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
module "icmp_group" {
|
||||||
|
source = "../security-group"
|
||||||
|
project_id = var.project_id
|
||||||
|
name = "icmp"
|
||||||
|
}
|
||||||
|
|
||||||
|
module "ssh_group" {
|
||||||
|
source = "../security-group"
|
||||||
|
project_id = var.project_id
|
||||||
|
name = "ssh"
|
||||||
|
}
|
||||||
|
|
||||||
|
module "icmp_ingress" {
|
||||||
|
source = "../security-group-rule"
|
||||||
|
project_id = var.project_id
|
||||||
|
security_group_id = module.icmp_group.id
|
||||||
|
rules = var.icmp_ingress_rules
|
||||||
|
}
|
||||||
|
|
||||||
|
module "icmp_egress" {
|
||||||
|
source = "../security-group-rule"
|
||||||
|
project_id = var.project_id
|
||||||
|
security_group_id = module.icmp_group.id
|
||||||
|
rules = var.icmp_egress_rules
|
||||||
|
}
|
||||||
|
|
||||||
|
module "ssh_ingress" {
|
||||||
|
source = "../security-group-rule"
|
||||||
|
project_id = var.project_id
|
||||||
|
security_group_id = module.ssh_group.id
|
||||||
|
rules = var.ssh_ingress_rules
|
||||||
|
}
|
||||||
15
example/providers.tf
Normal file
15
example/providers.tf
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
terraform {
|
||||||
|
required_version = ">= 1.9.0"
|
||||||
|
required_providers {
|
||||||
|
stackit = {
|
||||||
|
source = "stackitcloud/stackit"
|
||||||
|
version = "0.56.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
provider "stackit" {
|
||||||
|
default_region = var.region
|
||||||
|
service_account_token = var.service_account_token
|
||||||
|
enable_beta_resources = true
|
||||||
|
}
|
||||||
56
example/terraform.tfvars
Normal file
56
example/terraform.tfvars
Normal file
|
|
@ -0,0 +1,56 @@
|
||||||
|
region = "eu01"
|
||||||
|
service_account_token = ""
|
||||||
|
project_id = ""
|
||||||
|
|
||||||
|
# icmp_ingress_rules = [
|
||||||
|
# {
|
||||||
|
# direction = "ingress"
|
||||||
|
# description = "ICMP RULE 1"
|
||||||
|
# ip_range = "0.0.0.0/0"
|
||||||
|
# protocol = {
|
||||||
|
# name = "icmp"
|
||||||
|
# }
|
||||||
|
# icmp_parameters = {
|
||||||
|
# type = 8,
|
||||||
|
# code = 0
|
||||||
|
# }
|
||||||
|
# },
|
||||||
|
# {
|
||||||
|
# direction = "ingress"
|
||||||
|
# description = "ICMP RULE 2"
|
||||||
|
# ip_range = "1.2.3.4/0"
|
||||||
|
# protocol = {
|
||||||
|
# name = "icmp"
|
||||||
|
# }
|
||||||
|
# icmp_parameters = {
|
||||||
|
# type = 8,
|
||||||
|
# code = 0
|
||||||
|
# }
|
||||||
|
# }
|
||||||
|
# ]
|
||||||
|
|
||||||
|
# ssh_ingress_rules = [
|
||||||
|
# {
|
||||||
|
# direction = "ingress"
|
||||||
|
# description = "SSH RULE 1"
|
||||||
|
# ip_range = "10.1.10.1/24"
|
||||||
|
# port_range = {
|
||||||
|
# min = 22,
|
||||||
|
# max = 22
|
||||||
|
# }
|
||||||
|
# protocol = {
|
||||||
|
# name = "tcp"
|
||||||
|
# }
|
||||||
|
# }
|
||||||
|
# ]
|
||||||
|
|
||||||
|
# icmp_egress_rules = [
|
||||||
|
# {
|
||||||
|
# direction = "egress"
|
||||||
|
# description = "ICMP EGRESS RULE 1"
|
||||||
|
# ip_range = "0.0.0.0/0"
|
||||||
|
# protocol = {
|
||||||
|
# name = "icmp"
|
||||||
|
# }
|
||||||
|
# }
|
||||||
|
# ]
|
||||||
28
example/variables.tf
Normal file
28
example/variables.tf
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
variable "region" {
|
||||||
|
description = "Region for the STACKIT Cloud"
|
||||||
|
type = string
|
||||||
|
default = "eu01"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "project_id" {
|
||||||
|
description = "STACKIT Cloud project ID"
|
||||||
|
type = string
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "service_account_token" {
|
||||||
|
description = "Service account token for authentication"
|
||||||
|
sensitive = true
|
||||||
|
type = string
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "icmp_ingress_rules" {
|
||||||
|
type = any
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "icmp_egress_rules" {
|
||||||
|
type = any
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "ssh_ingress_rules" {
|
||||||
|
type = any
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue