Skip to content

Commit

Permalink
[datadog_integration_aws_tag_filter] Prevent concurrency issues with …
Browse files Browse the repository at this point in the history
…mutex (#2063)
  • Loading branch information
nkzou authored Aug 18, 2023
1 parent 5f73c31 commit f19a115
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions datadog/resource_datadog_integration_aws_tag_filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ func resourceDatadogIntegrationAwsTagFilterCreate(ctx context.Context, d *schema
providerConf := meta.(*ProviderConfiguration)
apiInstances := providerConf.DatadogApiInstances
auth := providerConf.Auth
integrationAwsMutex.Lock()
defer integrationAwsMutex.Unlock()

req := buildDatadogIntegrationAwsTagFilter(d)
if _, httpresp, err := apiInstances.GetAWSIntegrationApiV1().CreateAWSTagFilter(auth, *req); err != nil {
Expand All @@ -81,6 +83,8 @@ func resourceDatadogIntegrationAwsTagFilterUpdate(ctx context.Context, d *schema
providerConf := meta.(*ProviderConfiguration)
apiInstances := providerConf.DatadogApiInstances
auth := providerConf.Auth
integrationAwsMutex.Lock()
defer integrationAwsMutex.Unlock()

req := buildDatadogIntegrationAwsTagFilter(d)
if _, httpresp, err := apiInstances.GetAWSIntegrationApiV1().CreateAWSTagFilter(auth, *req); err != nil {
Expand Down Expand Up @@ -128,6 +132,8 @@ func resourceDatadogIntegrationAwsTagFilterDelete(ctx context.Context, d *schema
providerConf := meta.(*ProviderConfiguration)
apiInstances := providerConf.DatadogApiInstances
auth := providerConf.Auth
integrationAwsMutex.Lock()
defer integrationAwsMutex.Unlock()

accountID, tfNamespace, err := utils.AccountAndNamespaceFromID(d.Id())
if err != nil {
Expand Down

0 comments on commit f19a115

Please sign in to comment.