Skip to content

Commit b90fbea

Browse files
committed
chore: adding stackit to collie-hub
chore: adding stackit to collie-hub chore: adding stackit to collie-hub chore: adding stackit to collie-hub
1 parent 6181406 commit b90fbea

File tree

12 files changed

+597
-0
lines changed

12 files changed

+597
-0
lines changed

kit/stackit/bootstrap/README.md

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# STACKIT Cloud Custom Platform
2+
3+
## Overview
4+
This Terraform project enables seamless self-service provisioning and management of STACKIT Projects for development teams. The platform is based on the STACKIT Cloud and is designed to provide a secure and compliant environment for development teams to deploy and manage their applications.
5+
6+
## Documentation
7+
For more information, check our [Guide for STACKIT](/likvid-cloudfoundation/meshstack/guides/guide_stackit.html).
8+
9+
## Usage
10+
1. Initialize the Terraform configuration:
11+
```sh
12+
terraform init
13+
```
14+
2. Apply the Terraform configuration:
15+
```sh
16+
terraform apply
17+
```
18+
19+
## Requirements
20+
- Terraform 0.12 or later
21+
- STACKIT Cloud account
22+
23+
## Providers
24+
- `stackitcloud/stackit` version `0.37.1`
25+
- `hashicorp/null` version `3.2.2`
26+
27+
<!-- BEGIN_TF_DOCS -->
28+
## Requirements
29+
30+
| Name | Version |
31+
|------|---------|
32+
| <a name="requirement_null"></a> [null](#requirement\_null) | 3.2.2 |
33+
| <a name="requirement_stackit"></a> [stackit](#requirement\_stackit) | 0.37.1 |
34+
35+
## Modules
36+
37+
No modules.
38+
39+
## Resources
40+
41+
| Name | Type |
42+
|------|------|
43+
| [null_resource.platform_admin](https://registry.terraform.io/providers/hashicorp/null/3.2.2/docs/resources/resource) | resource |
44+
| [null_resource.platform_users](https://registry.terraform.io/providers/hashicorp/null/3.2.2/docs/resources/resource) | resource |
45+
46+
## Inputs
47+
48+
| Name | Description | Type | Default | Required |
49+
|------|-------------|------|---------|:--------:|
50+
| <a name="input_api_url"></a> [api\_url](#input\_api\_url) | Base API URL | `string` | `"https://authorization.api.stackit.cloud"` | no |
51+
| <a name="input_organization_id"></a> [organization\_id](#input\_organization\_id) | Organization ID of your stackit cloud account | `string` | n/a | yes |
52+
| <a name="input_platform_admins"></a> [platform\_admins](#input\_platform\_admins) | List of members to add with their roles and subjects | <pre>list(object({<br> role = string<br> subject = string<br> }))</pre> | n/a | yes |
53+
| <a name="input_platform_users"></a> [platform\_users](#input\_platform\_users) | List of members to add with their roles and subjects | <pre>list(object({<br> role = string<br> subject = string<br> }))</pre> | n/a | yes |
54+
| <a name="input_token"></a> [token](#input\_token) | Bearer token for authentication | `string` | n/a | yes |
55+
56+
## Outputs
57+
58+
| Name | Description |
59+
|------|-------------|
60+
| <a name="output_documentation_md"></a> [documentation\_md](#output\_documentation\_md) | n/a |
61+
<!-- END_TF_DOCS -->
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
output "documentation_md" {
2+
value = <<EOF
3+
4+
# STACKIT Cloud Custom Platform
5+
6+
## Self-Service Project Provioning
7+
8+
At Likvid Bank, the Platform Team enables seamless self-service provisioning and management of STACKIT Projects for development teams. The platform is based on the STACKIT Cloud and is designed to i
9+
provide a secure and compliant environment for development teams to deploy and manage their applications.
10+
11+
for more infos check our [Guide for STACKIT ](/likvid-cloudfoundation/meshstack/guides/guide_stackit.html)
12+
13+
EOF
14+
}

kit/stackit/bootstrap/main.tf

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
resource "null_resource" "platform_admin" {
2+
3+
# Trigger creation and destruction of resources based on the lifecycle
4+
triggers = {
5+
members = jsonencode(var.platform_admins)
6+
url = var.api_url
7+
token = var.token
8+
organization_id = var.organization_id
9+
}
10+
11+
# Provisioner for the 'create' action
12+
provisioner "local-exec" {
13+
when = create
14+
command = <<EOT
15+
curl -X PATCH "${self.triggers.url}/v2/${self.triggers.organization_id}/members" \
16+
-H "Authorization: Bearer ${self.triggers.token}" \
17+
-H "Content-Type: application/json" \
18+
-d '{
19+
"members": ${self.triggers.members},
20+
"resourceType": "organization"
21+
}'
22+
EOT
23+
}
24+
# Provisioner for the 'destroy' action
25+
provisioner "local-exec" {
26+
when = destroy
27+
command = <<EOT
28+
curl -X POST "${self.triggers.url}/v2/${self.triggers.organization_id}/members/remove" \
29+
-H "Authorization: Bearer ${self.triggers.token}" \
30+
-H "Content-Type: application/json" \
31+
-d '{
32+
"forceRemove": true,
33+
"members": ${self.triggers.members},
34+
"resourceType": "organization"
35+
}'
36+
EOT
37+
}
38+
}
39+
40+
resource "null_resource" "platform_users" {
41+
# Trigger creation and destruction of resources based on the lifecycle
42+
triggers = {
43+
members = jsonencode(var.platform_users)
44+
url = var.api_url
45+
token = var.token
46+
organization_id = var.organization_id
47+
}
48+
49+
# Provisioner for the 'create' action
50+
provisioner "local-exec" {
51+
when = create
52+
command = <<EOT
53+
curl -X PATCH "${self.triggers.url}/v2/${self.triggers.organization_id}/members" \
54+
-H "Authorization: Bearer ${self.triggers.token}" \
55+
-H "Content-Type: application/json" \
56+
-d '{
57+
"members": ${self.triggers.members},
58+
"resourceType": "organization"
59+
}'
60+
EOT
61+
}
62+
# Provisioner for the 'destroy' action
63+
provisioner "local-exec" {
64+
when = destroy
65+
command = <<EOT
66+
curl -X POST "${self.triggers.url}/v2/${self.triggers.organization_id}/members/remove" \
67+
-H "Authorization: Bearer ${self.triggers.token}" \
68+
-H "Content-Type: application/json" \
69+
-d '{
70+
"forceRemove": true,
71+
"members": ${self.triggers.members},
72+
"resourceType": "organization"
73+
}'
74+
EOT
75+
}
76+
}

kit/stackit/bootstrap/outputs.tf

Whitespace-only changes.

kit/stackit/bootstrap/variables.tf

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
variable "platform_admins" {
2+
description = "List of members to add with their roles and subjects"
3+
type = list(object({
4+
role = string
5+
subject = string
6+
}))
7+
}
8+
9+
variable "platform_users" {
10+
description = "List of members to add with their roles and subjects"
11+
type = list(object({
12+
role = string
13+
subject = string
14+
}))
15+
}
16+
17+
variable "token" {
18+
description = "Bearer token for authentication"
19+
type = string
20+
sensitive = true
21+
}
22+
23+
variable "api_url" {
24+
description = "Base API URL"
25+
type = string
26+
default = "https://authorization.api.stackit.cloud"
27+
}
28+
29+
variable "organization_id" {
30+
description = "Organization ID of your stackit cloud account"
31+
type = string
32+
}

kit/stackit/bootstrap/versions.tf

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
terraform {
2+
required_providers {
3+
stackit = {
4+
source = "stackitcloud/stackit"
5+
version = "0.37.1"
6+
}
7+
null = {
8+
source = "hashicorp/null"
9+
version = "3.2.2"
10+
}
11+
}
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Terraform OVH Project
2+
3+
This Terraform project is used to manage resources in the Stackit cloud platform. It provisions projects, manages users, and configures necessary providers.
4+
5+
## Prerequisites
6+
7+
- Terraform v1.0.0 or later
8+
- AWS credentials configured for the backend
9+
- Stackit service account token
10+
11+
## Providers
12+
13+
This project uses the following providers:
14+
15+
- `stackit`: Manages resources in the Stackit cloud platform.
16+
- `aws`: Manages resources in AWS.
17+
- `null`: Provides null resources for triggering local-exec provisioners.
18+
19+
## Usage
20+
21+
1. Clone the repository.
22+
2. Initialize Terraform:
23+
```sh
24+
terraform init
25+
```
26+
3. Apply the Terraform configuration:
27+
```sh
28+
terraform apply
29+
```
30+
<!-- BEGIN_TF_DOCS -->
31+
## Requirements
32+
33+
| Name | Version |
34+
|------|---------|
35+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | 5.65.0 |
36+
| <a name="requirement_null"></a> [null](#requirement\_null) | 3.2.2 |
37+
| <a name="requirement_stackit"></a> [stackit](#requirement\_stackit) | 0.37.1 |
38+
39+
## Modules
40+
41+
No modules.
42+
43+
## Resources
44+
45+
| Name | Type |
46+
|------|------|
47+
| [null_resource.create_user](https://registry.terraform.io/providers/hashicorp/null/3.2.2/docs/resources/resource) | resource |
48+
| [null_resource.project_admin](https://registry.terraform.io/providers/hashicorp/null/3.2.2/docs/resources/resource) | resource |
49+
| [null_resource.project_editor](https://registry.terraform.io/providers/hashicorp/null/3.2.2/docs/resources/resource) | resource |
50+
| [null_resource.project_reader](https://registry.terraform.io/providers/hashicorp/null/3.2.2/docs/resources/resource) | resource |
51+
| [stackit_resourcemanager_project.projects](https://registry.terraform.io/providers/stackitcloud/stackit/0.37.1/docs/resources/resourcemanager_project) | resource |
52+
53+
## Inputs
54+
55+
| Name | Description | Type | Default | Required |
56+
|------|-------------|------|---------|:--------:|
57+
| <a name="input_api_url"></a> [api\_url](#input\_api\_url) | Base API URL | `string` | `"https://authorization.api.stackit.cloud"` | no |
58+
| <a name="input_aws_account_id"></a> [aws\_account\_id](#input\_aws\_account\_id) | this is for the tfstates Backend. in our case AWS. | `string` | n/a | yes |
59+
| <a name="input_organization_id"></a> [organization\_id](#input\_organization\_id) | id of the organization | `string` | n/a | yes |
60+
| <a name="input_parent_container_id"></a> [parent\_container\_id](#input\_parent\_container\_id) | The stackit Cloud parent container id for the project | `string` | n/a | yes |
61+
| <a name="input_project_id"></a> [project\_id](#input\_project\_id) | Projects last block in name | `string` | n/a | yes |
62+
| <a name="input_token"></a> [token](#input\_token) | Bearer token for authentication | `string` | n/a | yes |
63+
| <a name="input_users"></a> [users](#input\_users) | Users and their roles provided by meshStack (Note that users must exist in stackit) | <pre>list(object(<br> {<br> meshIdentifier = string<br> username = string<br> firstName = string<br> lastName = string<br> email = string<br> euid = string<br> roles = list(string)<br> }<br> ))</pre> | n/a | yes |
64+
| <a name="input_workspace_id"></a> [workspace\_id](#input\_workspace\_id) | Projects first block in name | `string` | n/a | yes |
65+
66+
## Outputs
67+
68+
| Name | Description |
69+
|------|-------------|
70+
| <a name="output_stackit_login_link"></a> [stackit\_login\_link](#output\_stackit\_login\_link) | n/a |
71+
| <a name="output_tenant_id"></a> [tenant\_id](#output\_tenant\_id) | n/a |
72+
<!-- END_TF_DOCS -->

0 commit comments

Comments
 (0)