Skip to content

Commit c75447a

Browse files
dlutschDan LutschRyan Lymburner
authored
fix: Add VPC ID validation for RAM service network discovery (#858)
Adds validation in findServiceNetworkViaVPCAssociation() to ensure CLUSTER_VPC_ID environment variable is set before attempting to list VPC-to-Service Network associations. Provides clear error message when configuration is missing, making debugging easier for RAM-shared service network deployments. Co-authored-by: Dan Lutsch <dan.lutsch@trueaccord.com> Co-authored-by: Ryan Lymburner <137918933+rlymbur@users.noreply.github.com>
1 parent 17d50cc commit c75447a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pkg/aws/services/vpclattice.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,11 @@ func (d *defaultLattice) buildServiceNetworkInfo(ctx context.Context, snMatch *v
426426
// by examining VPC associations. This is used to discover RAM-shared
427427
// service networks that don't appear in ListServiceNetworks.
428428
func (d *defaultLattice) findServiceNetworkViaVPCAssociation(ctx context.Context, nameOrId string) (*ServiceNetworkInfo, error) {
429+
// Validate that VPC ID is configured
430+
if config.VpcID == "" {
431+
return nil, fmt.Errorf("cannot discover RAM-shared service networks: CLUSTER_VPC_ID environment variable is not set")
432+
}
433+
429434
// List all VPC-to-Service Network associations for the controller's VPC
430435
associations, err := d.ListServiceNetworkVpcAssociationsAsList(ctx,
431436
&vpclattice.ListServiceNetworkVpcAssociationsInput{

0 commit comments

Comments
 (0)