V
V
VITYA-XY12020-07-01 19:28:53
Chef
VITYA-XY1, 2020-07-01 19:28:53

How to correctly write tags in chef cookbook for gcloud instance?

I used this cookbook:
https://supermarket.chef.io/cookbooks/google-gcompute

I registered it as described in the doc:

gcompute_instance 'instance-test' do
  action :create
  machine_type 'n1-standard-1'
  disks [
    {
      boot: true,
      auto_delete: true,
      source: 'instance-test-os-1'
    }
  ]
  network_interfaces [
    {
      network: 'mynetwork-test',
      access_configs: [
        {
          name: 'External NAT',
          nat_ip: 'instance-test-ip',
          type: 'ONE_TO_ONE_NAT'
        }
      ]
    }
  ]
  tags { 
    items
         [  
          'instance-test'
         ]
  }
  zone 'us-central1-a'
  project ENV['GCP_PROJECT']
  credential 'mycred'
end


Mistake:
[2020-07-01T19:26:56+03:00] FATAL: RuntimeError: Property `tags` of `gcompute_instance[instance-test]` was incorrectly passed a block. Possible property-resource collision. To call a resource named `tags` either rename the property or else use `declare_resource(:tags, ...)`

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question