mmv1/provider/terraform/common~copy.yaml (167 lines of code) (raw):
# Copyright 2018 Google Inc.
# 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.
# These files contains code that needs to be compiled before being delivered to
# the final module tree structure:
<%
dir = version_name == 'ga' ? 'google' : "google-#{version_name}"
-%>
<% if generate_code -%>
# Copy all of the terraform resources that are still hand written into the specific service folder
<% Dir["third_party/terraform/services/**"].each do |product_path|
product_name = product_path.split('/')[-1]
Dir[product_path + "/*.go"].each do |file_path|
fname = file_path.split('/')[-1]
-%>
'<%= dir -%>/services/<%= product_name -%>/<%= fname -%>': '<%= product_path -%>/<%= fname -%>'
<% end -%>
<% if Dir.exist?("#{product_path}/test-fixtures") -%>
'<%= dir -%>/services/<%= product_name -%>/test-fixtures': '<%= product_path -%>/test-fixtures'
<% end -%>
<% end -%>
<%
Dir["third_party/terraform/acctest/*.go"].each do |file_path|
fname = file_path.split('/')[-1]
-%>
'<%= dir -%>/acctest/<%= fname -%>': 'third_party/terraform/acctest/<%= fname -%>'
<% end -%>
<%
Dir["third_party/terraform/sweeper/*.go"].each do |file_path|
fname = file_path.split('/')[-1]
-%>
'<%= dir -%>/sweeper/<%= fname -%>': 'third_party/terraform/sweeper/<%= fname -%>'
<% end -%>
<%
Dir["third_party/terraform/provider/*.go"].each do |file_path|
fname = file_path.delete_prefix("third_party/terraform/provider")
-%>
'<%= dir -%>/provider/<%= fname -%>': 'third_party/terraform/provider/<%= fname -%>'
<% end -%>
<%
Dir["third_party/terraform/provider/universe/*.go"].each do |file_path|
fname = file_path.delete_prefix("third_party/terraform/provider")
-%>
'<%= dir -%>/provider/<%= fname -%>': 'third_party/terraform/provider/<%= fname -%>'
<% end -%>
<%
Dir["third_party/terraform/tpgdclresource/*.go"].each do |file_path|
fname = file_path.split('/')[-1]
-%>
'<%= dir -%>/tpgdclresource/<%= fname -%>': 'third_party/terraform/tpgdclresource/<%= fname -%>'
<% end -%>
<%
Dir["third_party/terraform/tpgiamresource/*.go"].each do |file_path|
fname = file_path.split('/')[-1]
-%>
'<%= dir -%>/tpgiamresource/<%= fname -%>': 'third_party/terraform/tpgiamresource/<%= fname -%>'
<% end -%>
<%
Dir["third_party/terraform/tpgresource/*.go"].each do |file_path|
fname = file_path.split('/')[-1]
-%>
'<%= dir -%>/tpgresource/<%= fname -%>': 'third_party/terraform/tpgresource/<%= fname -%>'
<% end -%>
<%
Dir["third_party/terraform/transport/*.go"].each do |file_path|
fname = file_path.split('/')[-1]
-%>
'<%= dir -%>/transport/<%= fname -%>': 'third_party/terraform/transport/<%= fname -%>'
<% end -%>
<%
Dir["third_party/terraform/fwmodels/*.go"].each do |file_path|
fname = file_path.split('/')[-1]
-%>
'<%= dir -%>/fwmodels/<%= fname -%>': 'third_party/terraform/fwmodels/<%= fname -%>'
<% end -%>
<%
Dir["third_party/terraform/fwprovider/*.go"].each do |file_path|
fname = file_path.split('/')[-1]
-%>
'<%= dir -%>/fwprovider/<%= fname -%>': 'third_party/terraform/fwprovider/<%= fname -%>'
<% end -%>
<%
Dir["third_party/terraform/fwutils/*.go"].each do |file_path|
fname = file_path.split('/')[-1]
-%>
'<%= dir -%>/fwutils/<%= fname -%>': 'third_party/terraform/fwutils/<%= fname -%>'
<% end -%>
<%
Dir["third_party/terraform/fwvalidators/*.go"].each do |file_path|
fname = file_path.split('/')[-1]
-%>
'<%= dir -%>/fwvalidators/<%= fname -%>': 'third_party/terraform/fwvalidators/<%= fname -%>'
<% end -%>
<%
Dir["third_party/terraform/fwtransport/*.go"].each do |file_path|
fname = file_path.split('/')[-1]
-%>
'<%= dir -%>/fwtransport/<%= fname -%>': 'third_party/terraform/fwtransport/<%= fname -%>'
<% end -%>
<%
Dir["third_party/terraform/fwresource/*.go"].each do |file_path|
fname = file_path.split('/')[-1]
-%>
'<%= dir -%>/fwresource/<%= fname -%>': 'third_party/terraform/fwresource/<%= fname -%>'
<% end -%>
<%
Dir["third_party/terraform/verify/*.go"].each do |file_path|
fname = file_path.split('/')[-1]
-%>
'<%= dir -%>/verify/<%= fname -%>': 'third_party/terraform/verify/<%= fname -%>'
<% end -%>
<%
Dir["third_party/terraform/envvar/*.go"].each do |file_path|
fname = file_path.split('/')[-1]
-%>
'<%= dir -%>/envvar/<%= fname -%>': 'third_party/terraform/envvar/<%= fname -%>'
<% end -%>
<%
Dir["third_party/terraform/functions/*.go"].each do |file_path|
fname = file_path.split('/')[-1]
-%>
'<%= dir -%>/functions/<%= fname -%>': 'third_party/terraform/functions/<%= fname -%>'
<% end -%>
<%
Dir["third_party/terraform/scripts/*.*"].each do |file_path|
next if file_path.end_with?('.erb')
fname = file_path.delete_prefix('third_party/terraform/')
-%>
'<%= fname -%>': '<%= file_path -%>'
<% end -%>
<%
Dir["third_party/terraform/scripts/affectedtests/*.*"].each do |file_path|
next if file_path.end_with?('.erb')
fname = file_path.delete_prefix('third_party/terraform/')
-%>
'<%= fname -%>': '<%= file_path -%>'
<% end -%>
'<%= dir -%>/test-fixtures/': 'third_party/terraform/test-fixtures'
<% end -%>
<% if generate_docs -%>
<% Dir["third_party/terraform/website/**/*.*"].each do |file_path|
fname = file_path.split('/', 4)[3]
-%>
'website/<%= fname -%>': 'third_party/terraform/website/<%= fname -%>'
<% end -%>
<% end -%>
<% if version_name == "ga" -%>
# Copy TeamCity-related Kotlin & Markdown files to TPG only, not TPGB
<%
Dir["third_party/terraform/.teamcity/**/*.kt"].each do |file_path|
fname = file_path.delete_prefix("third_party/terraform/")
-%>
'<%= fname -%>': '<%= file_path -%>'
<% end -%>
<%
Dir["third_party/terraform/.teamcity/**/*.md"].each do |file_path|
fname = file_path.delete_prefix("third_party/terraform/")
-%>
'<%= fname -%>': '<%= file_path -%>'
<% end -%>
'.teamcity/settings.kts': 'third_party/terraform/.teamcity/settings.kts'
'.teamcity/pom.xml': 'third_party/terraform/.teamcity/pom.xml'
'.teamcity/.gitignore': 'third_party/terraform/.teamcity/.gitignore'
'.teamcity/Makefile': 'third_party/terraform/.teamcity/Makefile'
<% end -%> # end if version_name == "ga"
# Copy all files in the META.d folder
<%
Dir["third_party/terraform/META.d/*.yaml"].each do |file_path|
fname = file_path.delete_prefix("third_party/terraform/")
-%>
'<%= fname -%>': '<%= file_path -%>'
<% end -%>
'version/version.go': 'third_party/terraform/version/version.go'
'go.sum': 'third_party/terraform/go.sum'
'.go-version': 'third_party/terraform/.go-version'