cfn_template

package
v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 23, 2016 License: Apache-2.0 Imports: 8 Imported by: 0

README

cfn_template

The cfn_template package utilizes the cfn and text/template packages.

Its only purpose is to be the data for a call to template.Execute

Documentation

Overview

* Copyright 2016 Adobe Systems Incorporated. All rights reserved. * This file is licensed to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy * of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS * OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License.

* Copyright 2016 Adobe Systems Incorporated. All rights reserved. * This file is licensed to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy * of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS * OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License.

* Copyright 2016 Adobe Systems Incorporated. All rights reserved. * This file is licensed to you under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. You may obtain a copy * of the License at http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS * OF ANY KIND, either express or implied. See the License for the specific language * governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AWSCloudFormationInit

func AWSCloudFormationInit(autoScalingLaunchConfigurationLogicalId string, context AWSCloudFormationInitCtx) (map[string]interface{}, error)

AWSCloudFormationInit produces the value of the AWS::CloudFormation::Init type and should be placed on the Metadata of a AWS::EC2::Instance or AWS::AutoScale::LaunchConfiguration

It works with the UserData field of a AWS::AutoScale::LaunchConfiguration (or AWS::EC2::Instance) to bootstrap an EC2 instance when it's created

Example use:

{
  "Resources": {
    "AutoScalingLaunchConfiguration": {
      "Type": "AWS::AutoScaling::LaunchConfiguration",
      "Metadata": {
        "AWS::CloudFormation::Init": {{ .Resources.AutoScaling.LaunchConfiguration.Metadata.AWSCloudFormationInit }}
      },
      "Properties": {
        "UserData": {{ .Resources.AutoScaling.LaunchConfiguration.UserData }}
      }
    }
  }
}

func ELBToInstance

func ELBToInstance(vpc, https bool, elbName, elbSecurityGroup string) map[string]interface{}

Allow EC2 instances to receive traffic from the provisioned ELB

func ImageIdInMap

func ImageIdInMap(mapId string) map[string]interface{}

ImageIdInMap works with a mapping like the following to select an AMI id for the current region

{
  "Mappings": {
    "RegionToAmazonLinuxAMI": {
      "ap-northeast-1": { "Key": "ami-1c1b9f1c" },
      "ap-southeast-1": { "Key": "ami-d44b4286" },
      "ap-southeast-2": { "Key": "ami-db7b39e1" },
      "eu-central-1":   { "Key": "ami-a6b0b7bb" },
      "eu-west-1":      { "Key": "ami-e4d18e93" },
      "sa-east-1":      { "Key": "ami-55098148" },
      "us-east-1":      { "Key": "ami-0d4cfd66" },
      "us-west-1":      { "Key": "ami-87ea13c3" },
      "us-west-2":      { "Key": "ami-d5c5d1e5" }
    }
  }
}

func InetToELB

func InetToELB(vpc, https bool) map[string]interface{}

Allow internet traffic to the ELB. This is only use in a custom VPC.

func RegionToAmazonLinuxAMI

func RegionToAmazonLinuxAMI() map[string]interface{}

RegionToAmazonLinuxAMI is a mapping of AWS region to the latest released version the Amazon Linux AMI (currently 2015.09.1)

func UserData

func UserData(autoScalingLaunchConfigurationLogicalId string) (map[string]interface{}, error)

UserData is the initial launch script run by an EC2 instance

http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AmazonLinuxAMIBasics.html

Types

type AWSCloudFormationInitCtx

type AWSCloudFormationInitCtx struct {
	PorterVersion string
	Environment   string
	Region        string
	EnvFile       string

	ServiceName    string
	ServiceVersion string

	ServicePayloadBucket     string
	ServicePayloadKey        string
	ServicePayloadConfigPath string

	PrimaryContainer    PrimaryContainer
	SecondaryContainers []SecondaryContainer

	PorterBinaryUrl string

	DevMode bool

	EC2BootstrapScript string

	Elbs string
}

type PrimaryContainer

type PrimaryContainer struct {
	Name              string
	InetPort          int
	HealthCheckMethod string
	HealthCheckPath   string
}

type SecondaryContainer

type SecondaryContainer struct {
	Name string
}

type UserDataContext

type UserDataContext struct {
	LogicalId string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL