Skip to content
This repository was archived by the owner on Feb 2, 2021. It is now read-only.

adding aws tagging #38

Open
wants to merge 1 commit into
base: latest
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 74 additions & 20 deletions aws.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ tosca_definitions_version: cloudify_dsl_1_3

imports:
- https://cloudify.co/spec/cloudify/4.5/types.yaml
- https://cloudify.co/spec/awssdk-plugin/2.6.0/plugin.yaml
- https://cloudify.co/spec/awssdk-plugin/2.7.0/plugin.yaml
- https://cloudify.co/spec/utilities-plugin/1.9.5/plugin.yaml
- https://cloudify.co/spec/fabric-plugin/1.5.1/plugin.yaml
- imports/manager-configuration.yaml
Expand Down Expand Up @@ -95,6 +95,11 @@ inputs:
private_subnet_cidr:
default: 10.10.5.0/24

resource_name:
type: string
description: This will be the "Name" tag on your resource.
default: "Cloudify"

dsl_definitions:

client_config: &client_config
Expand Down Expand Up @@ -164,14 +169,36 @@ node_templates:
inputs:
store_private_key_material: true

cloudify_host_cloud_config:
type: cloudify.nodes.CloudInit.CloudConfig
interfaces:
cloudify.interfaces.lifecycle:
create:
inputs:
resource_config:
users:
- name: { get_input: cloudify_image_username }
primary-group: wheel
shell: /bin/bash
sudo: ['ALL=(ALL) NOPASSWD:ALL']
ssh-authorized-keys:
- { get_attribute: [ manager_key, public_key_export ] }
relationships:
- type: cloudify.relationships.depends_on
target: manager_key

vpc:
type: cloudify.nodes.aws.ec2.Vpc
properties:
resource_config:
kwargs:
CidrBlock: { get_input: vpc_cidr }
client_config: *client_config

Tags:
- Key: Name
Value: { concat: [ { get_input: resource_name }, _vpc ] }
- Key: Blueprint
Value: cloudify-environment-setup
internet_gateway:
type: cloudify.nodes.aws.ec2.InternetGateway
properties:
Expand All @@ -188,6 +215,11 @@ node_templates:
CidrBlock: { get_input: public_subnet_cidr }
AvailabilityZone: { get_input: availability_zone }
client_config: *client_config
Tags:
- Key: Name
Value: { concat: [ { get_input: resource_name }, _public_subnet ] }
- Key: Blueprint
Value: cloudify-environment-setup
relationships:
- type: cloudify.relationships.depends_on
target: vpc
Expand All @@ -202,6 +234,11 @@ node_templates:
CidrBlock: { get_input: private_subnet_cidr }
AvailabilityZone: { get_input: availability_zone }
client_config: *client_config
Tags:
- Key: Name
Value: { concat: [ { get_input: resource_name }, _private_subnet ] }
- Key: Blueprint
Value: cloudify-environment-setup
relationships:
- type: cloudify.relationships.depends_on
target: vpc
Expand All @@ -212,6 +249,11 @@ node_templates:
type: cloudify.nodes.aws.ec2.RouteTable
properties:
client_config: *client_config
Tags:
- Key: Name
Value: { concat: [ { get_input: resource_name }, _public_subnet_routetable ] }
- Key: Blueprint
Value: cloudify-environment-setup
relationships:
- type: cloudify.relationships.contained_in
target: vpc
Expand All @@ -222,6 +264,11 @@ node_templates:
type: cloudify.nodes.aws.ec2.RouteTable
properties:
client_config: *client_config
Tags:
- Key: Name
Value: { concat: [ { get_input: resource_name }, _private_subnet_routetable ] }
- Key: Blueprint
Value: cloudify-environment-setup
relationships:
- type: cloudify.relationships.contained_in
target: vpc
Expand Down Expand Up @@ -259,6 +306,11 @@ node_templates:
type: cloudify.nodes.aws.ec2.NATGateway
properties:
client_config: *client_config
Tags:
- Key: Name
Value: { concat: [ { get_input: resource_name }, _nat_gateway ] }
- Key: Blueprint
Value: cloudify-environment-setup
relationships:
- type: cloudify.relationships.depends_on
target: public_subnet
Expand Down Expand Up @@ -372,6 +424,11 @@ node_templates:
Description: Created by simple-infrastructure-blueprint aws.yaml.
VpcId: { get_attribute: [ vpc, aws_resource_id] }
client_config: *client_config
Tags:
- Key: Name
Value: { concat: [ { get_input: resource_name }, _sec_group ] }
- Key: Blueprint
Value: cloudify-environment-setup
relationships:
- type: cloudify.relationships.depends_on
target: vpc
Expand All @@ -381,24 +438,6 @@ node_templates:
inputs:
resource_config: { get_property: [ SELF, resource_config, kwargs] }

cloudify_host_cloud_config:
type: cloudify.nodes.CloudInit.CloudConfig
interfaces:
cloudify.interfaces.lifecycle:
create:
inputs:
resource_config:
users:
- name: { get_input: cloudify_image_username }
primary-group: wheel
shell: /bin/bash
sudo: ['ALL=(ALL) NOPASSWD:ALL']
ssh-authorized-keys:
- { get_attribute: [ manager_key, public_key_export ] }
relationships:
- type: cloudify.relationships.depends_on
target: manager_key

nic:
type: cloudify.nodes.aws.ec2.Interface
properties:
Expand All @@ -409,6 +448,11 @@ node_templates:
SubnetId: { get_attribute: [ public_subnet, aws_resource_id] }
Groups:
- { get_attribute: [ security_group, aws_resource_id ] }
Tags:
- Key: Name
Value: { concat: [ { get_input: resource_name }, _nic ] }
- Key: Blueprint
Value: cloudify-environment-setup
relationships:
- type: cloudify.relationships.depends_on
target: public_subnet
Expand Down Expand Up @@ -436,6 +480,11 @@ node_templates:
- Key: Name
Value: Cloudify Volume
client_config: *client_config
Tags:
- Key: Name
Value: { concat: [ { get_input: resource_name }, _cloudify_host_volume ] }
- Key: Blueprint
Value: cloudify-environment-setup

cloudify_host:
type: cloudify.nodes.aws.ec2.Instances
Expand All @@ -456,6 +505,11 @@ node_templates:
AvailabilityZone: { get_input: availability_zone }
UserData: { get_attribute: [ cloudify_host_cloud_config, cloud_config ] }
client_config: *client_config
Tags:
- Key: Name
Value: { concat: [ { get_input: resource_name }, _cloudify_host ] }
- Key: Blueprint
Value: cloudify-environment-setup
relationships:
- type: cloudify.relationships.depends_on
target: cloudify_host_cloud_config
Expand Down