title: How do I force terraform to recreate a resource?
body: <p>I have two resources:</p>
  <pre><code>resource &quot;aws_lightsail_instance&quot; &quot;myserver-sig&quot; {
    name              = &quot;myserver-Sig&quot;
    availability_zone = &quot;eu-west-2a&quot;
    blueprint_id      = &quot;ubuntu_20_04&quot;
    bundle_id         = &quot;nano_2_0&quot;
    key_pair_name     = &quot;LightsailDefaultKeyPair&quot;
  }
  </code></pre>
  <p>and</p>
  <pre><code>resource &quot;aws_lightsail_instance_public_ports&quot; &quot;myserver-sig-public-ports&quot; {
    instance_name = aws_lightsail_instance.myserver-sig.name
    port_info {
      protocol  = &quot;tcp&quot;
      from_port = 443
      to_port   = 443
    }
    port_info {
      protocol  = &quot;tcp&quot;
      from_port = 80
      to_port   = 80
    }
    depends_on = [
      aws_lightsail_instance.myserver-sig,
    ]
  }
  </code></pre>
  <p>When I first run <code>terraform apply</code> both resources are created.</p>
  <p>If I want to replace the <code>aws_lightsail_instance</code> with a new version then the <code>aws_lightsail_instance</code> will redeploy, but the <code>aws_lightsail_instance_public_ports</code> will not because the ports haven't changed.</p>
  <p>However as part of the deploy of <code>aws_lightsail_instance</code> it changes the public ports to close 443 and open 22. This means that the end state of the redeploy of the <code>aws_lightsail_instance</code> is that port 443 is closed.</p>
  <p>If I run <code>terraform apply</code> again then it will correctly replace <code>aws_lightsail_instance_public_ports</code> opening port 443</p>
  <p>How do I force a recreation of the <code>aws_lightsail_instance_public_ports</code> resource so that I only have to run <code>terraform apply</code> once?</p>