Yandex Cloud
Search
Contact UsGet started
  • Pricing
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • AI for business
    • Business tools
  • 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
  • Pricing
  • Customer Stories
  • Documentation
  • Blog
© 2025 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
  • Argument Reference
  • Attributes Reference
  1. Terraform reference
  2. Resources
  3. Virtual Private Cloud (VPC)
  4. Data Sources
  5. vpc_security_group_rule

yandex_vpc_security_group_rule (Data Source)

Written by
Yandex Cloud
Updated at August 7, 2025
  • Example usage
  • Argument Reference
  • Attributes Reference

Get information about a Yandex VPC Security Group Rule. For more information, see Yandex Cloud VPC.

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"
}

This data source used to define Security Group Rule that can be used by other resources.

Argument ReferenceArgument Reference

The following arguments are supported:

  • security_group_binding (Required) - ID of Security Group that owns the rule.
  • rule_id - (Required) - ID of the Security Group Rule.

Attributes ReferenceAttributes Reference

The following attribute is exported:

  • description - Description of the rule.
  • direction - Direction of the rule. Can be ingress (inbound) or egress (outbound).
  • labels - Labels to assign to this rule.
  • protocol - One of ANY, TCP, UDP, ICMP, IPV6_ICMP.
  • from_port - Minimum port number.
  • to_port - Maximum port number.
  • port - Port number (if applied to a single port).
  • security_group_id - Target security group ID for this rule.
  • predefined_target - Special-purpose targets. self_security_group refers to this particular security group. loadbalancer_healthchecks represents loadbalancer health check nodes.
  • v4_cidr_blocks - The blocks of IPv4 addresses for this rule.
  • v6_cidr_blocks - The blocks of IPv6 addresses for this rule.

Was the article helpful?

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