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

feat(all): add base and constraints config options to charm tf modules #61

Conversation

NucciTheBoss
Copy link
Member

This PR adds the base and constraints configuration options to the Slurm charm tf modules. This way we can specify different bases, and request specific instance types through OpenTofu/Terraform. This PR also adds READMEs for each of the modules to document both inputs and outputs.

@NucciTheBoss NucciTheBoss requested a review from a team as a code owner January 14, 2025 18:54
@NucciTheBoss NucciTheBoss requested review from jedel1043 and dsloanm and removed request for a team January 14, 2025 18:54
Copy link
Contributor

@dsloanm dsloanm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good - the variable descriptions in particular are much improved.

One thing is I'm seeing an error at the end of deployments (the application appears to deploy successfully anyway):

$ tofu apply -var="model_name=charmed-hpc" -auto-approve
[...]
juju_application.sackd: Creating...
╷
│ Error: Provider produced inconsistent result after apply
│ 
│ When applying changes to juju_application.sackd, provider "provider[\"registry.opentofu.org/juju/juju\"]" produced an
│ unexpected new value: .constraints: was cty.StringVal(""), but now cty.StringVal("arch=amd64").
│ 
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.

which I don't get with current main:

$ tofu apply -auto-approve
[...]
juju_application.sackd: Creating...
juju_application.sackd: Creation complete after 2s [id=charmed-hpc:login-node]

Apply complete! Resources: 1 added, 0 changed, 0 destroyed.

Outputs:

app_name = "login-node"
provides = {
  "slurmctld" = "slurmctld"
}

Could just be my environment - have you seen the same?

It's consistent with tofu and terraform.

@NucciTheBoss
Copy link
Member Author

Hmm... I'll need to check. Not sure if that's something we can control through our Terraform plan. IIRC the provider will supply its own defaults if certain resource fields are left blank.

@NucciTheBoss
Copy link
Member Author

@dsloanm digging further into your issue, seems like we've accidentally stumbled upon this issue with the Terraform provider: juju/terraform-provider-juju#344.

TL;DR is that Juju automatically applies the constraint arch=amd64, but Terraform/Tofu throws an error because it doesn't know if the user actually intended for this to happen, and it doesn't fetch the user's data to determine if this is preferred or not.

Easiest fix here is to just change the default to arch=amd64 and then document once we support ARM64 that the user must pass arch=arm64 as a constraint to get the machine architecture they want.

Signed-off-by: Jason C. Nucciarone <nuccitheboss@ubuntu.com>
Signed-off-by: Jason C. Nucciarone <nuccitheboss@ubuntu.com>
Signed-off-by: Jason C. Nucciarone <nuccitheboss@ubuntu.com>
Signed-off-by: Jason C. Nucciarone <nuccitheboss@ubuntu.com>
Signed-off-by: Jason C. Nucciarone <nuccitheboss@ubuntu.com>
Signed-off-by: Jason C. Nucciarone <nuccitheboss@ubuntu.com>
Signed-off-by: Jason C. Nucciarone <nuccitheboss@ubuntu.com>
Signed-off-by: Jason C. Nucciarone <nuccitheboss@ubuntu.com>
Signed-off-by: Jason C. Nucciarone <nuccitheboss@ubuntu.com>
Signed-off-by: Jason C. Nucciarone <nuccitheboss@ubuntu.com>
Signed-off-by: Jason C. Nucciarone <nuccitheboss@ubuntu.com>
@NucciTheBoss NucciTheBoss force-pushed the nuccitheboss/refactor/update-tf-modules branch from 8f38317 to 2fd2cae Compare January 15, 2025 20:57
@NucciTheBoss NucciTheBoss requested a review from dsloanm January 15, 2025 20:57
@NucciTheBoss
Copy link
Member Author

@dsloanm should be resolved now 😎

Copy link
Contributor

@dsloanm dsloanm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, no issues with the apply now. LGTM!

@NucciTheBoss NucciTheBoss merged commit 8fd9d73 into charmed-hpc:main Jan 16, 2025
5 checks passed
@NucciTheBoss NucciTheBoss deleted the nuccitheboss/refactor/update-tf-modules branch January 27, 2025 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants