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

add JAAS cloud access resource #581

Merged

Conversation

kian99
Copy link
Contributor

@kian99 kian99 commented Sep 19, 2024

Description

This PR adds a new resource juju_jaas_access_cloud building on top of the generic access structure. Note that in Juju clouds are a bit unique compared to models. Whereas model have a unique UUID, clouds do not and are unique based on the cloud name. Remaining resources for jaas_access include app-offers, controller, group, service-account. They will all follow the same structure and tests.

The full list of changes include:

  • Add new juju_jaas_access_cloud resource and tests.
  • Rename genericJAASAccessModel to genericJAASAccessData to avoid overloading the word model.
  • Remove AtLeastOneOf validator to allow users to remove all direct access to a resource.
  • Add test helper functions.
  • Add jaas model access test that includes a user, group and service account.

Partially resolves: CSS-10638

Type of change

  • Add new resource
  • Change in tests (one or several tests have been changed)

- Rename genericJAASAccessModel to genericJAASAccessData to avoid overloading the word model
- Remove AtLeastOneOf validator to allow users to remove all direct access to a resource.
- Add test helper functions
- Add model access test that includes a user, group and service account.
@kian99 kian99 changed the title CSS-10638 remaining jaas resources CSS-10638 jaas cloud access resource Sep 19, 2024
@kian99 kian99 requested a review from hmlanigan September 19, 2024 13:56
@kian99 kian99 changed the title CSS-10638 jaas cloud access resource add JAAS cloud access resource Sep 19, 2024
internal/provider/resource_access_jaas_cloud.go Outdated Show resolved Hide resolved
Comment on lines 87 to 91
resourcevalidator.AtLeastOneOf(
path.MatchRoot("users"),
path.MatchRoot("groups"),
path.MatchRoot("service_accounts"),
),
Copy link
Member

Choose a reason for hiding this comment

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

question:

Remove AtLeastOneOf validator to allow users to remove all direct access to a resource.

Why leave a resource with no content essentially? Wouldn't the resource just be deleted from the plan? Essentially, why would someone bother?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes good point, I had a silly moment thinking it would be good to give the user the ability to remove all access but as you said, that's the same as deleting the resource. I've reverted this and fixed the test.

@kian99 kian99 force-pushed the CSS-10638-remaining-jaas-resources branch from 69fe8ed to 2522110 Compare September 20, 2024 07:20
@kian99 kian99 requested a review from hmlanigan September 20, 2024 09:10
@kian99 kian99 force-pushed the CSS-10638-remaining-jaas-resources branch from 2522110 to 04b134e Compare September 20, 2024 09:26
Copy link
Member

@hmlanigan hmlanigan left a comment

Choose a reason for hiding this comment

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

LGTM

@hmlanigan
Copy link
Member

/merge

@jujubot jujubot merged commit d49c2e4 into juju:jaas-resources Sep 20, 2024
29 of 30 checks passed
jujubot added a commit that referenced this pull request Sep 24, 2024
#584

## Description

This PR adds a new resource `juju_jaas_access_offer` building on top of the generic access structure. 

Note that there is a minor issue with Juju application offer tags. In the Juju names/v4 package, an `applicationoffer` tag was based on an offer URL. In the names/v5 package this changed to an offer UUID. JAAS accepts both but currently the provider does not store the offer UUID (proposed change in #583). Until then I've opted to use the Juju names/v4 package to construct application offers based on an offer URL.

This PR is based on top of #581. See the last commit for the changes.

Partially resolves: [CSS-10638](https://warthogs.atlassian.net/browse/CSS-10638)

## Type of change

- Add new resource

[CSS-10638]: https://warthogs.atlassian.net/browse/CSS-10638?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
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.

3 participants