- Create Security Group and rules in your VPC
- Output Security Group ID for referencing
Use ingress_rules_with_cidrs
to add rules with IP address ranges.
Use ingress_rules_with_sg_ids
to add rules with other SGs as a traffic source.
Use self
to add rule "self_security_group" for communication within a SG.
- Install YC CLI
- Add environment variables for terraform auth in Yandex Cloud:
export YC_TOKEN=$(yc iam create-token)
export YC_CLOUD_ID=$(yc config get cloud-id)
export YC_FOLDER_ID=$(yc config get folder-id)
Name | Version |
---|---|
terraform | >= 1.0.0 |
yandex | > 0.8 |
Name | Version |
---|---|
yandex | 0.90.0 |
No modules.
Name | Type |
---|---|
yandex_vpc_security_group.this | resource |
yandex_vpc_security_group_rule.egress_rules | resource |
yandex_vpc_security_group_rule.ingress_nlb_hc_rule | resource |
yandex_vpc_security_group_rule.ingress_rules_with_cidrs | resource |
yandex_vpc_security_group_rule.ingress_rules_with_sg_ids | resource |
yandex_vpc_security_group_rule.ingress_self_rule | resource |
yandex_client_config.client | data source |
Name | Description | Type | Default | Required |
---|---|---|---|---|
egress_rules | Security group egress rules with CIDRs. Example: egress_rules = [ |
any |
n/a | yes |
folder_id | Folder ID where the resources will be created | string |
null |
no |
ingress_rules_with_cidrs | Security group rules with CIDRs as a source. Example: ingress_rules_with_cidrs = [ |
any |
n/a | yes |
ingress_rules_with_sg_ids | Security group rules with other SG-id as a source. Example: ingress_rules_with_sg_ids = [ |
any |
n/a | yes |
labels | Set of key/value label pairs to assign. | map(string) |
null |
no |
name | Security group name | string |
n/a | yes |
network_id | Existing network where resources will be created | string |
null |
no |
nlb_hc | Allow to communicate with NLB health check servers | bool |
false |
no |
self | Allow to communicate inside security group | bool |
true |
no |
self_from_port | Allow to communicate within security group with port from | number |
null |
no |
self_port | Allow to communicaten within security group with port | number |
null |
no |
self_protocol | Allow to communicate within security group with protocol | string |
"ANY" |
no |
self_to_port | Allow to communicate within security group with port to | number |
null |
no |
Name | Description |
---|---|
id | Security group ID |