diff --git a/src/utils/configure-aws.ts b/src/utils/configure-aws.ts index 37ac234..f61e07f 100644 --- a/src/utils/configure-aws.ts +++ b/src/utils/configure-aws.ts @@ -68,11 +68,23 @@ function isValidEndpointUrl(url: string | undefined): boolean { } } -function checkIfConfigNeedsOverride(section: IniSection | undefined): boolean { +async function checkIfConfigNeedsOverride( + section: IniSection | undefined, +): Promise { if (!section) { return true; // profile doesn't exist } + if ( + section.properties.endpoint_url === "http://localhost.localstack.cloud:4566" + ) { + const isDnsResolved = await dnsResolveCheck(undefined); + if (!isDnsResolved) { + // if DNS is not resolved, we need to override the endpoint_url + return true; + } + } + return !( section.properties.region && section.properties.endpoint_url && @@ -317,7 +329,7 @@ export async function configureAwsProfiles(options: { let configModified: boolean | undefined; let credentialsModified: boolean | undefined; - const configNeedsOverride = checkIfConfigNeedsOverride(configSection); + const configNeedsOverride = await checkIfConfigNeedsOverride(configSection); const credentialsNeedsOverride = checkIfCredentialsNeedsOverride(credentialsSection);