How to use the cloudform.Fn.GetAtt function in cloudform

To help you get started, we’ve selected a few cloudform examples, based on popular ways it is used in public projects.

github matthewkeil / nomad-devops / aws / server.ts View on Github external
if (branch === "master") {
        (template.Resources as any).RecordSet = ServerRecordSet;
        (template.Resources as any).DomainName = DomainName;

        (template as any).Outputs.DistributionDomainName = {
            Description: "DomainName.DistributionDomainName for api branch RecordSet to reference",
            Value: Fn.GetAtt("DomainName", "DistributionDomainName"),
            Export: {
                Name: `${pascalCaseDomainName(config.ROOT_DOMAIN)}DistributionDomainName`
            }
        };

        (template as any).Outputs.DistributionHostedZoneId = {
            Description:
                "DomainName.DistributionHostedZoneId for api branch RecordSet to reference",
            Value: Fn.GetAtt("DomainName", "DistributionHostedZoneId"),
            Export: {
                Name: `${pascalCaseDomainName(config.ROOT_DOMAIN)}DistributionHostedZoneId`
            }
        };
    }

    // const parseSegment = (segment: Handlers, currentPath: string): void =>
    //     Object.entries(segment).forEach(([name, segmentOrRoute]) => {
    //         if (
    //             segmentOrRoute.handler &&
    //             typeof segmentOrRoute.handler === "function"
    //         ) {
    //             const Name = capitalizeFirstLetter(name);

    //             const handlerDefinition = {
    //                 Type: "AWS::Serverless::Function",
github matthewkeil / nomad-devops / aws / server.ts View on Github external
Resources: {
            BasePathMapping: BasePathMapping(branch),
            LogGroup,
            ApiGateway,
            GatewayResponseDefault4XX,
            GatewayResponseDefault5XX
        }
    };

    if (branch === "master") {
        (template.Resources as any).RecordSet = ServerRecordSet;
        (template.Resources as any).DomainName = DomainName;

        (template as any).Outputs.DistributionDomainName = {
            Description: "DomainName.DistributionDomainName for api branch RecordSet to reference",
            Value: Fn.GetAtt("DomainName", "DistributionDomainName"),
            Export: {
                Name: `${pascalCaseDomainName(config.ROOT_DOMAIN)}DistributionDomainName`
            }
        };

        (template as any).Outputs.DistributionHostedZoneId = {
            Description:
                "DomainName.DistributionHostedZoneId for api branch RecordSet to reference",
            Value: Fn.GetAtt("DomainName", "DistributionHostedZoneId"),
            Export: {
                Name: `${pascalCaseDomainName(config.ROOT_DOMAIN)}DistributionHostedZoneId`
            }
        };
    }

    // const parseSegment = (segment: Handlers, currentPath: string): void =>
github matthewkeil / nomad-devops / aws / cloudfront / ClientDistribution.ts View on Github external
Forward: "none"
                }
            }
        },
        DefaultRootObject: "index.html",
        Enabled: true,
        HttpVersion: "http2",
        // Logging: {
        //     IncludeCookies: false,
        //     Bucket: '', // TODO:
        //     Prefix: '' // TODO:
        // },
        Origins: [
            {
                Id: "s3Origin",
                DomainName: Fn.GetAtt("ClientBucket", "DomainName"),
                S3OriginConfig: {
                    OriginAccessIdentity: Fn.Join("/", [
                        "origin-access-identity/cloudfront",
                        Fn.Ref("ClientOriginAccessIdentity")
                    ])
                }
            }
        ],
        PriceClass: "PriceClass_100", // PriceClass_100 | PriceClass_200 | PriceClass_All
        ViewerCertificate: {
            AcmCertificateArn: Fn.ImportValue(
                `${pascalCaseDomainName(config.ROOT_DOMAIN)}Certificate`
            ),
            MinimumProtocolVersion: "TLSv1.1_2016",
            SslSupportMethod: "sni-only"
        }
github matthewkeil / nomad-devops / aws / route53 / ServerRecordSet.ts View on Github external
import { Route53, Fn } from "cloudform";
import { config } from "../../config";
import { pascalCaseDomainName } from "../../lib";

