From b39292c5dc2ee2ad5670a3d8c90ea48b1fa87d75 Mon Sep 17 00:00:00 2001 From: Chris Piraino Date: Fri, 22 Oct 2021 09:15:08 -0500 Subject: [PATCH] Update source channel with metadata on hcp_aws_network_peering --- internal/provider/resource_aws_network_peering.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/provider/resource_aws_network_peering.go b/internal/provider/resource_aws_network_peering.go index d1aad0d78..4c1ddb6d3 100644 --- a/internal/provider/resource_aws_network_peering.go +++ b/internal/provider/resource_aws_network_peering.go @@ -105,6 +105,13 @@ func resourceAwsNetworkPeering() *schema.Resource { func resourceAwsNetworkPeeringCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { client := meta.(*clients.Client) + var err error + // Updates the source channel to include data about the module used. + client, err = client.UpdateSourceChannel(d) + if err != nil { + log.Printf("[DEBUG] Failed to update analytics with module name (%s)", err) + } + peeringID := d.Get("peering_id").(string) hvnID := d.Get("hvn_id").(string) peerAccountID := d.Get("peer_account_id").(string) @@ -117,7 +124,7 @@ func resourceAwsNetworkPeeringCreate(ctx context.Context, d *schema.ResourceData } // Check for an existing HVN - _, err := clients.GetHvnByID(ctx, client, loc, hvnID) + _, err = clients.GetHvnByID(ctx, client, loc, hvnID) if err != nil { if clients.IsResponseCodeNotFound(err) { return diag.Errorf("unable to find the HVN (%s) for the network peering", hvnID)