-
Notifications
You must be signed in to change notification settings - Fork 14
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
Simplify the docs for installing via terraform #948
Open
addyess
wants to merge
2
commits into
main
Choose a base branch
from
KU-2416/simplify-terraform-install
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,22 +34,37 @@ and k8s-worker child modules: | |
Example `main.tf`: | ||
|
||
```hcl | ||
data "juju_model" "testing" { | ||
provider "juju" {} | ||
|
||
resource "juju_model" "my_model" { | ||
name = "juju-myk8s" | ||
} | ||
|
||
variable "k8s" { | ||
description = "K8s deployment shared configuration" | ||
channel = string | ||
default = "1.xx/stable" | ||
} | ||
|
||
module "k8s" { | ||
source = "path-to/k8s" | ||
juju_model = module.juju_model.testing.name | ||
source = "git::https://github.com/canonical/k8s-operator//charms/worker/k8s/terraform?ref=main" | ||
|
||
model = juju_model.my_model.name | ||
channel = var.k8s.channel | ||
units = 3 | ||
} | ||
|
||
module "k8s-worker" { | ||
source = "path-to/k8s-worker" | ||
juju_model = module.juju_model.testing.name | ||
source = "git::https://github.com/canonical/k8s-operator//charms/worker/terraform?ref=main" | ||
model = juju_model.my_model.name | ||
channel = var.k8s.channel | ||
units = 2 | ||
} | ||
``` | ||
|
||
```{note} | ||
Please ensure that the root module references the correct source path for the `k8s` and `k8s-worker` modules. | ||
Also, ensure you replace the k8s.channel with {{version}}/stable | ||
``` | ||
|
||
Example `versions.tf`: | ||
|
@@ -68,14 +83,8 @@ terraform { | |
|
||
### Charm modules | ||
|
||
Please download the charm modules from Github at: | ||
|
||
``` | ||
git clone https://github.com/canonical/k8s-operator.git | ||
``` | ||
|
||
Find the control-plane module at `k8s-operator/charms/worker/k8s/terraform` and | ||
the k8s-worker module at `k8s-operator/tree/main/charms/worker/terraform`. | ||
Find the `k8s` module at `//charms/worker/k8s/terraform` and | ||
the `k8s-worker` module at `//charms/worker/terraform`. | ||
|
||
The charm module for the k8s charm offers the following | ||
configuration options: | ||
|
@@ -84,7 +93,7 @@ configuration options: | |
| - | - | - | - | - | | ||
| `app_name`| string | Application name | False | k8s | | ||
| `base` | string | Ubuntu base to deploy the charm onto | False | [email protected] | | ||
| `channel`| string | Channel that the charm is deployed from | False | 1.30/edge | | ||
| `channel`| string | Channel that the charm is deployed from | False | null | | ||
| `config`| map(string) | Map of the charm configuration options | False | {} | | ||
| `constraints` | string | Juju constraints to apply for this application | False | arch=amd64 | | ||
| `model`| string | Name of the model that the charm is deployed on | True | null | | ||
|
@@ -97,7 +106,7 @@ Upon application, the module exports the following outputs: | |
| Name | Description | | ||
| - | - | | ||
| `app_name`| Application name | | ||
| `provides`| Map of `provides` endpoints | | ||
| `provides`| Map of `provides` endpoints | | ||
| `requires`| Map of `requires` endpoints | | ||
|
||
## Deploying the charms | ||
|
@@ -107,6 +116,7 @@ commands: | |
|
||
```bash | ||
terraform init | ||
terraform plan | ||
terraform apply | ||
``` | ||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't quite like this variable declaration here. First it should be in an input file and second this should be closer to where it is set >> sub-module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so, this
channel
likely should match bothk8s
andk8s-worker
. We can eliminate this from the example if you think that's a good idea and have folks go read the individual tf modules to learn what variables are optional.i was trying to use this variable as
var.k8s.channel
for both modules. Did i do this incorrectly?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
another thing, i wish i could use
{{channel}}
here