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

Rename DSA credentials to credential #76

Merged
merged 5 commits into from
Oct 11, 2023
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
4 changes: 2 additions & 2 deletions MIGRATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ import {

import {
id = "project_id,instance_id,credentials_id"
to = stackit_logme_credentials.example-credentials
to = stackit_logme_credential.example-credential
}
```

Expand All @@ -120,7 +120,7 @@ resource "stackit_logme_instance" "example-instance" {
}

# __generated__ by Terraform from "project_id,instance_id,credentials_id"
resource "stackit_logme_credentials" "example-credentials" {
resource "stackit_logme_credential" "example-credential" {
instance_id = "instance_id"
project_id = "project_id"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "stackit_logme_credentials Data Source - stackit"
page_title: "stackit_logme_credential Data Source - stackit"
subcategory: ""
description: |-
LogMe credentials data source schema.
LogMe credential data source schema.
---

# stackit_logme_credentials (Data Source)
# stackit_logme_credential (Data Source)

LogMe credentials data source schema.
LogMe credential data source schema.

## Example Usage

```terraform
data "stackit_logme_credentials" "example" {
data "stackit_logme_credential" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
instance_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
credentials_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "stackit_mariadb_credentials Data Source - stackit"
page_title: "stackit_mariadb_credential Data Source - stackit"
subcategory: ""
description: |-
MariaDB credentials data source schema.
MariaDB credential data source schema.
---

# stackit_mariadb_credentials (Data Source)
# stackit_mariadb_credential (Data Source)

MariaDB credentials data source schema.
MariaDB credential data source schema.

## Example Usage

```terraform
data "stackit_mariadb_credentials" "example" {
data "stackit_mariadb_credential" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
instance_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
credentials_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
Expand Down
4 changes: 2 additions & 2 deletions docs/data-sources/objectstorage_bucket.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
page_title: "stackit_objectstorage_bucket Data Source - stackit"
subcategory: ""
description: |-
ObjectStorage credentials data source schema.
ObjectStorage credential data source schema.
---

# stackit_objectstorage_bucket (Data Source)

ObjectStorage credentials data source schema.
ObjectStorage credential data source schema.



Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "stackit_opensearch_credentials Data Source - stackit"
page_title: "stackit_opensearch_credential Data Source - stackit"
subcategory: ""
description: |-
OpenSearch credentials data source schema.
OpenSearch credential data source schema.
---

# stackit_opensearch_credentials (Data Source)
# stackit_opensearch_credential (Data Source)

OpenSearch credentials data source schema.
OpenSearch credential data source schema.

## Example Usage

```terraform
data "stackit_opensearch_credentials" "example" {
data "stackit_opensearch_credential" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
instance_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
credentials_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "stackit_postgresql_credentials Data Source - stackit"
page_title: "stackit_postgresql_credential Data Source - stackit"
subcategory: ""
description: |-
PostgreSQL credentials data source schema.
PostgreSQL credential data source schema.
---

# stackit_postgresql_credentials (Data Source)
# stackit_postgresql_credential (Data Source)

PostgreSQL credentials data source schema.
PostgreSQL credential data source schema.

## Example Usage

```terraform
data "stackit_postgresql_credentials" "example" {
data "stackit_postgresql_credential" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
instance_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
credentials_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "stackit_rabbitmq_credentials Data Source - stackit"
page_title: "stackit_rabbitmq_credential Data Source - stackit"
subcategory: ""
description: |-
RabbitMQ credentials data source schema.
RabbitMQ credential data source schema.
---

# stackit_rabbitmq_credentials (Data Source)
# stackit_rabbitmq_credential (Data Source)

RabbitMQ credentials data source schema.
RabbitMQ credential data source schema.

## Example Usage

```terraform
data "stackit_rabbitmq_credentials" "example" {
data "stackit_rabbitmq_credential" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
instance_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
credentials_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "stackit_redis_credentials Data Source - stackit"
page_title: "stackit_redis_credential Data Source - stackit"
subcategory: ""
description: |-
Redis credentials data source schema.
Redis credential data source schema.
---

# stackit_redis_credentials (Data Source)
# stackit_redis_credential (Data Source)

Redis credentials data source schema.
Redis credential data source schema.

## Example Usage

```terraform
data "stackit_redis_credentials" "example" {
data "stackit_redis_credential" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
instance_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
credentials_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
Expand Down
60 changes: 35 additions & 25 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ To authenticate, you will need a [service account](https://docs.stackit.cloud/st

When setting up authentication, the provider will always try to use the key flow first and search for credentials in several locations, following a specific order:

1. Explicit configuration, e.g. by seting the fiel `stackit_service_account_key_path` in the provider block (see example below)
1. Explicit configuration, e.g. by seting the field `stackit_service_account_key_path` in the provider block (see example below)
2. Environment variable, e.g. by setting `STACKIT_SERVICE_ACCOUNT_KEY_PATH`
3. Credentials file

The SDK will check the credentials file located in the path defined by the `STACKIT_CREDENTIALS_PATH` env var, if specified,
or in `$HOME/.stackit/credentials.json` as a fallback.
The credentials should be set using the same name as the environmnet variables. Example:
The credentials should be set using the same name as the environment variables. Example:

```json
{
Expand All @@ -64,32 +64,42 @@ To configure it, follow this steps:

The following instructions assume that you have created a service account and assigned it the necessary permissions, e.g. project.owner.

1. In the Portal, go to `Service Account -> Service Account Keys` and create a key.
- You can create your own RSA key-pair or have the Portal generate one for you.
2. Save the content of the service account key and the corresponding private key by copying them or saving them in a file. The expected format of the service account key is the following:
```json
{
"id": "uuid",
"publicKey": "public key",
"createdAt": "2023-08-24T14:15:22Z",
"validUntil": "2023-08-24T14:15:22Z",
"keyType": "USER_MANAGED",
"keyOrigin": "USER_PROVIDED",
"keyAlgorithm": "RSA_2048",
"active": true,
"credentials": {
"kid": "string",
"iss": "[email protected]",
"sub": "uuid",
"aud": "string",
(optional) "privateKey": "private key when generated by the SA service"
}
}
```
1. In the Portal, go to the `Service Accounts` tab, choose a `Service Account` and go to `Service Account Keys` to create a key.

- You can create your own RSA key-pair or have the Portal generate one for you.

**Disclaimer:** as of now, creation of a service account key in the Portal is only available in DEV and QA environments. You can use this flow in these environments by setting the fields `token_custom_endpoint` and `jwks_custom_endpoint` to the corresponding endpoints in the provider block.

2. Save the content of the service account key and the corresponding private key by copying them or saving them in a file.

**Hint:** If you have generated the RSA key-pair using the Portal, you can save the private key in a PEM encoded file by downloading the service account key as a PEM file and using `openssl storeutl -keys <path/to/sa_key_pem_file> > private.key` to extract the private key from the service account key.

The expected format of the service account key is a **json** with the following structure:

```json
{
"id": "uuid",
"publicKey": "public key",
"createdAt": "2023-08-24T14:15:22Z",
"validUntil": "2023-08-24T14:15:22Z",
"keyType": "USER_MANAGED",
"keyOrigin": "USER_PROVIDED",
"keyAlgorithm": "RSA_2048",
"active": true,
"credentials": {
"kid": "string",
"iss": "[email protected]",
"sub": "uuid",
"aud": "string",
(optional) "privateKey": "private key when generated by the SA service"
}
}
```

3. Configure the service account key and private key for authentication in the SDK:
- setting the fiels in the provider block: `service_account_key` or `service_account_key_path`, `private_key` or `private_key_path`
- setting environment variables: `STACKIT_SERVICE_ACCOUNT_KEY_PATH` and `STACKIT_PRIVATE_KEY_PATH`
- setting them in the credentials file (see above)
- setting `STACKIT_SERVICE_ACCOUNT_KEY_PATH` and `STACKIT_PRIVATE_KEY_PATH` in the credentials file (see above)

### Token flow

Expand Down
41 changes: 41 additions & 0 deletions docs/resources/logme_credential.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "stackit_logme_credential Resource - stackit"
subcategory: ""
description: |-
LogMe credential resource schema.
---

# stackit_logme_credential (Resource)

LogMe credential resource schema.

## Example Usage

```terraform
resource "stackit_logme_credential" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
instance_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `instance_id` (String) ID of the LogMe instance.
- `project_id` (String) STACKIT Project ID to which the instance is associated.

### Read-Only

- `credentials_id` (String) The credentials ID.
- `host` (String)
- `hosts` (List of String)
- `http_api_uri` (String)
- `id` (String) Terraform's internal resource identifier. It is structured as "`project_id`,`instance_id`,`credentials_id`".
- `name` (String)
- `password` (String, Sensitive)
- `port` (Number)
- `uri` (String)
- `username` (String)
34 changes: 0 additions & 34 deletions docs/resources/logme_credentials.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "stackit_mariadb_credentials Resource - stackit"
page_title: "stackit_mariadb_credential Resource - stackit"
subcategory: ""
description: |-
MariaDB credentials resource schema.
MariaDB credential resource schema.
---

# stackit_mariadb_credentials (Resource)
# stackit_mariadb_credential (Resource)

MariaDB credentials resource schema.
MariaDB credential resource schema.

## Example Usage

```terraform
resource "stackit_mariadb_credentials" "example" {
resource "stackit_mariadb_credential" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
instance_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "stackit_opensearch_credentials Resource - stackit"
page_title: "stackit_opensearch_credential Resource - stackit"
subcategory: ""
description: |-
OpenSearch credentials resource schema.
OpenSearch credential resource schema.
---

# stackit_opensearch_credentials (Resource)
# stackit_opensearch_credential (Resource)

OpenSearch credentials resource schema.
OpenSearch credential resource schema.

## Example Usage

```terraform
resource "stackit_opensearch_credentials" "example" {
resource "stackit_opensearch_credential" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
instance_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
Expand Down
Loading