Yandex Cloud
Search
Contact UsTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
  • Marketplace
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 2026 Direct Cursus Technology L.L.C.
Terraform in Yandex Cloud
  • Getting started
  • Solution library
    • Overview
    • Release notes
          • vpc_address
          • vpc_gateway
          • vpc_network
          • vpc_private_endpoint
          • vpc_route_table
          • vpc_security_group
          • vpc_security_group_rule
          • vpc_subnet

In this article:

  • Example usage
  • Arguments & Attributes Reference
  1. Terraform reference
  2. Resources
  3. Virtual Private Cloud
  4. Data Sources
  5. vpc_security_group_rule

yandex_vpc_security_group_rule (DataSource)

Written by
Yandex Cloud
Updated at February 9, 2026
  • Example usage
  • Arguments & Attributes Reference

Example usageExample usage

//
// Get information about existing VPC Security Group Rule.
//
data "yandex_vpc_security_group_rule" "rule1" {
  security_group_binding = "my-sg-id"
  rule_id                = "my-rule-id"
}

Arguments & Attributes ReferenceArguments & Attributes Reference

  • description (String). The resource description.
  • direction (Required)(String). Direction of the Security group rule. Can be ingress (inbound network traffic to the VPC network) or egress (outbound network traffic from the VPC network).
  • from_port (Number). Minimum port number. Applicable for TCP and UDP protocols.
  • id (Read-Only) (String). The resource identifier.
  • labels (Map Of String). A set of key/value label pairs which assigned to resource.
  • port (Number). Port number (if applied to a single port).
  • predefined_target (String). Special-purpose targets. The self_security_group target refers to this particular security group. The loadbalancer_healthchecks target represents NLB health check nodes.
  • protocol (String). Specific network protocol. Can be one of ANY, TCP, UDP, ICMP, IPV6_ICMP.
  • rule_id (Required)(String).
  • security_group_binding (Required)(String). The id of target security group which rule belongs to.
  • security_group_id (String). Target security group ID for this Security group rule.
  • to_port (Number). Maximum port number. Applicable for TCP and UDP protocols.
  • v4_cidr_blocks (List Of String). The list of IPv4 CIDR prefixes for this Security group rule.
  • v6_cidr_blocks (List Of String). The list of IPv6 CIDR prefixes for this Security group rule. Not supported yet.

Was the article helpful?

Previous
vpc_security_group
Next
vpc_subnet
© 2026 Direct Cursus Technology L.L.C.