variable "security_group_id" {}
      data "aws_security_group" "${selected}" {
          id = "\${var.security_group}"
      resource "aws_subnet" "subnet" {
          vpc_id = "\${data.aws_security_group.${selected}.vpc_id}"
          cidr_block = ""
      Terraform language logo


      Terraform snippets

      The code creates a variable, security_group_id, that contains the id of the security group that is being selected. The data section sets the id of the subnet resource to the value that is returned from the variable.

      Shortcut: tf_aws_security_group


        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.