mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
providers/aws: if a VPC doesn't exist, then remove from state
This commit is contained in:
parent
3093268106
commit
cf5697ff32
@ -57,7 +57,6 @@ func resourceAwsVpc() *schema.Resource {
|
||||
Computed: true,
|
||||
},
|
||||
|
||||
|
||||
"tags": tagsSchema(),
|
||||
},
|
||||
}
|
||||
@ -68,7 +67,7 @@ func resourceAwsVpcCreate(d *schema.ResourceData, meta interface{}) error {
|
||||
|
||||
// Create the VPC
|
||||
createOpts := &ec2.CreateVpc{
|
||||
CidrBlock: d.Get("cidr_block").(string),
|
||||
CidrBlock: d.Get("cidr_block").(string),
|
||||
InstanceTenancy: d.Get("instance_tenancy").(string),
|
||||
}
|
||||
log.Printf("[DEBUG] VPC create config: %#v", createOpts)
|
||||
@ -115,6 +114,7 @@ func resourceAwsVpcRead(d *schema.ResourceData, meta interface{}) error {
|
||||
return err
|
||||
}
|
||||
if vpcRaw == nil {
|
||||
d.SetId("")
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -243,8 +243,7 @@ func VPCStateRefreshFunc(conn *ec2.EC2, id string) resource.StateRefreshFunc {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func resourceAwsVpcSetDefaultNetworkAcl(conn *ec2.EC2, d *schema.ResourceData) error {
|
||||
func resourceAwsVpcSetDefaultNetworkAcl(conn *ec2.EC2, d *schema.ResourceData) error {
|
||||
filter := ec2.NewFilter()
|
||||
filter.Add("default", "true")
|
||||
filter.Add("vpc-id", d.Id())
|
||||
@ -260,7 +259,7 @@ func resourceAwsVpcSetDefaultNetworkAcl(conn *ec2.EC2, d *schema.ResourceData) e
|
||||
return nil
|
||||
}
|
||||
|
||||
func resourceAwsVpcSetDefaultSecurityGroup(conn *ec2.EC2, d *schema.ResourceData) error {
|
||||
func resourceAwsVpcSetDefaultSecurityGroup(conn *ec2.EC2, d *schema.ResourceData) error {
|
||||
filter := ec2.NewFilter()
|
||||
filter.Add("group-name", "default")
|
||||
filter.Add("vpc-id", d.Id())
|
||||
|
Loading…
Reference in New Issue
Block a user