diff --git a/google/resource-snippets/compute-v1/external-https-load-balancer.jinja b/google/resource-snippets/compute-v1/external-https-load-balancer.jinja new file mode 100644 index 00000000..5b7b3a52 --- /dev/null +++ b/google/resource-snippets/compute-v1/external-https-load-balancer.jinja @@ -0,0 +1,58 @@ +{% set URLMAP = properties['deployName'] + '-lb' %} +{% set GLOBALFWDRULE = properties['deployName'] + '-fr' %} +{% set TARGET = properties['deployName'] + '-proxy' %} +{% set ADDRESS = properties['deployName'] + '-address' %} +{% set BS1 = properties['deployName'] + 'bb' %} +{% set SSLCERTIFICATE = properties['deployName'] + 'ssl-certificate' %} + +resources: + # Google Front-end Service + - type: gcp-types/compute-v1:globalForwardingRules + name: {{ GLOBALFWDRULE }} + properties: + networkTier: PREMIUM + IPProtocol: TCP + IPAddress: $(ref.{{ ADDRESS }}.selfLink) + loadBalancingScheme: EXTERNAL + portRange: 443 + target: $(ref.{{ TARGET }}.selfLink) + + # Google target HTTPS proxy: Define the relationship between SSL certificates and URLMaps + - type: gcp-types/compute-v1:targetHttpsProxies + name: {{ TARGET }} + properties: + sslCertificates: + - $(ref.{{ SSLCERTIFICATE }}.selfLink) + urlMap: $(ref.{{ URLMAP }}.selfLink) + + # Host and Path rules + - type: gcp-types/compute-v1:urlMaps + name: {{ URLMAP }} + properties: + # Default backend/bucket service when no rules has applied to the request + defaultService: $(ref.{{ BS1 }}.selfLink) + + # Google managed ssl certificate + - type: gcp-types/compute-v1:sslCertificates + name: { { SSLCERTIFICATE } } + properties: + type: MANAGED + description: '' + managed: + domains: + - {{ properties[ 'yourDomain' ] }} + + # Google Backend Bucket + - type: gcp-types/compute-v1:backendBuckets + name: {{ BS1 }} + properties: + description: backend bucket service for web-application + bucketName: $(ref.{{ properties['deployName'] + '-' + properties['bucketName'] }}.name) + enableCDN: true + + # Global Address + - type: gcp-types/compute-v1:globalAddresses + name: {{ ADDRESS }} + properties: + addressType: EXTERNAL + ipVersion: IPV4 diff --git a/google/resource-snippets/compute-v1/external-https-load-balancer.yaml b/google/resource-snippets/compute-v1/external-https-load-balancer.yaml new file mode 100644 index 00000000..ba16e299 --- /dev/null +++ b/google/resource-snippets/compute-v1/external-https-load-balancer.yaml @@ -0,0 +1,24 @@ +# Copyright 2018 Google Inc. All rights reserved. +# +# Licensed 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 CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +imports: + - path: external-https-load-balancer.jinja + +resources: + - name: external-https-load-balancer + type: address.jinja + properties: + deployName: NAME_YOUR_DEPLOY + yourDomain: YOUR_DOMAIN + bucketName: YOUR_BUCKET_NAME