I have a working GCP-Deployment-Manager setup, consisting of a .jinja instance template and a config.yaml file.
Using the Google Cloud Console, I also have created a GCP reserved IP address. Now I want to assign that IP address to the newly deployed instance at deployment creation time.
Where must I add the value of this static IP address?
- In the config.yaml file?
- In the instance-template.jinja file?
- in the
gcloud deployment-manager deployments create ...
command ?
And in which format?
I want to start my deployment such that it uses that static IP address from the very beginning. I already know how to change the ephemeral IP address to the reserved IP address, but that is an extra step of work, and it messes up the SSH keys configuration.
All deployment-manager script examples that I've seen before (examples) only create a new reserved IP address from scratch, it does not really "re-use" an existing one created previously.
I can post my config files here if requested, but maybe some expert can answer this question anyway.
UPDATE 6 hours later:
I have added this to the beginning of my instance-template.jinja
file. Works for me:
{% set STATIC_IP = "my-ip-name" %}
resources:
- name: {{ STATIC_IP }}
type: compute.v1.address
properties:
region: {{ properties["region"] }}
Maybe there is a more elegant way to do this, perhaps by passing in the name from within the config.yaml
file (similar to "region" above)