How to use the cloudform.Fn 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 / dist / aws / cloudfront / ClientDistribution.js View on Github external
}
        },
        DefaultRootObject: "index.html",
        Enabled: true,
        HttpVersion: "http2",
        // Logging: {
        //     IncludeCookies: false,
        //     Bucket: '', // TODO:
        //     Prefix: '' // TODO:
        // },
        Origins: [
            {
                Id: "s3Origin",
                DomainName: cloudform_1.Fn.GetAtt("ClientBucket", "DomainName"),
                S3OriginConfig: {
                    OriginAccessIdentity: cloudform_1.Fn.Join("/", [
                        "origin-access-identity/cloudfront",
                        cloudform_1.Fn.Ref("ClientOriginAccessIdentity")
                    ])
                }
            }
        ],
        PriceClass: "PriceClass_100",
        ViewerCertificate: {
            AcmCertificateArn: cloudform_1.Fn.ImportValue(`${lib_1.pascalCaseDomainName(config_1.config.ROOT_DOMAIN)}Certificate`),
            MinimumProtocolVersion: "TLSv1.1_2016",
            SslSupportMethod: "sni-only"
        }
    }
}).dependsOn(["ClientBucket", "ClientOriginAccessIdentity"]);
github aws-amplify / amplify-cli / packages / appsync-elasticsearch-transformer / lib / resources.js View on Github external
ResourceFactory.prototype.makeDynamoDBStreamEventSourceMapping = function () {
        return new cloudform_1.Lambda.EventSourceMapping({
            BatchSize: 100,
            Enabled: true,
            EventSourceArn: cloudform_1.Fn.GetAtt(ResourceFactory.DynamoDBTableLogicalID, 'StreamArn'),
            FunctionName: cloudform_1.Fn.GetAtt(ResourceFactory.StreamingLambdaFunctionLogicalID, 'Arn'),
            StartingPosition: 'TRIM_HORIZON'
        });
    };
    /**
github matthewkeil / nomad-devops / dist / aws / s3 / ClientBucket.js View on Github external
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const cloudform_1 = require("cloudform");
const config_1 = require("../../config");
exports.ClientBucket = new cloudform_1.S3.Bucket({
    BucketName: cloudform_1.Fn.Join(".", [cloudform_1.Fn.Ref("SubDomain"), config_1.config.ROOT_DOMAIN]),
    AccessControl: "PublicRead",
    WebsiteConfiguration: {
        ErrorDocument: "index.html",
        IndexDocument: "index.html"
    },
    CorsConfiguration: {
        CorsRules: [
            {
                AllowedHeaders: ["*"],
                AllowedMethods: ["GET", "HEAD"],
                AllowedOrigins: ["*"]
            }
        ]
    }
});
github matthewkeil / nomad-devops / dist / aws / route53 / ServerRecordSet.js View on Github external
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const cloudform_1 = require("cloudform");
const config_1 = require("../../config");
const lib_1 = require("../../lib");
exports.ServerRecordSet = new cloudform_1.Route53.RecordSet({
    Name: cloudform_1.Fn.Join(".", [cloudform_1.Fn.Ref("SubDomain"), config_1.config.ROOT_DOMAIN]),
    Type: "A",
    HostedZoneId: cloudform_1.Fn.ImportValue(`${lib_1.pascalCaseDomainName(config_1.config.ROOT_DOMAIN)}HostedZone`),
    AliasTarget: {
        DNSName: cloudform_1.Fn.GetAtt("DomainName", "DistributionDomainName"),
        HostedZoneId: cloudform_1.Fn.GetAtt("DomainName", "DistributionHostedZoneId")
    }
}).dependsOn("DomainName");
github aws-amplify / amplify-cli / packages / graphql-dynamodb-transformer / lib / resources.js View on Github external
ResourceFactory.prototype.makeApiKeyOutput = function () {
        return {
            Description: "Your GraphQL API key. Provide via 'x-api-key' header.",
            Value: cloudform_1.Fn.GetAtt(graphql_transformer_common_1.ResourceConstants.RESOURCES.APIKeyLogicalID, 'ApiKey'),
            Export: {
                Name: cloudform_1.Fn.Join(':', [cloudform_1.Refs.StackName, "GraphQLApiKey"])
            }
        };
    };
    /**
github matthewkeil / nomad-devops / dist / aws / cloudfront / ClientOriginAccessIdentity.js View on Github external
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const cloudform_1 = require("cloudform");
const config_1 = require("../../config");
/**
 *
 * Fn.Ref('OriginAccessIdentity') returns access identity, such as E15MNIMTCFKK4C.
 * Fn.GetAtt('OriginAccessIdentity', 'S3CanonicalUserId') returns Amazon S3 canonical user ID
 *  - for example: b970b42360b81c8ddbd79d2f5df0069ba9033c8a79655752abe380cd6d63ba8bcf23384d568fcf89fc49700b5e11a0fd
 *
 */
