diff --git a/example/main.tf b/example/main.tf new file mode 100644 index 0000000..e77a10e --- /dev/null +++ b/example/main.tf @@ -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 +} diff --git a/example/providers.tf b/example/providers.tf new file mode 100644 index 0000000..e5cfc8d --- /dev/null +++ b/example/providers.tf @@ -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 +} \ No newline at end of file diff --git a/example/terraform.tfvars b/example/terraform.tfvars new file mode 100644 index 0000000..2ae77cc --- /dev/null +++ b/example/terraform.tfvars @@ -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" +# } +# } +# ] diff --git a/example/variables.tf b/example/variables.tf new file mode 100644 index 0000000..6b2ee76 --- /dev/null +++ b/example/variables.tf @@ -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 +}