Skip to content

Commit

Permalink
appsync is manually configured
Browse files Browse the repository at this point in the history
  • Loading branch information
gdavison committed Jun 20, 2024
1 parent 4968083 commit e1a5b36
Showing 1 changed file with 11 additions and 21 deletions.
32 changes: 11 additions & 21 deletions internal/service/appsync/service_package.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
"github.com/aws/aws-sdk-go-v2/aws/retry"
"github.com/aws/aws-sdk-go-v2/service/appsync"
awstypes "github.com/aws/aws-sdk-go-v2/service/appsync/types"
"github.com/hashicorp/terraform-plugin-log/tflog"
"github.com/hashicorp/terraform-provider-aws/internal/conns"
"github.com/hashicorp/terraform-provider-aws/internal/errs"
"github.com/hashicorp/terraform-provider-aws/names"
Expand All @@ -20,24 +19,15 @@ import (
func (p *servicePackage) NewClient(ctx context.Context, config map[string]any) (*appsync.Client, error) {
cfg := *(config["aws_sdkv2_config"].(*aws.Config))

return appsync.NewFromConfig(cfg, func(o *appsync.Options) {
if endpoint := config[names.AttrEndpoint].(string); endpoint != "" {
tflog.Debug(ctx, "setting endpoint", map[string]any{
"tf_aws.endpoint": endpoint,
})
o.BaseEndpoint = aws.String(endpoint)

if o.EndpointOptions.UseFIPSEndpoint == aws.FIPSEndpointStateEnabled {
tflog.Debug(ctx, "endpoint set, ignoring UseFIPSEndpoint setting")
o.EndpointOptions.UseFIPSEndpoint = aws.FIPSEndpointStateDisabled
}
}

o.Retryer = conns.AddIsErrorRetryables(cfg.Retryer().(aws.RetryerV2), retry.IsErrorRetryableFunc(func(err error) aws.Ternary {
if errs.IsAErrorMessageContains[*awstypes.ConcurrentModificationException](err, "a GraphQL API creation is already in progress") {
return aws.TrueTernary
}
return aws.UnknownTernary // Delegate to configured Retryer.
}))
}), nil
return appsync.NewFromConfig(cfg,
appsync.WithEndpointResolverV2(newEndpointResolverSDKv2()),
withBaseEndpoint(config[names.AttrEndpoint].(string)),
func(o *appsync.Options) {
o.Retryer = conns.AddIsErrorRetryables(cfg.Retryer().(aws.RetryerV2), retry.IsErrorRetryableFunc(func(err error) aws.Ternary {
if errs.IsAErrorMessageContains[*awstypes.ConcurrentModificationException](err, "a GraphQL API creation is already in progress") {
return aws.TrueTernary
}
return aws.UnknownTernary // Delegate to configured Retryer.
}))
}), nil
}

0 comments on commit e1a5b36

Please sign in to comment.