exports.ClientOriginAccessIdentity = new cloudform_1.CloudFront.CloudFrontOriginAccessIdentity({
    CloudFrontOriginAccessIdentityConfig: {
        Comment: cloudform_1.Fn.Join("", [
            `origin access identity for `,
            cloudform_1.Fn.Ref("SubDomain"),
            ".",
            config_1.config.ROOT_DOMAIN
        ])
    }
});
github matthewkeil / nomad-devops / dist / aws / apiGateway / BasePathMapping.js View on Github external
exports.BasePathMapping = (branch) => {
    const basePathMapping = new cloudform_1.ApiGateway.BasePathMapping({
        RestApiId: cloudform_1.Fn.Ref("ApiGateway"),
        DomainName: cloudform_1.Fn.Join(".", [cloudform_1.Fn.Ref("SubDomain"), config_1.config.ROOT_DOMAIN]),
        BasePath: cloudform_1.Fn.Ref("BasePath"),
        Stage: cloudform_1.Fn.Ref("GitHubBranch")
    });
    if (branch === "master") {
        basePathMapping.dependsOn("DomainName");
    }
    else {
        basePathMapping.dependsOn("ApiGatewayStage");
    }
    return basePathMapping;
};
github matthewkeil / nomad-devops / dist / aws / route53 / ServerRecordSet.js View on Github external
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const cloudform_1 = require("cloudform");
const config_1 = require("../../config");
const lib_1 = require("../../lib");
exports.ServerRecordSet = new cloudform_1.Route53.RecordSet({
    Name: cloudform_1.Fn.Join(".", [cloudform_1.Fn.Ref("SubDomain"), config_1.config.ROOT_DOMAIN]),
    Type: "A",
    HostedZoneId: cloudform_1.Fn.ImportValue(`${lib_1.pascalCaseDomainName(config_1.config.ROOT_DOMAIN)}HostedZone`),
    AliasTarget: {
        DNSName: cloudform_1.Fn.GetAtt("DomainName", "DistributionDomainName"),
        HostedZoneId: cloudform_1.Fn.GetAtt("DomainName", "DistributionHostedZoneId")
    }
}).dependsOn("DomainName");
github matthewkeil / nomad-devops / dist / aws / route53 / ClientRecordSet.js View on Github external
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const cloudform_1 = require("cloudform");
const config_1 = require("../../config");
const lib_1 = require("../../lib");
exports.ClientRecordSet = new cloudform_1.Route53.RecordSet({
    Name: cloudform_1.Fn.Join(".", [cloudform_1.Fn.Ref("SubDomain"), config_1.config.ROOT_DOMAIN]),
    Type: "A",
    HostedZoneId: cloudform_1.Fn.ImportValue(`${lib_1.pascalCaseDomainName(config_1.config.ROOT_DOMAIN)}HostedZone`),
    AliasTarget: {
        DNSName: cloudform_1.Fn.GetAtt("ClientDistribution", "DomainName"),
        HostedZoneId: "Z2FDTNDATAQYW2"
    }
}).dependsOn("ClientDistribution");
github matthewkeil / nomad-devops / dist / aws / cloudfront / ClientOriginAccessIdentity.js View on Github external
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const cloudform_1 = require("cloudform");
const config_1 = require("../../config");
/**
 *
 * Fn.Ref('OriginAccessIdentity') returns access identity, such as E15MNIMTCFKK4C.
 * Fn.GetAtt('OriginAccessIdentity', 'S3CanonicalUserId') returns Amazon S3 canonical user ID
 *  - for example: b970b42360b81c8ddbd79d2f5df0069ba9033c8a79655752abe380cd6d63ba8bcf23384d568fcf89fc49700b5e11a0fd
 *
 */
exports.ClientOriginAccessIdentity = new cloudform_1.CloudFront.CloudFrontOriginAccessIdentity({
    CloudFrontOriginAccessIdentityConfig: {
        Comment: cloudform_1.Fn.Join("", [
            `origin access identity for `,
            cloudform_1.Fn.Ref("SubDomain"),
            ".",
            config_1.config.ROOT_DOMAIN
        ])
    }
});