Skip to content

Commit

Permalink
Restore cloud_integration
Browse files Browse the repository at this point in the history
  • Loading branch information
addyess committed Feb 20, 2025
1 parent d6d4f78 commit 8021f52
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 34 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/plan-terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ jobs:
test:
- name: Openstack
yaml: test/openstack.yaml
cloud_integration: "true"
cloud_integration: openstaack
- name: Vanilla
yaml: test/vanilla.yaml
cloud_integration: "false"
cloud_integration: ''
env:
TF_VAR_model: '{"name": "test", "cloud": "openstack", "config": {"test": true}}'
TF_VAR_model: '{"name": "test", "cloud": "prod-k8s-openstack", "config": {"test": true}}'
TF_VAR_manifest_yaml: ${{ matrix.test.yaml }}
TF_VAR_cloud_integration: ${{ matrix.test.cloud_integration }}
WORKING_DIR: 'terraform'
Expand Down
19 changes: 10 additions & 9 deletions terraform/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ module "k8s" {
source = "git::https://github.com/canonical/k8s-bundles//terraform?ref=main"
model = {
name = "my-canonical-k8s"
cloud = "openstack"
cloud = "prod-example-openstack"
}
cloud_integration = "openstack"
manifest_yaml = "/path/to/manifest.yaml"
}
```
Expand All @@ -58,15 +59,15 @@ Define your manifest.yaml based on the requirements for your deployment. Specifi

```yaml
k8s:
units: 3
base: [email protected]
constraints: arch=amd64 cores=2 mem=4096M root-disk=16384M
channel: 1.32/stable
units: 3
base: [email protected]
constraints: arch=amd64 cores=2 mem=4096M root-disk=16384M
channel: 1.32/stable
k8s_worker:
units: 2
base: [email protected]
constraints: arch=amd64 cores=2 mem=8192M root-disk=16384M
channel: 1.32/stable
units: 2
base: [email protected]
constraints: arch=amd64 cores=2 mem=8192M root-disk=16384M
channel: 1.32/stable
```
<!--LINKS -->
Expand Down
2 changes: 1 addition & 1 deletion terraform/applications.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module "k8s_worker" {
}

module "openstack" {
count = (var.model.cloud == "openstack" && var.cloud_integration) ? 1 : 0
count = (var.cloud_integration == "openstack" ) ? 1 : 0
source = "./openstack"
model = resource.juju_model.this.name
manifest_yaml = var.manifest_yaml
Expand Down
20 changes: 10 additions & 10 deletions terraform/test/openstack.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
k8s:
units: 3
base: [email protected]
constraints: arch=amd64 cores=2 mem=8G root-disk=16G
channel: latest/edge
units: 3
base: [email protected]
constraints: arch=amd64 cores=2 mem=8192M root-disk=16384M
channel: latest/edge
k8s_worker:
units: 3
base: [email protected]
constraints: arch=amd64 cores=2 mem=8G root-disk=16G
channel: latest/edge
units: 3
base: [email protected]
constraints: arch=amd64 cores=2 mem=8192M root-disk=16384M
channel: latest/edge
openstack_integrator:
channel: 1.31/stable
base: [email protected]
channel: 1.31/stable
base: [email protected]
cinder_csi: {}
openstack_cloud_controller: {}
16 changes: 8 additions & 8 deletions terraform/test/vanilla.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
k8s:
units: 3
base: [email protected]
constraints: arch=amd64 cores=2 mem=8192M root-disk=16384M
channel: latest/edge
units: 3
base: [email protected]
constraints: arch=amd64 cores=2 mem=8192M root-disk=16384M
channel: latest/edge
k8s_worker:
units: 3
base: [email protected]
constraints: arch=amd64 cores=2 mem=8192M root-disk=16384M
channel: latest/edge
units: 3
base: [email protected]
constraints: arch=amd64 cores=2 mem=8192M root-disk=16384M
channel: latest/edge
11 changes: 8 additions & 3 deletions terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@ variable "manifest_yaml" {
}

variable "cloud_integration" {
description = "Enable cloud integration."
type = bool
default = false
description = "Selection of a cloud integration."
type = string
default = ""

validation {
condition = can(regex("^(|openstack)$", var.cloud_integration))
error_message = "Cloud integration must be one of: '', openstack."
}
}

variable "model" {
Expand Down

0 comments on commit 8021f52

Please sign in to comment.