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,
|
Computed: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
"tags": tagsSchema(),
|
"tags": tagsSchema(),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -68,7 +67,7 @@ func resourceAwsVpcCreate(d *schema.ResourceData, meta interface{}) error {
|
||||||
|
|
||||||
// Create the VPC
|
// Create the VPC
|
||||||
createOpts := &ec2.CreateVpc{
|
createOpts := &ec2.CreateVpc{
|
||||||
CidrBlock: d.Get("cidr_block").(string),
|
CidrBlock: d.Get("cidr_block").(string),
|
||||||
InstanceTenancy: d.Get("instance_tenancy").(string),
|
InstanceTenancy: d.Get("instance_tenancy").(string),
|
||||||
}
|
}
|
||||||
log.Printf("[DEBUG] VPC create config: %#v", createOpts)
|
log.Printf("[DEBUG] VPC create config: %#v", createOpts)
|
||||||
|
@ -115,6 +114,7 @@ func resourceAwsVpcRead(d *schema.ResourceData, meta interface{}) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if vpcRaw == nil {
|
if vpcRaw == nil {
|
||||||
|
d.SetId("")
|
||||||
return nil
|
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 := ec2.NewFilter()
|
||||||
filter.Add("default", "true")
|
filter.Add("default", "true")
|
||||||
filter.Add("vpc-id", d.Id())
|
filter.Add("vpc-id", d.Id())
|
||||||
|
@ -260,7 +259,7 @@ func resourceAwsVpcSetDefaultNetworkAcl(conn *ec2.EC2, d *schema.ResourceData) e
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func resourceAwsVpcSetDefaultSecurityGroup(conn *ec2.EC2, d *schema.ResourceData) error {
|
func resourceAwsVpcSetDefaultSecurityGroup(conn *ec2.EC2, d *schema.ResourceData) error {
|
||||||
filter := ec2.NewFilter()
|
filter := ec2.NewFilter()
|
||||||
filter.Add("group-name", "default")
|
filter.Add("group-name", "default")
|
||||||
filter.Add("vpc-id", d.Id())
|
filter.Add("vpc-id", d.Id())
|
||||||
|
|
Loading…
Reference in New Issue