diff --git a/aws/resource_aws_ec2_client_vpn_endpoint.go b/aws/resource_aws_ec2_client_vpn_endpoint.go index 6352e65e163..b7cc304189a 100644 --- a/aws/resource_aws_ec2_client_vpn_endpoint.go +++ b/aws/resource_aws_ec2_client_vpn_endpoint.go @@ -8,6 +8,7 @@ import ( "github.com/aws/aws-sdk-go/service/ec2" "github.com/hashicorp/terraform-plugin-sdk/helper/schema" "github.com/hashicorp/terraform-plugin-sdk/helper/validation" + "github.com/terraform-providers/terraform-provider-aws/aws/internal/keyvaluetags" ) func resourceAwsEc2ClientVpnEndpoint() *schema.Resource { @@ -240,7 +241,7 @@ func resourceAwsEc2ClientVpnEndpointRead(d *schema.ResourceData, meta interface{ return fmt.Errorf("error setting connection_log_options: %s", err) } - err = d.Set("tags", tagsToMap(result.ClientVpnEndpoints[0].Tags)) + err = d.Set("tags", keyvaluetags.Ec2KeyValueTags(result.ClientVpnEndpoints[0].Tags).IgnoreAws().Map()) if err != nil { return fmt.Errorf("error setting tags: %s", err) } @@ -324,10 +325,13 @@ func resourceAwsEc2ClientVpnEndpointUpdate(d *schema.ResourceData, meta interfac return fmt.Errorf("Error modifying Client VPN endpoint: %s", err) } - if err := setTags(conn, d); err != nil { - return err + if d.HasChange("tags") { + o, n := d.GetChange("tags") + + if err := keyvaluetags.Ec2UpdateTags(conn, d.Id(), o, n); err != nil { + return fmt.Errorf("error updating EC2 Client VPN Endpoint (%s) tags: %s", d.Id(), err) + } } - d.SetPartial("tags") d.Partial(false) return resourceAwsEc2ClientVpnEndpointRead(d, meta)