Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
raise "Missing parameter 'CRED_PATH'. Please read docs at #{__FILE__}" \
unless ENV.key?('CRED_PATH')
my_project = "jj-test-kitchen"
gauth_credential 'mycred' do
action :serviceaccount
path ENV['CRED_PATH'] # e.g. '/path/to/my_account.json'
scopes [
'https://www.googleapis.com/auth/compute'
]
end
gcompute_zone 'us-west1-a' do
action :create
project my_project
credential 'mycred'
end
gcompute_disk 'instance-test-os-1' do
action :create
source_image 'projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts'
zone 'us-west1-a'
project my_project
credential 'mycred'
end
gcompute_network 'mynetwork-test' do
action :create
project my_project
credential 'mycred'
end
gcompute_region 'us-west1' do
action :create
project my_project
credential 'mycred'
end
gcompute_address 'instance-test-ip' do
action :create
region 'us-west1'
project my_project
credential 'mycred'
end
gcompute_machine_type 'n1-standard-1' do
action :create
zone 'us-west1-a'
project my_project
credential 'mycred'
end
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'
}
]
}
]
zone 'us-west1-a'
project my_project
credential 'mycred'
metadata ({
items: [
{ key: 'startup-script-url',
value: 'gs://jj-test-kitchen/boostrap.sh'
}
]
})
tags ({
items: [
'http-server',
'https-server'
]
})
service_accounts [
{ scopes: [ 'https://www.googleapis.com/auth/devstorage.read_only',
'https://www.googleapis.com/auth/logging.write' ] }
]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.