Skip to content
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

API key #30

Merged
merged 41 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
625941a
Reserved IP addresses
fmeheust Aug 29, 2023
ed062df
Moved Certificate OCID to Load Balancer configuration, since applicat…
fmeheust Aug 30, 2023
50afadc
Merge commit '97d2dd24a9da35f60f26f036748751a6bb05e20a' into reserved-ip
fmeheust Feb 22, 2024
b17f3f7
Merge remote-tracking branch 'origin/HEAD' into reserved-ip
fmeheust Feb 22, 2024
25f65de
Remove changes that removes port 80
fmeheust Feb 22, 2024
f3f6ed9
open https port when certificate is provided
fmeheust Feb 22, 2024
505931c
Removed certificate changes
fmeheust Feb 22, 2024
ae8a166
undo certificate changes
fmeheust Feb 22, 2024
4fb164a
update load balancer
fmeheust Feb 22, 2024
1704be1
images
fmeheust Feb 22, 2024
d67f18a
moving certificate
fmeheust Feb 23, 2024
4538071
Moved certificate OCID to Network
fmeheust Feb 23, 2024
6273cff
Updated usage instructions
fmeheust Feb 23, 2024
34d31b6
Merge remote-tracking branch 'origin/HEAD' into reserved-ip
fmeheust Feb 23, 2024
091ab9b
Changed condition for load balancer http port
fmeheust Feb 24, 2024
e8df30d
do not show private key
fmeheust Mar 11, 2024
e36d946
use existing auth key
fmeheust Mar 11, 2024
1e35a2d
removed unused file
fmeheust Mar 11, 2024
20afdd4
updated ssh config file
fmeheust Mar 11, 2024
5d87502
do not copy private key file
fmeheust Mar 11, 2024
5ff6e1e
debug ssh
fmeheust Mar 12, 2024
d55f1ce
api key
fmeheust Mar 12, 2024
b8a2bc1
verify ssh error
fmeheust Mar 12, 2024
c0e16c4
debug ssh
fmeheust Mar 12, 2024
4ff666e
ssh debug
fmeheust Mar 12, 2024
fb99438
ssh debug continue
fmeheust Mar 12, 2024
667f3e5
dependencies
fmeheust Mar 12, 2024
19731cf
ssh connection attempts
fmeheust Mar 12, 2024
0ea18ae
corrected connection attempts
fmeheust Mar 12, 2024
7ec3d6d
connection attempts before git checkout
fmeheust Mar 12, 2024
46e3835
added wait
fmeheust Mar 12, 2024
d84b327
change order between api key and repo creation
fmeheust Mar 12, 2024
084009e
updated usage information
fmeheust Mar 13, 2024
52d15c1
removed unused local
fmeheust Mar 13, 2024
5639d31
Added possibility to use existing API key
fmeheust Mar 13, 2024
b2916be
file is base64 encoded
fmeheust Mar 13, 2024
6253a6c
Do not upload existing api key
fmeheust Mar 13, 2024
1b33d91
Updated usage instuctions, made api-key required
fmeheust Mar 13, 2024
4206422
private key
fmeheust Mar 13, 2024
2da8d29
Mistake in api key
fmeheust Mar 13, 2024
c822cfc
merge
fmeheust Mar 13, 2024
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
6 changes: 3 additions & 3 deletions config-repo.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@ resource "oci_devops_repository" "config_repo" {
resource "tls_private_key" "rsa_api_key" {
algorithm = "RSA"
rsa_bits = 4096
count = (local.use-image ? 0 : 1)
count = (local.use-image && !var.use_existing_api_key ? 0 : 1)
}

resource "oci_identity_api_key" "user_api_key" {
#Required
key_value = tls_private_key.rsa_api_key[0].public_key_pem
user_id = var.current_user_ocid
count = (local.use-image ? 0 : 1)
count = (local.use-image || var.use_existing_api_key ? 0 : 1)
}

resource "local_file" "api_private_key" {
depends_on = [ tls_private_key.rsa_api_key ]
filename = "${path.module}/api-private-key.pem"
content = tls_private_key.rsa_api_key[0].private_key_pem
content = (var.use_existing_api_key ? base64decode(var.api_key) : tls_private_key.rsa_api_key[0].private_key_pem)
count = (local.use-image ? 0 : 1)
}

Expand Down
13 changes: 13 additions & 0 deletions interface.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ variableGroups:
###APPLICATION_GROUP###
- title: "Stack authentication"
variables:
- use_existing_api_key
- api_key
- use_existing_vault
- new_vault_display_name
- vault_compartment_id
Expand Down Expand Up @@ -203,6 +205,17 @@ variables:
and:
- use_existing_database
# Vault
use_existing_api_key:
type: boolean
title: Use an existing API key
required: true
default: false
description: The API key will be used to authenticate the user when using the OCI devops repository
api_key:
type: file
title: Private key
required: true
visible: use_existing_api_key
use_existing_vault:
type: boolean
title: Use an existing key vault
Expand Down
10 changes: 5 additions & 5 deletions listing/usage-information.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@
</li>
</ul>

<p><strong>Stack authentication</strong>: a Vault is used to store sensitive information such as authentication tokens
and passwords.&nbsp;The stack can either use an existing vault or create a new one.&nbsp;To use an existing key vault,
the stack will let you select the existing vault and key (AES). To create a new vault you must provide
the&nbsp;user-friendly name of the vault to create.</p>
<p><strong>Stack authentication</strong>: the stack uses an API key to connect to the repository. A&nbsp;Vault is used
to store sensitive information such as passwords.&nbsp;The stack can either use an existing vault or create a new
one.&nbsp;To use an existing key vault, the stack will let you select the existing vault and key (AES). To create a
new vault you must provide the&nbsp;user-friendly name of the vault to create.</p>

<p><strong>Database</strong>: The stack assumes that the persistence is handled by a database and this section lets you
configure that database. You can either choose an existing database by selecting the database or create a new one.</p>
Expand Down Expand Up @@ -167,7 +167,7 @@
balancer and the application. If you chose to <em>open the load balancer to the internet</em>, the load balancer
subnet will be a public subnet and an Internet Gateway will be created. A <strong>reserved IP</strong> address can
be used as the load balancer&#39;s public IP.</li>
<li>A c<strong>ertificate</strong> can be provided for the application URL</li>
<li>A <strong>certificate </strong>can be provided for the application URL</li>
</ul>

<p>By default the <em>load balancer</em> is configured with minimum and maximum bandwidth of 10Mbps, the health check
Expand Down
Binary file modified screenshots/7_Vault.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions usage_instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ The stack supports different kinds of deployments: *source code* deployment, jav

![](./screenshots/7_Vault.png)


An **API key** is used to authenticate the user when connecting to the code repository. The stack can either create a new API key or use an existing API key if the **private key** is provided.

A **Vault** is used to store sensitive information such as authentication tokens and passwords. The stack can either use an existing vault (which can be in a different compartment) or create a new one.

To use an existing key vault :
Expand Down
10 changes: 10 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,16 @@ variable "reserved_ip_address" {
default = ""
}

variable "use_existing_api_key" {
type = bool
default = false
}

variable "api_key" {
type = string
default = "none"
}

locals {
# application name with branch
application_name = (var.branch == "" ? var.application_name : "${var.application_name}-${var.branch}")
Expand Down