Skip to content
Snippets Groups Projects
Commit 4f23df27 authored by Goik Martin's avatar Goik Martin
Browse files

Re-considering terraform output

parent 86b3d35d
No related branches found
No related tags found
No related merge requests found
...@@ -37,8 +37,3 @@ resource "hcloud_server" "helloServer" { ...@@ -37,8 +37,3 @@ resource "hcloud_server" "helloServer" {
ssh_keys = [hcloud_ssh_key.goik.id] ssh_keys = [hcloud_ssh_key.goik.id]
firewall_ids = [hcloud_firewall.sshFw.id] firewall_ids = [hcloud_firewall.sshFw.id]
} }
output "hello_ip_addr" {
value = hcloud_server.helloServer.ipv4_address
description = "The server's IPv4 address"
}
output "hello_ip_addr" {
value = hcloud_server.helloServer.ipv4_address
description = "The server's IPv4 address"
}
output "hello_datacenter" {
value = hcloud_server.helloServer.datacenter
description = "The server's datacenter"
}
\ No newline at end of file
...@@ -522,63 +522,92 @@ resource "hcloud_server" "helloServer" { ...@@ -522,63 +522,92 @@ resource "hcloud_server" "helloServer" {
... ...
Plan: 3 to add, 0 to change, 0 to destroy. Plan: 3 to add, 0 to change, 0 to destroy.
... ...
Apply complete! Resources: 3 added, 0 changed, 0 destroyed. Apply complete! Resources: 3 added, 0 changed, 0 destroyed.</screen>
</screen>
</figure> </figure>
<figure xml:id="sdi_cloudProvider_terra_hello_sshApplyOutputValuesDetails1"> <figure xml:id="sdi_cloudProvider_terra_hello_sshApplyOutputValuesDetails1">
<title>Output data details 1</title> <title>Output data details #1/2</title>
<glosslist> <para>See <link
<glossentry> xlink:href="https://developer.hashicorp.com/terraform/language/values/outputs">
<glossterm><command>terraform</command> <option terraform output documentation</link>:</para>
xlink:href="https://developer.hashicorp.com/terraform/language/values/outputs">output</option></glossterm>
<informaltable border="1">
<glossdef> <tr>
<programlisting language="properties">hello_id = "45839978" <th>File <filename>outputs.tf</filename></th>
hello_ip_addr = "128.140.108.60"</programlisting>
</glossdef> <th>Result</th>
</glossentry> </tr>
<glossentry> <tr>
<glossterm><command>terraform</command> <option <td rowspan="2" valign="top"><programlisting language="terraform">output "hello_ip_addr" {
xlink:href="https://developer.hashicorp.com/terraform/language/values/outputs">output</option> value = hcloud_server.helloServer.ipv4_address
<option>hello_ip_addr</option></glossterm> description = "The server's IPv4 address"
}
<glossdef>
<screen>"128.140.108.60"</screen> output "hello_datacenter" {
</glossdef> value = hcloud_server.helloServer.datacenter
</glossentry> description = "The server's datacenter"
</glosslist> }</programlisting></td>
<td valign="top"><screen language="properties">$ <command>terraform</command> output
hello_datacenter = "nbg1-dc3"
hello_ip_addr = "159.69.152.37"</screen></td>
</tr>
<tr>
<td valign="top"><screen language="properties">$ <command>terraform</command> output hello_ip_addr
"159.69.152.37"</screen></td>
</tr>
</informaltable>
</figure> </figure>
<figure xml:id="sdi_cloudProvider_terra_hello_sshApplyOutputValuesDetails"> <figure xml:id="sdi_cloudProvider_terra_hello_sshApplyOutputValuesDetails">
<title>Output data details 2</title> <title>Output data details #2/2</title>
<glosslist> <informaltable border="1">
<glossentry> <tr>
<glossterm><command>terraform</command> <option <th>File <filename>outputs.tf</filename></th>
xlink:href="https://developer.hashicorp.com/terraform/language/values/outputs">output</option>
<option>-json</option></glossterm> <th><command>terraform</command> output <option>-json</option></th>
</tr>
<glossdef>
<programlisting language="json">{ <tr>
"hello_id": {"sensitive": false, "type": "string", "value": "45839978"}, <td valign="top"><programlisting language="terraform">output "hello_ip_addr" {
"hello_ip_addr": {"sensitive": false, "type": "string", "value": "128.140.108.60"} value = hcloud_server.helloServer.ipv4_address
}</programlisting> description = "The server's IPv4 address"
</glossdef> }
</glossentry>
</glosslist> output "hello_datacenter" {
value = hcloud_server.helloServer.datacenter
description = "The server's datacenter"
}</programlisting></td>
<td valign="top"><programlisting language="json">{
"hello_datacenter": {
"sensitive": false,
"type": "string",
"value": "nbg1-dc3"
},
"hello_ip_addr": {
"sensitive": false,
"type": "string",
"value": "159.69.152.37"
}
}</programlisting></td>
</tr>
</informaltable>
</figure> </figure>
<figure xml:id="sdi_cloudProvider_terra_hello_sshProblemApiToken"> <figure xml:id="sdi_cloudProvider_terra_hello_sshProblemApiToken">
<title><productname>Problem 2</productname>: <xref linkend="glo_VCS"/> <title><productname>Problem 2</productname>: <xref linkend="glo_VCS"/>
and visible provider API token 😱</title> and visible provider API token 😱</title>
<para>Versioned file <filename>main.tf</filename>:</para> <para><emphasis role="red">Versioned</emphasis> file
<filename>main.tf</filename>:</para>
<programlisting language="terraform">... <programlisting language="terraform">...
provider "hcloud" { token = "xdaGfz9LmwO8SWkg ... "} provider "hcloud" { token = "<emphasis role="red">xdaGfz9LmwO8SWkg ... </emphasis>"}
...</programlisting> ...</programlisting>
<para>Solution:</para> <para>Solution:</para>
...@@ -598,7 +627,8 @@ provider "hcloud" { token = "xdaGfz9LmwO8SWkg ... "} ...@@ -598,7 +627,8 @@ provider "hcloud" { token = "xdaGfz9LmwO8SWkg ... "}
<listitem> <listitem>
<para>Optional: Provide a versioned <para>Optional: Provide a versioned
<filename>secrets.auto.tfvars.template</filename> file</para> <filename>secrets.auto.tfvars.template</filename> documenting
file</para>
</listitem> </listitem>
</itemizedlist> </itemizedlist>
</figure> </figure>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment