|
| 1 | +# security_group_inputs Version: 1 |
| 2 | +# |
| 3 | +# Copy this file from https://github.com/cloudposse/terraform-aws-security-group/blob/master/exports/security_group_inputs.tf |
| 4 | +# and EDIT IT TO SUIT YOUR PROJECT. Update the version number above if you update this file from a later version. |
| 5 | +# |
| 6 | +# KEEP this top comment block, but REMOVE COMMENTS below that are intended |
| 7 | +# for the initial implementor and not maintainers or end users. |
| 8 | +# |
| 9 | +# This file provides the standard inputs that all Cloud Posse Open Source |
| 10 | +# Terraform module that create AWS Security Groups should implement. |
| 11 | +# This file does NOT provide implementation of the inputs, as that |
| 12 | +# of course varies with each module. |
| 13 | +# |
| 14 | +# This file documents, but does not declare, the standard outputs modules should create, |
| 15 | +# again because the implementation will vary with modules. |
| 16 | +# |
| 17 | +# Unlike null-label context.tf, this file cannot be automatically updated |
| 18 | +# because of the tight integration with the module using it. |
| 19 | +# |
| 20 | + |
| 21 | + |
| 22 | +variable "create_security_group" { |
| 23 | + type = bool |
| 24 | + default = true |
| 25 | + description = "Set `true` to create and configure a new security group. If false, `associated_security_group_ids` must be provided." |
| 26 | +} |
| 27 | + |
| 28 | +variable "associated_security_group_ids" { |
| 29 | + type = list(string) |
| 30 | + default = [] |
| 31 | + description = <<-EOT |
| 32 | + A list of IDs of Security Groups to associate the created resource with, in addition to the created security group. |
| 33 | + These security groups will not be modified and, if `create_security_group` is `false`, must have rules providing the desired access. |
| 34 | + EOT |
| 35 | +} |
| 36 | + |
| 37 | +variable "allowed_security_group_ids" { |
| 38 | + type = list(string) |
| 39 | + default = [] |
| 40 | + description = <<-EOT |
| 41 | + A list of IDs of Security Groups to allow access to the security group created by this module. |
| 42 | + EOT |
| 43 | +} |
| 44 | + |
| 45 | +locals { |
| 46 | + allowed_security_group_ids = concat(var.security_groups, var.allowed_security_group_ids) |
| 47 | +} |
| 48 | + |
| 49 | +variable "security_group_name" { |
| 50 | + type = list(string) |
| 51 | + default = [] |
| 52 | + description = <<-EOT |
| 53 | + The name to assign to the created security group. Must be unique within the VPC. |
| 54 | + If not provided, will be derived from the `null-label.context` passed in. |
| 55 | + If `create_before_destroy` is true, will be used as a name prefix. |
| 56 | + EOT |
| 57 | +} |
| 58 | + |
| 59 | +variable "security_group_description" { |
| 60 | + type = string |
| 61 | + default = null |
| 62 | + description = <<-EOT |
| 63 | + The description to assign to the created Security Group. |
| 64 | + Warning: Changing the description causes the security group to be replaced. |
| 65 | + EOT |
| 66 | +} |
| 67 | + |
| 68 | +variable "security_group_create_before_destroy" { |
| 69 | + type = bool |
| 70 | + |
| 71 | + default = false |
| 72 | + description = <<-EOT |
| 73 | + Set `true` to enable Terraform `create_before_destroy` behavior on the created security group. |
| 74 | + We recommend setting this `true` on new security groups, but default it to `false` because `true` |
| 75 | + will cause existing security groups to be replaced, possibly requiring the cluster to be deleted and recreated. |
| 76 | + Note that changing this value will always cause the security group to be replaced. |
| 77 | + EOT |
| 78 | +} |
| 79 | + |
| 80 | +variable "security_group_create_timeout" { |
| 81 | + type = string |
| 82 | + default = "10m" |
| 83 | + description = "How long to wait for the security group to be created." |
| 84 | +} |
| 85 | + |
| 86 | +variable "security_group_delete_timeout" { |
| 87 | + type = string |
| 88 | + default = "15m" |
| 89 | + description = <<-EOT |
| 90 | + How long to retry on `DependencyViolation` errors during security group deletion from |
| 91 | + lingering ENIs left by certain AWS services such as Elastic Load Balancing. |
| 92 | + EOT |
| 93 | +} |
| 94 | + |
| 95 | +variable "additional_security_group_rules" { |
| 96 | + type = list(any) |
| 97 | + default = [] |
| 98 | + description = <<-EOT |
| 99 | + A list of Security Group rule objects to add to the created security group, in addition to the ones |
| 100 | + this module normally creates. (To suppress the module's rules, set `create_security_group` to false |
| 101 | + and supply your own security group via `associated_security_group_ids`.) |
| 102 | + The keys and values of the objects are fully compatible with the `aws_security_group_rule` resource, except |
| 103 | + for `security_group_id` which will be ignored, and the optional "key" which, if provided, must be unique and known at "plan" time. |
| 104 | + To get more info see https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule . |
| 105 | + EOT |
| 106 | +} |
0 commit comments