provider/terraform.rb
# This function uses the resource.erb template to create one file
# per resource. The resource.erb template forms the basis of a single
# GCP Resource on Terraform.
This function uses the resource.erb template to create one file
per resource. The resource.erb template forms the basis of a single
GCP Resource on Terraform.
This function uses the resource . erb template to create one file per resource . The resource . erb template forms the basis of a single GCP Resource on Terraform .
def generate_resource(data)
      dir = data[:version] == 'beta' ? 'google-beta' : 'google'
      target_folder = File.join(data[:output_folder], dir)
      FileUtils.mkpath target_folder
      name = data[:object].name.underscore
      product_name = data[:product_name].underscore
      filepath = File.join(target_folder, "resource_#{product_name}_#{name}.go")
      generate_resource_file data.clone.merge(
        default_template: 'templates/terraform/resource.erb',
        out_file: filepath
      )
      %x(goimports -w #{filepath})
      generate_documentation(data)
    end
def generate_resource ( data ) dir = data [ :version ] == 'beta' ? 'google-beta' : 'google' target_folder = File . join ( data [ :output_folder ] , dir ) FileUtils . mkpath target_folder name = data [ :object ] . name . underscore product_name = data [ :product_name ] . underscore filepath = File . join ( target_folder , "resource_#{product_name}_#{name}.go" ) generate_resource_file data . clone . merge ( default_template : 'templates/terraform/resource.erb' , out_file : filepath ) %x( goimports -w  #{ filepath } ) generate_documentation ( data ) end
This function uses the resource.erb template to create one file
per resource.
This function uses the resource . erb template to create one file per resource .
# TODO: error check goimports
data
<not_specific>