Puppet Function: gcompute_address_ref

Defined in:
lib/puppet/functions/gcompute_address_ref.rb
Function type:
Ruby 4.x API

Overview

gcompute_address_ref(String $name, String $region, String $project)Any

Builds a reference to the IP address associated with the Address managed by a ‘gcompute_address` resource.

Arguments:

- name: string
  the name of the address resource
- region: string
  the region where the address resource is allocated
- project: string
  the project name where resource is allocated

Examples:

- gcompute_address_ref('my-server', 'us-central1', 'myproject')

This function is useful for when a reference to a resource that have multiple facts, such as ‘gcompute_forwarding_rule { ip_address }`

Parameters:

  • name (String)
  • region (String)
  • project (String)

Returns:

  • (Any)


46
47
48
49
50
51
52
53
54
55
56
# File 'lib/puppet/functions/gcompute_address_ref.rb', line 46

Puppet::Functions.create_function(:gcompute_address_ref) do
  dispatch :gcompute_address_ref do
    param 'String', :name
    param 'String', :region
    param 'String', :project
  end

  def gcompute_address_ref(name, region, project)
    "projects/#{project}/regions/#{region}/addresses/#{name}"
  end
end