Skip to content
This repository was archived by the owner on Mar 1, 2020. It is now read-only.

Commit f4e7439

Browse files
author
earthmant
committed
first commit
0 parents  commit f4e7439

2 files changed

Lines changed: 212 additions & 0 deletions

File tree

README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
2+
# GCP Example Network
3+
4+
### Resources Created
5+
6+
* A `network`.
7+
* A `public_subnet`.
8+
* A `private_subnet`.
9+
10+
11+
## Compatibility
12+
13+
Tested with:
14+
* Cloudify 4.2
15+
16+
17+
## Pre-installation steps
18+
19+
Upload the required plugins:
20+
21+
* [GCP Plugin](https://github.com/cloudify-cosmo/cloudify-gcp-plugin/releases).
22+
23+
_Check the blueprint for the exact version of the plugin._
24+
25+
26+
If you do not provide your own `deployment inputs` below, you must add these secrets to your Cloudify Manager `tenant`:
27+
28+
* `gcp_client_x509_cert_url`
29+
* `gcp_gcp_client_email`
30+
* `client_id`
31+
* `gcp_project_id`
32+
* `gcp_private_key_id`
33+
* `gcp_private_key`
34+
* `gcp_zone`, such as `us-east1-b`.
35+
* `gcp_region`, such as `us-east1`.
36+
37+
38+
## Installation
39+
40+
On your Cloudify Manager, navigate to `Local Blueprints` select `Upload`.
41+
42+
[Right-click and copy URL](https://github.com/cloudify-examples/gcp-example-network/archive/master.zip). Paste where it says `Enter blueprint url`. Provide a blueprint name, such as `examples-network` in the field labeled `blueprint name`. Select `simple-blueprint.yaml` from `Blueprint filename` menu.
43+
44+
After the new blueprint has been created, click the `Deploy` button.
45+
46+
Navigate to `Deployments`, find your new deployment, select `Install` from the `workflow`'s menu. At this stage, you may provide your own values for any of the default `deployment inputs`.
47+
48+
49+
## Update Deployment
50+
51+
In order to provide outbound internet access to the private subnet, you can update the deployment.
52+
53+
Navigate to `Deployments`, find your deployment, click on it. Once the deployment's page has loaded, click the `Update Deployment` button. [Right-click and copy URL](https://github.com/cloudify-examples/vpc-scenario2-blueprint/archive/master.zip). Paste where it says `Enter new blueprint url`. This time, select `update-blueprint.yaml` from `Blueprint filename` menu.
54+
55+
56+
## Uninstallation
57+
58+
Navigate to the deployment and select `Uninstall`. When the uninstall workflow is finished, select `Delete deployment`.

simple-blueprint.yaml

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
tosca_definitions_version: cloudify_dsl_1_3
2+
3+
description: >
4+
Create an GCP Example Network.
5+
6+
imports:
7+
- http://www.getcloudify.org/spec/cloudify/4.2/types.yaml
8+
- http://www.getcloudify.org/spec/gcp-plugin/1.4.0/plugin.yaml
9+
10+
inputs:
11+
12+
client_x509_cert_url:
13+
type: string
14+
default: { get_secret: gcp_client_x509_cert_url }
15+
16+
client_email:
17+
type: string
18+
default: { get_secret: gcp_client_email }
19+
20+
client_id:
21+
type: string
22+
default: { get_secret: gcp_client_id }
23+
24+
project_id:
25+
type: string
26+
default: { get_secret: gcp_project_id }
27+
28+
private_key_id:
29+
type: string
30+
default: { get_secret: gcp_private_key_id }
31+
32+
private_key:
33+
type: string
34+
default: { get_secret: gcp_private_key }
35+
36+
zone:
37+
default: { get_secret: gcp_zone }
38+
39+
region:
40+
default: { get_secret: gcp_region }
41+
42+
public_subnet_cidr:
43+
default: 10.11.12.0/22
44+
45+
private_subnet_cidr:
46+
default: 10.11.16.0/22
47+
48+
resource_prefix:
49+
default: cfy
50+
51+
resource_suffix:
52+
default: 1
53+
54+
secrets:
55+
description: >
56+
key, value pairs of secrets used in AWS blueprint examples.
57+
default:
58+
- key: client_x509_cert_url
59+
value: { get_input: client_x509_cert_url }
60+
- key: client_email
61+
value: { get_input: client_email }
62+
- key: client_id
63+
value: { get_input: client_id }
64+
- key: project_id
65+
value: { get_input: project_id }
66+
- key: private_key_id
67+
value: { get_input: private_key_id }
68+
- key: private_key
69+
value: { get_input: private_key }
70+
- key: management_network_name
71+
value: { get_property: [ network, name ] }
72+
- key: zone
73+
value: { get_input: zone }
74+
- key: region
75+
value: { get_input: region }
76+
- key: management_subnetwork_name
77+
value: { get_property: [ public_subnet, name ] }
78+
- key: private_subnetwork_name
79+
value: { get_property: [ private_subnet, name ] }
80+
- key: ubuntu_trusty_image
81+
value: { get_input: ubuntu_trusty_image }
82+
- key: centos_core_image
83+
value: { get_input: centos_core_image }
84+
- key: small_instance_type
85+
value: { get_input: small_instance_type }
86+
- key: agent_key_public
87+
value: { get_attribute: [ manager_key, public_key_export ] }
88+
- key: agent_key_private
89+
value: { get_attribute: [ manager_key, private_key_export ] }
90+
91+
dsl_definitions:
92+
93+
client_config: &client_config
94+
auth:
95+
type: service_account
96+
auth_uri: https://accounts.google.com/o/oauth2/auth
97+
token_uri: https://accounts.google.com/o/oauth2/token
98+
auth_provider_x509_cert_url: https://www.googleapis.com/oauth2/v1/certs
99+
client_x509_cert_url: { get_input: client_x509_cert_url }
100+
client_email: { get_input: client_email }
101+
client_id: { get_input: client_id }
102+
project_id: { get_input: project_id }
103+
private_key_id: { get_input: private_key_id }
104+
private_key: { get_input: private_key }
105+
project: { get_input: project_id }
106+
zone: { get_input: zone }
107+
108+
node_templates:
109+
110+
network:
111+
type: cloudify.gcp.nodes.Network
112+
properties:
113+
gcp_config: *client_config
114+
name: { concat: [ { get_input: resource_prefix }, 'network', { get_input: resource_suffix } ] }
115+
auto_subnets: false
116+
117+
public_subnet:
118+
type: cloudify.gcp.nodes.SubNetwork
119+
properties:
120+
gcp_config: *client_config
121+
name: { concat: [ { get_input: resource_prefix }, 'public_subnet', { get_input: resource_suffix } ] }
122+
subnet: { get_input: public_subnet_cidr }
123+
region: { get_input: region }
124+
relationships:
125+
- type: cloudify.gcp.relationships.contained_in_network
126+
target: network
127+
128+
private_subnet:
129+
type: cloudify.gcp.nodes.SubNetwork
130+
properties:
131+
gcp_config: *client_config
132+
name: { concat: [ { get_input: resource_prefix }, 'private_subnet', { get_input: resource_suffix } ] }
133+
subnet: { get_input: private_subnet_cidr }
134+
region: { get_input: region }
135+
relationships:
136+
- type: cloudify.gcp.relationships.contained_in_network
137+
target: network
138+
139+
outputs:
140+
141+
network:
142+
value: { get_property: [ network, name ] }
143+
144+
public_subnet:
145+
value: { get_property: [ public_subnet, name ] }
146+
147+
private_subnet:
148+
value: { get_property: [ private_subnet, name ] }
149+
150+
zone:
151+
value: { get_input: zone }
152+
153+
region:
154+
value: { get_input: region }

0 commit comments

Comments
 (0)