Skip to content

Conversation

albertodonato
Copy link
Contributor

@albertodonato albertodonato commented May 8, 2025

ENG-5061
ENG-5070

what

  • extract API queries related to account groups
  • refactor resource and data source code
  • fix resource import
  • improve format/lint just targets

why

making code more consistent

testing

unit tests and sandbox

docs

updated here

@albertodonato albertodonato changed the title ack/account group cleanup chore: rework account group resource and data source [ENG-5061] May 8, 2025
@albertodonato albertodonato force-pushed the ack/account-group-cleanup branch 2 times, most recently from 94df2ac to a3c00f9 Compare May 8, 2025 15:49
@albertodonato albertodonato marked this pull request as ready for review May 8, 2025 15:51
@albertodonato albertodonato requested a review from a team as a code owner May 8, 2025 15:51
@albertodonato albertodonato force-pushed the ack/account-group-cleanup branch 4 times, most recently from e68a983 to 27aa3c9 Compare May 9, 2025 11:00
Copy link
Contributor

@fwereade fwereade left a comment

Choose a reason for hiding this comment

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

LGTM, thanks, a few thoughts but nothing that should block progress

3. Build the provider:
```bash
go build -o terraform-provider-stacklet
just build
Copy link
Contributor

Choose a reason for hiding this comment

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

we might need an "install just" step :)

resource "stacklet_account_group" "production" {
name = "production-accounts"
cloud_provider = "aws"
description = "Production AWS accounts"
Copy link
Contributor

Choose a reason for hiding this comment

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

this one should definitely need regions

if uuid != "" {
variables["uuid"] = graphql.String(uuid)
}
if name != "" {
Copy link
Contributor

Choose a reason for hiding this comment

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

would this be the place to enforce? or is there somewhere earlier we can reject overspecified data sources?

(or do we want to get clever and always ask by uuid if it's present, and then check name matches? or, arguably, do we want to skip the identify-by-name bit, 'cos that's not a stable identifier and will probably cause more pain than just disallowing it would…)

}
variables := map[string]any{"uuid": graphql.String(uuid)}
if err := a.c.Mutate(ctx, &mutation, variables); err != nil {
return APIError{"Client error", err.Error()}
Copy link
Contributor

Choose a reason for hiding this comment

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

this is probably too minor to fret about rn, but – what about this is specifically a client error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is from what was there before, I guess "client" in the sense of API client

@albertodonato albertodonato force-pushed the ack/account-group-cleanup branch from 352d652 to b4e36fb Compare May 9, 2025 13:35
[ENG-5061](https://stacklet.atlassian.net/browse/ENG-5061)
[ENG-5070](https://stacklet.atlassian.net/browse/ENG-5070)

### what

- extract API queries related to account groups
- refactor resource and data source code
- fix resource import

### why

making code more consistent

### testing

unit tests and sandbox

### docs

updated here
@albertodonato albertodonato force-pushed the ack/account-group-cleanup branch from b4e36fb to cb3a84b Compare May 9, 2025 16:04
@albertodonato albertodonato merged commit 80f38fc into main May 9, 2025
4 checks passed
@albertodonato albertodonato deleted the ack/account-group-cleanup branch May 9, 2025 16:08
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