Skip to content

Commit fc66206

Browse files
authored
feat: add new options to provide instance ssh public key (#68)
Fix: #67
1 parent 1b35a6c commit fc66206

File tree

11 files changed

+170
-123
lines changed

11 files changed

+170
-123
lines changed

CHANGELOG.adoc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,15 @@ Given a version number MAJOR.MINOR.PATCH:
1616
1717
== 2.2.0 - unreleased
1818

19+
=== Deprecated
20+
21+
* `var.ssh_authorized_keys` is deprecated. Use `var.ssh_public_key` add a single public key or `var.ssh_public_key_path` for a file containing mutiple public keys.
22+
1923
=== New features
2024

21-
* Add support for freeform and defined for instances, vnics and block volumes (Fix #10, #11, #12, #13, #18, #20)
22-
* Add "module watermark" freeform tags: module defined and user defined freeform tags are merged on the final resource.
25+
* Add support for freeform and defined tags for instances, vnics and block volumes (Fix #10, #11, #12, #13, #18, #20)
26+
* Add "module watermark" freeform tags: module defined and user defined freeform tags are merged on the final resource
27+
* Add support to provide the `ssh_authorized_keys` argument as a string or as a file (Fix #67)
2328

2429
== 2.1.0 - 2021-03-02
2530

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ This module is maintained by Oracle.
1818

1919
The diagram below summarizes the required components and their respective versions to use this module.
2020

21-
![versions](https://github.com/oracle-terraform-modules/terraform-oci-compute-instance/blob/master/docs/diagrams/versions.svg?raw=true&sanitize=true)
21+
![versions](https://github.com/oracle-terraform-modules/terraform-oci-compute-instance/blob/main/docs/diagrams/versions.svg?raw=true&sanitize=true)
2222

2323
To enforce versions compatibility of both Terraform and the OCI provider, your root configuration should ideally include this block in `main.tf` for version pinning:
2424

@@ -33,13 +33,13 @@ terraform {
3333
}
3434
```
3535

36-
For detailed information about inputs and outputs, and potential sub-modules, see [docs/terraformoptions](https://github.com/oracle-terraform-modules/terraform-oci-compute-instance/blob/master/docs/terraformoptions.adoc).
36+
For detailed information about inputs and outputs, and potential sub-modules, see [docs/terraformoptions](https://github.com/oracle-terraform-modules/terraform-oci-compute-instance/blob/main/docs/terraformoptions.adoc).
3737

3838
## How to use this module
3939

4040
*See [Oracle Cloud Infrastructure documentation](https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/terraformproviderconfiguration.htm) to get started with the Oracle Cloud Infrastructure Terraform Provider.*
4141

42-
The [examples](https://github.com/oracle-terraform-modules/terraform-oci-compute-instance/tree/master/examples/) folder contains detailed examples that shows how to use this module. The following code example creates an Oracle Cloud Infrastructure compute instance on AD-1 with an additional Block Volume attached:
42+
The [examples](https://github.com/oracle-terraform-modules/terraform-oci-compute-instance/tree/main/examples/) folder contains detailed examples that shows how to use this module. The following code example creates an Oracle Cloud Infrastructure compute instance on AD-1 with an additional Block Volume attached:
4343

4444
```hcl
4545
module "instance" {
@@ -94,14 +94,14 @@ net start winrm
9494

9595
This project is open source. Oracle appreciates any contributions that are made by the open source community: raising issues, improving documentation, fixing bugs, or adding new features.
9696

97-
Learn how to [contribute](https://github.com/oracle-terraform-modules/terraform-oci-compute-instance/blob/master/CONTRIBUTING.adoc).
97+
Learn how to [contribute](https://github.com/oracle-terraform-modules/terraform-oci-compute-instance/blob/main/CONTRIBUTING.adoc).
9898

99-
[Folks who contributed](https://github.com/oracle-terraform-modules/terraform-oci-compute-instance/blob/master/CONTRIBUTORS.adoc) with explanations, code, feedback, ideas, testing etc.
99+
[Folks who contributed](https://github.com/oracle-terraform-modules/terraform-oci-compute-instance/blob/main/CONTRIBUTORS.adoc) with explanations, code, feedback, ideas, testing etc.
100100

101101
## License
102102

103103
Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
104104

105105
Licensed under the Universal Permissive License 1.0 or Apache License 2.0.
106106

107-
See [LICENSE](https://github.com/oracle-terraform-modules/terraform-oci-compute-instance/blob/master/LICENSE.txt) for more details.
107+
See [LICENSE](https://github.com/oracle-terraform-modules/terraform-oci-compute-instance/blob/main/LICENSE.txt) for more details.

docs/diagrams/versions.iuml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ object "OCI Terraform Provider" as tfprovider #94AFAF {
2424
}
2525

2626
object "oci-compute Module" as tfmodule #759C6C {
27-
version >= 2.0.2
27+
version >= 2.2.0
2828
}
2929

3030
tfmodule -d- tfprovider

docs/diagrams/versions.svg

Lines changed: 3 additions & 3 deletions
Loading

docs/terraformoptions.adoc

Lines changed: 90 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -3,192 +3,216 @@
33
[cols="a,a",options="header,autowidth"]
44
|===
55
|Name |Version
6-
|terraform |>= 0.12
7-
|oci |>= 3.27
6+
|[[requirement_terraform]] <<requirement_terraform,terraform>> |>= 0.12
7+
|[[requirement_oci]] <<requirement_oci,oci>> |>= 3.27
88
|===
99

1010
== Providers
1111

1212
[cols="a,a",options="header,autowidth"]
1313
|===
1414
|Name |Version
15-
|oci |>= 3.27
15+
|[[provider_oci]] <<provider_oci,oci>> |>= 3.27
1616
|===
1717

1818
== Modules
1919

20-
No Modules.
20+
No modules.
2121

2222
== Resources
2323

24-
[cols="a",options="header,autowidth"]
24+
[cols="a,a",options="header,autowidth"]
2525
|===
26-
|Name
27-
|https://registry.terraform.io/providers/hashicorp/oci/latest/docs/resources/core_instance[oci_core_instance]
28-
|https://registry.terraform.io/providers/hashicorp/oci/latest/docs/data-sources/core_instance_credentials[oci_core_instance_credentials]
29-
|https://registry.terraform.io/providers/hashicorp/oci/latest/docs/data-sources/core_shapes[oci_core_shapes]
30-
|https://registry.terraform.io/providers/hashicorp/oci/latest/docs/data-sources/core_subnet[oci_core_subnet]
31-
|https://registry.terraform.io/providers/hashicorp/oci/latest/docs/resources/core_volume[oci_core_volume]
32-
|https://registry.terraform.io/providers/hashicorp/oci/latest/docs/resources/core_volume_attachment[oci_core_volume_attachment]
33-
|https://registry.terraform.io/providers/hashicorp/oci/latest/docs/data-sources/identity_availability_domains[oci_identity_availability_domains]
26+
|Name |Type
27+
|https://registry.terraform.io/providers/hashicorp/oci/latest/docs/resources/core_instance[oci_core_instance.this] |resource
28+
|https://registry.terraform.io/providers/hashicorp/oci/latest/docs/resources/core_volume[oci_core_volume.this] |resource
29+
|https://registry.terraform.io/providers/hashicorp/oci/latest/docs/resources/core_volume_attachment[oci_core_volume_attachment.this] |resource
30+
|https://registry.terraform.io/providers/hashicorp/oci/latest/docs/data-sources/core_instance_credentials[oci_core_instance_credentials.this] |data source
31+
|https://registry.terraform.io/providers/hashicorp/oci/latest/docs/data-sources/core_shapes[oci_core_shapes.ad1] |data source
32+
|https://registry.terraform.io/providers/hashicorp/oci/latest/docs/data-sources/core_subnet[oci_core_subnet.this] |data source
33+
|https://registry.terraform.io/providers/hashicorp/oci/latest/docs/data-sources/identity_availability_domains[oci_identity_availability_domains.ad] |data source
3434
|===
3535

3636
== Inputs
3737

3838
[cols="a,a,a,a,a",options="header,autowidth"]
3939
|===
4040
|Name |Description |Type |Default |Required
41-
|compartment_ocid
42-
|(Updatable) The OCID of the compartment where to create all resources
43-
|`string`
44-
|n/a
45-
|yes
46-
47-
|source_ocid
48-
|The OCID of an image or a boot volume to use, depending on the value of source_type.
49-
|`string`
50-
|n/a
51-
|yes
52-
53-
|ssh_authorized_keys
54-
|Public SSH keys path to be included in the ~/.ssh/authorized_keys file for the default user on the instance.
55-
|`string`
56-
|n/a
57-
|yes
58-
59-
|subnet_ocids
60-
|The unique identifiers (OCIDs) of the subnets in which the instance primary VNICs are created.
61-
|`list(string)`
62-
|n/a
63-
|yes
64-
65-
|ad_number
41+
|[[input_ad_number]] <<input_ad_number,ad_number>>
6642
|The availability domain number of the instance. If none is provided, it will start with AD-1 and continue in round-robin.
6743
|`number`
6844
|`null`
6945
|no
7046

71-
|assign_public_ip
47+
|[[input_assign_public_ip]] <<input_assign_public_ip,assign_public_ip>>
7248
|Whether the VNIC should be assigned a public IP address.
7349
|`bool`
7450
|`false`
7551
|no
7652

77-
|attachment_type
53+
|[[input_attachment_type]] <<input_attachment_type,attachment_type>>
7854
|(Optional) The type of volume. The only supported values are iscsi and paravirtualized.
7955
|`string`
8056
|`"paravirtualized"`
8157
|no
8258

83-
|block_storage_sizes_in_gbs
59+
|[[input_block_storage_sizes_in_gbs]] <<input_block_storage_sizes_in_gbs,block_storage_sizes_in_gbs>>
8460
|Sizes of volumes to create and attach to each instance.
8561
|`list(number)`
8662
|`[]`
8763
|no
8864

89-
|boot_volume_size_in_gbs
65+
|[[input_boot_volume_size_in_gbs]] <<input_boot_volume_size_in_gbs,boot_volume_size_in_gbs>>
9066
|The size of the boot volume in GBs.
9167
|`number`
9268
|`null`
9369
|no
9470

95-
|extended_metadata
71+
|[[input_compartment_ocid]] <<input_compartment_ocid,compartment_ocid>>
72+
|(Updatable) The OCID of the compartment where to create all resources
73+
|`string`
74+
|n/a
75+
|yes
76+
77+
|[[input_defined_tags]] <<input_defined_tags,defined_tags>>
78+
|predefined and scoped to a namespace to tag the resources created using defined tags.
79+
|`map(string)`
80+
|`null`
81+
|no
82+
83+
|[[input_extended_metadata]] <<input_extended_metadata,extended_metadata>>
9684
|(Updatable) Additional metadata key/value pairs that you provide.
9785
|`map(any)`
9886
|`{}`
9987
|no
10088

101-
|hostname_label
89+
|[[input_freeform_tags]] <<input_freeform_tags,freeform_tags>>
90+
|simple key-value pairs to tag the resources created using freeform tags.
91+
|`map(string)`
92+
|`null`
93+
|no
94+
95+
|[[input_hostname_label]] <<input_hostname_label,hostname_label>>
10296
|The hostname for the VNIC's primary private IP.
10397
|`string`
10498
|`""`
10599
|no
106100

107-
|instance_count
101+
|[[input_instance_count]] <<input_instance_count,instance_count>>
108102
|Number of identical instances to launch from a single module.
109103
|`number`
110104
|`1`
111105
|no
112106

113-
|instance_display_name
107+
|[[input_instance_display_name]] <<input_instance_display_name,instance_display_name>>
114108
|(Updatable) A user-friendly name for the instance. Does not have to be unique, and it's changeable.
115109
|`string`
116110
|`""`
117111
|no
118112

119-
|instance_flex_memory_in_gbs
113+
|[[input_instance_flex_memory_in_gbs]] <<input_instance_flex_memory_in_gbs,instance_flex_memory_in_gbs>>
120114
|(Updatable) The total amount of memory available to the instance, in gigabytes.
121115
|`number`
122116
|`null`
123117
|no
124118

125-
|instance_flex_ocpus
119+
|[[input_instance_flex_ocpus]] <<input_instance_flex_ocpus,instance_flex_ocpus>>
126120
|(Updatable) The total number of OCPUs available to the instance.
127121
|`number`
128122
|`null`
129123
|no
130124

131-
|instance_timeout
125+
|[[input_instance_timeout]] <<input_instance_timeout,instance_timeout>>
132126
|Timeout setting for creating instance.
133127
|`string`
134128
|`"25m"`
135129
|no
136130

137-
|ipxe_script
131+
|[[input_ipxe_script]] <<input_ipxe_script,ipxe_script>>
138132
|(Optional) The iPXE script which to continue the boot process on the instance.
139133
|`string`
140134
|`null`
141135
|no
142136

143-
|preserve_boot_volume
137+
|[[input_preserve_boot_volume]] <<input_preserve_boot_volume,preserve_boot_volume>>
144138
|Specifies whether to delete or preserve the boot volume when terminating an instance.
145139
|`bool`
146140
|`false`
147141
|no
148142

149-
|private_ips
143+
|[[input_private_ips]] <<input_private_ips,private_ips>>
150144
|Private IP addresses of your choice to assign to the VNICs.
151145
|`list(string)`
152146
|`[]`
153147
|no
154148

155-
|resource_platform
149+
|[[input_resource_platform]] <<input_resource_platform,resource_platform>>
156150
|Platform to create resources in.
157151
|`string`
158152
|`"linux"`
159153
|no
160154

161-
|shape
155+
|[[input_shape]] <<input_shape,shape>>
162156
|The shape of an instance.
163157
|`string`
164158
|`"VM.Standard2.1"`
165159
|no
166160

167-
|skip_source_dest_check
161+
|[[input_skip_source_dest_check]] <<input_skip_source_dest_check,skip_source_dest_check>>
168162
|Whether the source/destination check is disabled on the VNIC.
169163
|`bool`
170164
|`false`
171165
|no
172166

173-
|source_type
167+
|[[input_source_ocid]] <<input_source_ocid,source_ocid>>
168+
|The OCID of an image or a boot volume to use, depending on the value of source_type.
169+
|`string`
170+
|n/a
171+
|yes
172+
173+
|[[input_source_type]] <<input_source_type,source_type>>
174174
|The source type for the instance.
175175
|`string`
176176
|`"image"`
177177
|no
178178

179-
|use_chap
179+
|[[input_ssh_authorized_keys]] <<input_ssh_authorized_keys,ssh_authorized_keys>>
180+
|DEPRECATED: use ssh_public_key or ssh_public_key_path instead. Public SSH keys path to be included in the ~/.ssh/authorized_keys file for the default user on the instance.
181+
|`string`
182+
|`null`
183+
|no
184+
185+
|[[input_ssh_public_key]] <<input_ssh_public_key,ssh_public_key>>
186+
|The content of the ssh public key used to access the compute instance. Set this, or ssh_public_key_path to add multiple keys at once.
187+
|`string`
188+
|`null`
189+
|no
190+
191+
|[[input_ssh_public_key_path]] <<input_ssh_public_key_path,ssh_public_key_path>>
192+
|Path to file containing one or more ssh public keys used to access the compute instance. One key per line. Set this or the ssh_public_key.
193+
|`string`
194+
|`null`
195+
|no
196+
197+
|[[input_subnet_ocids]] <<input_subnet_ocids,subnet_ocids>>
198+
|The unique identifiers (OCIDs) of the subnets in which the instance primary VNICs are created.
199+
|`list(string)`
200+
|n/a
201+
|yes
202+
203+
|[[input_use_chap]] <<input_use_chap,use_chap>>
180204
|(Applicable when attachment_type=iscsi) Whether to use CHAP authentication for the volume attachment.
181205
|`bool`
182206
|`false`
183207
|no
184208

185-
|user_data
209+
|[[input_user_data]] <<input_user_data,user_data>>
186210
|Provide your own base64-encoded data to be used by Cloud-Init to run custom scripts or provide custom Cloud-Init configuration.
187211
|`string`
188212
|`null`
189213
|no
190214

191-
|vnic_name
215+
|[[input_vnic_name]] <<input_vnic_name,vnic_name>>
192216
|A user-friendly name for the VNIC.
193217
|`string`
194218
|`""`
@@ -201,10 +225,10 @@ No Modules.
201225
[cols="a,a",options="header,autowidth"]
202226
|===
203227
|Name |Description
204-
|instance_id |ocid of created instances.
205-
|instance_password |Passwords to login to Windows instance.
206-
|instance_username |Usernames to login to Windows instance.
207-
|instances_summary |Private and Public IPs for each instance.
208-
|private_ip |Private IPs of created instances.
209-
|public_ip |Public IPs of created instances.
210-
|===
228+
|[[output_instance_id]] <<output_instance_id,instance_id>> |ocid of created instances.
229+
|[[output_instance_password]] <<output_instance_password,instance_password>> |Passwords to login to Windows instance.
230+
|[[output_instance_username]] <<output_instance_username,instance_username>> |Usernames to login to Windows instance.
231+
|[[output_instances_summary]] <<output_instances_summary,instances_summary>> |Private and Public IPs for each instance.
232+
|[[output_private_ip]] <<output_private_ip,private_ip>> |Private IPs of created instances.
233+
|[[output_public_ip]] <<output_public_ip,public_ip>> |Public IPs of created instances.
234+
|===

0 commit comments

Comments
 (0)