Skip to content

Instantly share code, notes, and snippets.

@fredericbarthelet
Created October 11, 2020 15:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save fredericbarthelet/8e809fb728e363abac5905c29af5e536 to your computer and use it in GitHub Desktop.
Save fredericbarthelet/8e809fb728e363abac5905c29af5e536 to your computer and use it in GitHub Desktop.
AWS intrinsic function resolution
import {
CloudFormationResource,
CloudFormationResources,
} from 'serverless/aws';
import { findKey } from 'lodash';
interface CloudFormationReference {
Ref: string;
}
export const ref = (
resources: CloudFormationResources,
referencedResource: CloudFormationResource,
): CloudFormationReference => {
return {
Ref: findKey(resources, (resource) => referencedResource === resource),
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment