title: Is setting an attribute to null the same as not setting it in Terraform configuration?
body: <p>I was looking at the code of terraform VPC module and found</p>
  <pre><code>resource &quot;aws_subnet&quot; &quot;public&quot; {
     vpc_id     = aws_vpc_ipv4_cidr_block_association.secondary_cidr.vpc_id
     cidr_block = &quot;172.2.0.0/24&quot;
     availability_zone = null
  }
  </code></pre>
  <p><code>availability_zone</code> attribute is optional based on the <a href="https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/subnet" rel="nofollow noreferrer">docs</a> of AWS provider.</p>
  <p>Is setting <code>availability_zone</code> to <code>null</code> is the same as not listing it all? For example, this is the same way to write the following configuration:</p>
  <pre><code>resource &quot;aws_subnet&quot; &quot;in_secondary_cidr&quot; {
    vpc_id     = aws_vpc_ipv4_cidr_block_association.secondary_cidr.vpc_id
    cidr_block = &quot;172.2.0.0/24&quot;
  }
  </code></pre>
  <p>I've never seen it before. Seems like it's a popular way to declare an optional variable in a module:</p>
  <pre><code>variable &quot;private_subnet_assign_ipv6_address_on_creation&quot; {
    description = &quot;Assign IPv6 address on private subnet, must be disabled to change IPv6 CIDRs. This is the IPv6 equivalent of map_public_ip_on_launch&quot;
    type        = bool
    default     = null
  }
  </code></pre>