mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
provider/aws: Update tag support in AWS Elastic Network Interfaces
This commit is contained in:
parent
df514c9003
commit
a063ebe992
@ -33,6 +33,7 @@ IMPROVEMENTS:
|
|||||||
* **New config function: `split`** - Split a value based on a delimiter.
|
* **New config function: `split`** - Split a value based on a delimiter.
|
||||||
This is useful for faking lists as parameters to modules.
|
This is useful for faking lists as parameters to modules.
|
||||||
* **New resource: `digitalocean_ssh_key`** [GH-1074]
|
* **New resource: `digitalocean_ssh_key`** [GH-1074]
|
||||||
|
* **New resource: `aws_elastic_network_interfaces`** [GH-1149]
|
||||||
* core: The serial of the state is only updated if there is an actual
|
* core: The serial of the state is only updated if there is an actual
|
||||||
change. This will lower the amount of state changing on things
|
change. This will lower the amount of state changing on things
|
||||||
like refresh.
|
like refresh.
|
||||||
|
@ -124,8 +124,11 @@ func resourceAwsNetworkInterfaceRead(d *schema.ResourceData, meta interface{}) e
|
|||||||
d.Set("private_ips", flattenNetworkInterfacesPrivateIPAddesses(eni.PrivateIPAddresses))
|
d.Set("private_ips", flattenNetworkInterfacesPrivateIPAddesses(eni.PrivateIPAddresses))
|
||||||
d.Set("security_groups", flattenGroupIdentifiers(eni.Groups))
|
d.Set("security_groups", flattenGroupIdentifiers(eni.Groups))
|
||||||
|
|
||||||
|
// Tags
|
||||||
|
d.Set("tags", tagsToMap(eni.TagSet))
|
||||||
|
|
||||||
if eni.Attachment != nil {
|
if eni.Attachment != nil {
|
||||||
attachment := []map[string]interface{} { flattenAttachment(eni.Attachment) }
|
attachment := []map[string]interface{}{flattenAttachment(eni.Attachment)}
|
||||||
d.Set("attachment", attachment)
|
d.Set("attachment", attachment)
|
||||||
} else {
|
} else {
|
||||||
d.Set("attachment", nil)
|
d.Set("attachment", nil)
|
||||||
@ -185,7 +188,7 @@ func resourceAwsNetworkInterfaceDetach(oa *schema.Set, meta interface{}, eniId s
|
|||||||
}
|
}
|
||||||
|
|
||||||
func resourceAwsNetworkInterfaceUpdate(d *schema.ResourceData, meta interface{}) error {
|
func resourceAwsNetworkInterfaceUpdate(d *schema.ResourceData, meta interface{}) error {
|
||||||
|
ec2conn := meta.(*AWSClient).ec2conn
|
||||||
d.Partial(true)
|
d.Partial(true)
|
||||||
|
|
||||||
if d.HasChange("attachment") {
|
if d.HasChange("attachment") {
|
||||||
@ -220,7 +223,6 @@ func resourceAwsNetworkInterfaceUpdate(d *schema.ResourceData, meta interface{})
|
|||||||
Groups: expandStringList(d.Get("security_groups").(*schema.Set).List()),
|
Groups: expandStringList(d.Get("security_groups").(*schema.Set).List()),
|
||||||
}
|
}
|
||||||
|
|
||||||
ec2conn := meta.(*AWSClient).ec2conn
|
|
||||||
err := ec2conn.ModifyNetworkInterfaceAttribute(request)
|
err := ec2conn.ModifyNetworkInterfaceAttribute(request)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Failure updating ENI: %s", err)
|
return fmt.Errorf("Failure updating ENI: %s", err)
|
||||||
@ -229,6 +231,12 @@ func resourceAwsNetworkInterfaceUpdate(d *schema.ResourceData, meta interface{})
|
|||||||
d.SetPartial("security_groups")
|
d.SetPartial("security_groups")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := setTags(ec2conn, d); err != nil {
|
||||||
|
return err
|
||||||
|
} else {
|
||||||
|
d.SetPartial("tags")
|
||||||
|
}
|
||||||
|
|
||||||
d.Partial(false)
|
d.Partial(false)
|
||||||
|
|
||||||
return resourceAwsNetworkInterfaceRead(d, meta)
|
return resourceAwsNetworkInterfaceRead(d, meta)
|
||||||
|
@ -107,6 +107,10 @@ func testAccCheckAWSENIAttributes(conf *ec2.NetworkInterface) resource.TestCheck
|
|||||||
return fmt.Errorf("expected private ip to be 172.16.10.100, but was %s", *conf.PrivateIPAddress)
|
return fmt.Errorf("expected private ip to be 172.16.10.100, but was %s", *conf.PrivateIPAddress)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(conf.TagSet) == 0 {
|
||||||
|
return fmt.Errorf("expected tags")
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user