Skip to content

feat: add new options to provide instance ssh public key #68

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions CHANGELOG.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,15 @@ Given a version number MAJOR.MINOR.PATCH:

== 2.2.0 - unreleased

=== Deprecated

* `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.

=== New features

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

== 2.1.0 - 2021-03-02

Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ This module is maintained by Oracle.

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

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

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:

Expand All @@ -33,13 +33,13 @@ terraform {
}
```

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).
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).

## How to use this module

*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.*

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:
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:

```hcl
module "instance" {
Expand Down Expand Up @@ -94,14 +94,14 @@ net start winrm

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.

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

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

## License

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

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

See [LICENSE](https://github.com/oracle-terraform-modules/terraform-oci-compute-instance/blob/master/LICENSE.txt) for more details.
See [LICENSE](https://github.com/oracle-terraform-modules/terraform-oci-compute-instance/blob/main/LICENSE.txt) for more details.
2 changes: 1 addition & 1 deletion docs/diagrams/versions.iuml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ object "OCI Terraform Provider" as tfprovider #94AFAF {
}

object "oci-compute Module" as tfmodule #759C6C {
version >= 2.0.2
version >= 2.2.0
}

tfmodule -d- tfprovider
Expand Down
6 changes: 3 additions & 3 deletions docs/diagrams/versions.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
156 changes: 90 additions & 66 deletions docs/terraformoptions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,192 +3,216 @@
[cols="a,a",options="header,autowidth"]
|===
|Name |Version
|terraform |>= 0.12
|oci |>= 3.27
|[[requirement_terraform]] <<requirement_terraform,terraform>> |>= 0.12
|[[requirement_oci]] <<requirement_oci,oci>> |>= 3.27
|===

== Providers

[cols="a,a",options="header,autowidth"]
|===
|Name |Version
|oci |>= 3.27
|[[provider_oci]] <<provider_oci,oci>> |>= 3.27
|===

== Modules

No Modules.
No modules.

== Resources

[cols="a",options="header,autowidth"]
[cols="a,a",options="header,autowidth"]
|===
|Name
|https://registry.terraform.io/providers/hashicorp/oci/latest/docs/resources/core_instance[oci_core_instance]
|https://registry.terraform.io/providers/hashicorp/oci/latest/docs/data-sources/core_instance_credentials[oci_core_instance_credentials]
|https://registry.terraform.io/providers/hashicorp/oci/latest/docs/data-sources/core_shapes[oci_core_shapes]
|https://registry.terraform.io/providers/hashicorp/oci/latest/docs/data-sources/core_subnet[oci_core_subnet]
|https://registry.terraform.io/providers/hashicorp/oci/latest/docs/resources/core_volume[oci_core_volume]
|https://registry.terraform.io/providers/hashicorp/oci/latest/docs/resources/core_volume_attachment[oci_core_volume_attachment]
|https://registry.terraform.io/providers/hashicorp/oci/latest/docs/data-sources/identity_availability_domains[oci_identity_availability_domains]
|Name |Type
|https://registry.terraform.io/providers/hashicorp/oci/latest/docs/resources/core_instance[oci_core_instance.this] |resource
|https://registry.terraform.io/providers/hashicorp/oci/latest/docs/resources/core_volume[oci_core_volume.this] |resource
|https://registry.terraform.io/providers/hashicorp/oci/latest/docs/resources/core_volume_attachment[oci_core_volume_attachment.this] |resource
|https://registry.terraform.io/providers/hashicorp/oci/latest/docs/data-sources/core_instance_credentials[oci_core_instance_credentials.this] |data source
|https://registry.terraform.io/providers/hashicorp/oci/latest/docs/data-sources/core_shapes[oci_core_shapes.ad1] |data source
|https://registry.terraform.io/providers/hashicorp/oci/latest/docs/data-sources/core_subnet[oci_core_subnet.this] |data source
|https://registry.terraform.io/providers/hashicorp/oci/latest/docs/data-sources/identity_availability_domains[oci_identity_availability_domains.ad] |data source
|===

== Inputs

[cols="a,a,a,a,a",options="header,autowidth"]
|===
|Name |Description |Type |Default |Required
|compartment_ocid
|(Updatable) The OCID of the compartment where to create all resources
|`string`
|n/a
|yes

|source_ocid
|The OCID of an image or a boot volume to use, depending on the value of source_type.
|`string`
|n/a
|yes

|ssh_authorized_keys
|Public SSH keys path to be included in the ~/.ssh/authorized_keys file for the default user on the instance.
|`string`
|n/a
|yes

|subnet_ocids
|The unique identifiers (OCIDs) of the subnets in which the instance primary VNICs are created.
|`list(string)`
|n/a
|yes

|ad_number
|[[input_ad_number]] <<input_ad_number,ad_number>>
|The availability domain number of the instance. If none is provided, it will start with AD-1 and continue in round-robin.
|`number`
|`null`
|no

|assign_public_ip
|[[input_assign_public_ip]] <<input_assign_public_ip,assign_public_ip>>
|Whether the VNIC should be assigned a public IP address.
|`bool`
|`false`
|no

|attachment_type
|[[input_attachment_type]] <<input_attachment_type,attachment_type>>
|(Optional) The type of volume. The only supported values are iscsi and paravirtualized.
|`string`
|`"paravirtualized"`
|no

|block_storage_sizes_in_gbs
|[[input_block_storage_sizes_in_gbs]] <<input_block_storage_sizes_in_gbs,block_storage_sizes_in_gbs>>
|Sizes of volumes to create and attach to each instance.
|`list(number)`
|`[]`
|no

|boot_volume_size_in_gbs
|[[input_boot_volume_size_in_gbs]] <<input_boot_volume_size_in_gbs,boot_volume_size_in_gbs>>
|The size of the boot volume in GBs.
|`number`
|`null`
|no

|extended_metadata
|[[input_compartment_ocid]] <<input_compartment_ocid,compartment_ocid>>
|(Updatable) The OCID of the compartment where to create all resources
|`string`
|n/a
|yes

|[[input_defined_tags]] <<input_defined_tags,defined_tags>>
|predefined and scoped to a namespace to tag the resources created using defined tags.
|`map(string)`
|`null`
|no

|[[input_extended_metadata]] <<input_extended_metadata,extended_metadata>>
|(Updatable) Additional metadata key/value pairs that you provide.
|`map(any)`
|`{}`
|no

|hostname_label
|[[input_freeform_tags]] <<input_freeform_tags,freeform_tags>>
|simple key-value pairs to tag the resources created using freeform tags.
|`map(string)`
|`null`
|no

|[[input_hostname_label]] <<input_hostname_label,hostname_label>>
|The hostname for the VNIC's primary private IP.
|`string`
|`""`
|no

|instance_count
|[[input_instance_count]] <<input_instance_count,instance_count>>
|Number of identical instances to launch from a single module.
|`number`
|`1`
|no

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

|instance_flex_memory_in_gbs
|[[input_instance_flex_memory_in_gbs]] <<input_instance_flex_memory_in_gbs,instance_flex_memory_in_gbs>>
|(Updatable) The total amount of memory available to the instance, in gigabytes.
|`number`
|`null`
|no

|instance_flex_ocpus
|[[input_instance_flex_ocpus]] <<input_instance_flex_ocpus,instance_flex_ocpus>>
|(Updatable) The total number of OCPUs available to the instance.
|`number`
|`null`
|no

|instance_timeout
|[[input_instance_timeout]] <<input_instance_timeout,instance_timeout>>
|Timeout setting for creating instance.
|`string`
|`"25m"`
|no

|ipxe_script
|[[input_ipxe_script]] <<input_ipxe_script,ipxe_script>>
|(Optional) The iPXE script which to continue the boot process on the instance.
|`string`
|`null`
|no

|preserve_boot_volume
|[[input_preserve_boot_volume]] <<input_preserve_boot_volume,preserve_boot_volume>>
|Specifies whether to delete or preserve the boot volume when terminating an instance.
|`bool`
|`false`
|no

|private_ips
|[[input_private_ips]] <<input_private_ips,private_ips>>
|Private IP addresses of your choice to assign to the VNICs.
|`list(string)`
|`[]`
|no

|resource_platform
|[[input_resource_platform]] <<input_resource_platform,resource_platform>>
|Platform to create resources in.
|`string`
|`"linux"`
|no

|shape
|[[input_shape]] <<input_shape,shape>>
|The shape of an instance.
|`string`
|`"VM.Standard2.1"`
|no

|skip_source_dest_check
|[[input_skip_source_dest_check]] <<input_skip_source_dest_check,skip_source_dest_check>>
|Whether the source/destination check is disabled on the VNIC.
|`bool`
|`false`
|no

|source_type
|[[input_source_ocid]] <<input_source_ocid,source_ocid>>
|The OCID of an image or a boot volume to use, depending on the value of source_type.
|`string`
|n/a
|yes

|[[input_source_type]] <<input_source_type,source_type>>
|The source type for the instance.
|`string`
|`"image"`
|no

|use_chap
|[[input_ssh_authorized_keys]] <<input_ssh_authorized_keys,ssh_authorized_keys>>
|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.
|`string`
|`null`
|no

|[[input_ssh_public_key]] <<input_ssh_public_key,ssh_public_key>>
|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.
|`string`
|`null`
|no

|[[input_ssh_public_key_path]] <<input_ssh_public_key_path,ssh_public_key_path>>
|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.
|`string`
|`null`
|no

|[[input_subnet_ocids]] <<input_subnet_ocids,subnet_ocids>>
|The unique identifiers (OCIDs) of the subnets in which the instance primary VNICs are created.
|`list(string)`
|n/a
|yes

|[[input_use_chap]] <<input_use_chap,use_chap>>
|(Applicable when attachment_type=iscsi) Whether to use CHAP authentication for the volume attachment.
|`bool`
|`false`
|no

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

|vnic_name
|[[input_vnic_name]] <<input_vnic_name,vnic_name>>
|A user-friendly name for the VNIC.
|`string`
|`""`
Expand All @@ -201,10 +225,10 @@ No Modules.
[cols="a,a",options="header,autowidth"]
|===
|Name |Description
|instance_id |ocid of created instances.
|instance_password |Passwords to login to Windows instance.
|instance_username |Usernames to login to Windows instance.
|instances_summary |Private and Public IPs for each instance.
|private_ip |Private IPs of created instances.
|public_ip |Public IPs of created instances.
|===
|[[output_instance_id]] <<output_instance_id,instance_id>> |ocid of created instances.
|[[output_instance_password]] <<output_instance_password,instance_password>> |Passwords to login to Windows instance.
|[[output_instance_username]] <<output_instance_username,instance_username>> |Usernames to login to Windows instance.
|[[output_instances_summary]] <<output_instances_summary,instances_summary>> |Private and Public IPs for each instance.
|[[output_private_ip]] <<output_private_ip,private_ip>> |Private IPs of created instances.
|[[output_public_ip]] <<output_public_ip,public_ip>> |Public IPs of created instances.
|===
Loading