Skip to content

Technical debt: Use internal/retry for tfresource.RetryWhenNewResourceNotFound #43412

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
c013784
tfresource.RetryWhenNewResourceNotFound: Use 'internal/retry'.
ewbankkit Jul 15, 2025
7719667
Add 'context.Context' arg to function called by 'tfresource.RetryWhen…
ewbankkit Jul 16, 2025
3f3cfdd
Add 'context.Context' arg to function called by 'tfresource.RetryWhen…
ewbankkit Jul 16, 2025
3360836
Add 'context.Context' arg to function called by 'tfresource.RetryWhen…
ewbankkit Jul 16, 2025
6540a2b
Add 'context.Context' arg to function called by 'tfresource.RetryWhen…
ewbankkit Jul 16, 2025
4a21f2f
Add 'context.Context' arg to function called by 'tfresource.RetryWhen…
ewbankkit Jul 16, 2025
e2c839f
Add 'context.Context' arg to function called by 'tfresource.RetryWhen…
ewbankkit Jul 16, 2025
a8c7fef
Add 'context.Context' arg to function called by 'tfresource.RetryWhen…
ewbankkit Jul 16, 2025
780e539
Add 'context.Context' arg to function called by 'tfresource.RetryWhen…
ewbankkit Jul 16, 2025
2986a0c
Add 'context.Context' arg to function called by 'tfresource.RetryWhen…
ewbankkit Jul 16, 2025
b99faee
Add 'context.Context' arg to function called by 'tfresource.RetryWhen…
ewbankkit Jul 16, 2025
46f7af2
Add 'context.Context' arg to function called by 'tfresource.RetryWhen…
ewbankkit Jul 16, 2025
a09820d
ec2: Use 'awstypes' alias consistently.
ewbankkit Jul 16, 2025
bd3cd90
ec2: Use 'RegionalARN(WithAccount)'.
ewbankkit Jul 16, 2025
64d7f4e
internal/retry: Don't overwrite any non-nil error with 'TimeoutError'.
ewbankkit Jul 16, 2025
3e8b36a
Add 'vpcARN'.
ewbankkit Jul 16, 2025
6851b11
Simplify.
ewbankkit Jul 17, 2025
50a50bc
Add 'securityGroupARN'.
ewbankkit Jul 17, 2025
325a42e
Add 'routeTableARN'.
ewbankkit Jul 17, 2025
69bba43
Add 'networkInterfaceARN'.
ewbankkit Jul 17, 2025
9e108cb
Run 'make fix-imports'.
ewbankkit Jul 17, 2025
23ec8a6
Add 'internetGatewayARN'.
ewbankkit Jul 17, 2025
23c9cde
Add 'networkACLARN'.
ewbankkit Jul 17, 2025
b228a0f
Add 'flowLogARN'.
ewbankkit Jul 17, 2025
3f75dda
Add 'dhcpOptionsARN'.
ewbankkit Jul 17, 2025
6186831
Add 'vpcEndpointServiceARN'.
ewbankkit Jul 17, 2025
b36da01
Add 'RegionalARNWithRegion'.
ewbankkit Jul 17, 2025
a45e87d
Add unit tests for 'AWSClient.GlobalARN*' and 'AWSClient.RegionalARN*'.
ewbankkit Jul 17, 2025
f728265
Add 'transitGatewayRouteTableARN'.
ewbankkit Jul 17, 2025
5ef8830
Add 'transitGatewayAttachmentARN'.
ewbankkit Jul 17, 2025
233aaeb
Use 'transitGatewayAttachmentARN' for peering attachments.
ewbankkit Jul 17, 2025
5440baa
Add 'transitGatewayConnectPeerARN'.
ewbankkit Jul 17, 2025
6b74e99
Add 'transitGatewayPolicyTableARN'.
ewbankkit Jul 17, 2025
0d1d93f
Use 'transitGatewayAttachmentARN' for attachment data sources.
ewbankkit Jul 17, 2025
bbccd85
Add 'amiARN'.
ewbankkit Jul 17, 2025
635e426
Add 'instanceARN'.
ewbankkit Jul 17, 2025
e155535
Add 'keyPairARN'.
ewbankkit Jul 17, 2025
5261aac
Add 'launchTemplateARN'.
ewbankkit Jul 17, 2025
5a8cdb4
Add 'hostARN'.
ewbankkit Jul 17, 2025
f0b1784
Add 'fleetARN' and 'placementGroupARN'.
ewbankkit Jul 17, 2025
e620bb2
Use 'ebsSnapshotARN'.
ewbankkit Jul 17, 2025
904caaf
Fix over-eager Q Developer 'amiARN' (no account ID).
ewbankkit Jul 17, 2025
f9d250e
Simplify.
ewbankkit Jul 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions internal/conns/awsclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,40 +117,45 @@ func (c *AWSClient) PartitionHostname(ctx context.Context, prefix string) string

// GlobalARN returns a global (no Region) ARN for the specified service namespace and resource.
func (c *AWSClient) GlobalARN(ctx context.Context, service, resource string) string {
return c.GlobalARNWithAccount(ctx, service, c.AccountID(ctx), resource)
return c.arn(ctx, service, "", c.AccountID(ctx), resource)
}

// GlobalARNNoAccount returns a global (no Region) ARN for the specified service namespace and resource without AWS account ID.
func (c *AWSClient) GlobalARNNoAccount(ctx context.Context, service, resource string) string {
return c.GlobalARNWithAccount(ctx, service, "", resource)
return c.arn(ctx, service, "", "", resource)
}

// GlobalARNWithAccount returns a global (no Region) ARN for the specified service namespace, resource and account ID.
func (c *AWSClient) GlobalARNWithAccount(ctx context.Context, service, accountID, resource string) string {
return arn.ARN{
Partition: c.Partition(ctx),
Service: service,
AccountID: accountID,
Resource: resource,
}.String()
return c.arn(ctx, service, "", accountID, resource)
}

// RegionalARN returns a regional ARN for the specified service namespace and resource.
func (c *AWSClient) RegionalARN(ctx context.Context, service, resource string) string {
return c.RegionalARNWithAccount(ctx, service, c.AccountID(ctx), resource)
return c.arn(ctx, service, c.Region(ctx), c.AccountID(ctx), resource)
}

// RegionalARNNoAccount returns a regional ARN for the specified service namespace and resource without AWS account ID.
func (c *AWSClient) RegionalARNNoAccount(ctx context.Context, service, resource string) string {
return c.RegionalARNWithAccount(ctx, service, "", resource)
return c.arn(ctx, service, c.Region(ctx), "", resource)
}

// RegionalARNWithAccount returns a regional ARN for the specified service namespace, resource and account ID.
func (c *AWSClient) RegionalARNWithAccount(ctx context.Context, service, accountID, resource string) string {
return c.arn(ctx, service, c.Region(ctx), accountID, resource)
}

// RegionalARNWithRegion returns a regional ARN for the specified service namespace, resource and account ID.
func (c *AWSClient) RegionalARNWithRegion(ctx context.Context, service, region, resource string) string {
return c.arn(ctx, service, region, c.AccountID(ctx), resource)
}

// arn returns an ARN for the specified service namespace, region, account ID and resource.
func (c *AWSClient) arn(ctx context.Context, service, region, accountID, resource string) string {
return arn.ARN{
Partition: c.Partition(ctx),
Service: service,
Region: c.Region(ctx),
Region: region,
AccountID: accountID,
Resource: resource,
}.String()
Expand Down
Loading
Loading