export const ServerRecordSet = new Route53.RecordSet({
    Name: Fn.Join(".", [Fn.Ref("SubDomain"), config.ROOT_DOMAIN]),
    Type: "A",
    HostedZoneId: Fn.ImportValue(`${pascalCaseDomainName(config.ROOT_DOMAIN)}HostedZone`),
    AliasTarget: {
        DNSName: Fn.GetAtt("DomainName", "DistributionDomainName"),
        HostedZoneId: Fn.GetAtt("DomainName", "DistributionHostedZoneId")
    }
}).dependsOn("DomainName");
github matthewkeil / nomad-devops / aws / iam / IdentityPoolRoleAttachment.ts View on Github external
import { Cognito, Fn } from "cloudform";

export const IdentityPoolRoleAttachment = new Cognito.IdentityPoolRoleAttachment({
    IdentityPoolId: Fn.ImportValue("IdentityPoolId"),
    Roles: {
        authenticated: Fn.GetAtt("CustomerRole", "Arn"),
        unauthenticated: Fn.GetAtt("UnauthenticatedUserRole", "Arn")
    }
});
github matthewkeil / nomad-devops / aws / route53 / ServerRecordSet.ts View on Github external
import { Route53, Fn } from "cloudform";
import { config } from "../../config";
import { pascalCaseDomainName } from "../../lib";

export const ServerRecordSet = new Route53.RecordSet({
    Name: Fn.Join(".", [Fn.Ref("SubDomain"), config.ROOT_DOMAIN]),
    Type: "A",
    HostedZoneId: Fn.ImportValue(`${pascalCaseDomainName(config.ROOT_DOMAIN)}HostedZone`),
    AliasTarget: {
        DNSName: Fn.GetAtt("DomainName", "DistributionDomainName"),
        HostedZoneId: Fn.GetAtt("DomainName", "DistributionHostedZoneId")
    }
}).dependsOn("DomainName");
github matthewkeil / nomad-devops / aws / iam / IdentityPoolRoleAttachment.ts View on Github external
import { Cognito, Fn } from "cloudform";

export const IdentityPoolRoleAttachment = new Cognito.IdentityPoolRoleAttachment({
    IdentityPoolId: Fn.ImportValue("IdentityPoolId"),
    Roles: {
        authenticated: Fn.GetAtt("CustomerRole", "Arn"),
        unauthenticated: Fn.GetAtt("UnauthenticatedUserRole", "Arn")
    }
});
github matthewkeil / nomad-devops / aws / s3 / ClientBucketPolicy.ts View on Github external
import { S3, Fn } from "cloudform";

export const ClientBucketPolicy = new S3.BucketPolicy({
    Bucket: Fn.Ref("ClientBucket"),
    PolicyDocument: {
        Version: "2012-10-17",
        Statement: [
            {
                Sid: "Allow CloudFront read access",
                Effect: "Allow",
                Action: "s3:GetObject",
                Resource: Fn.Join("", [Fn.GetAtt("ClientBucket", "Arn"), "/*"]),
                Principal: {
                    CanonicalUser: Fn.GetAtt("ClientOriginAccessIdentity", "S3CanonicalUserId")
                }
            }
        ]
    }
}).dependsOn("ClientOriginAccessIdentity");
github matthewkeil / nomad-devops / aws / route53 / ClientRecordSet.ts View on Github external
import { Route53, Fn } from "cloudform";
import { config } from "../../config";
import { pascalCaseDomainName } from "../../lib";

export const ClientRecordSet = new Route53.RecordSet({
    Name: Fn.Join(".", [Fn.Ref("SubDomain"), config.ROOT_DOMAIN]),
    Type: "A",
    HostedZoneId: Fn.ImportValue(`${pascalCaseDomainName(config.ROOT_DOMAIN)}HostedZone`),
    AliasTarget: {
        DNSName: Fn.GetAtt("ClientDistribution", "DomainName"),
        HostedZoneId: "Z2FDTNDATAQYW2"
    }
}).dependsOn("ClientDistribution");