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 team and teams data source #88

Merged
merged 28 commits into from
Jun 7, 2024
Merged

Conversation

ichung08
Copy link
Collaborator

@ichung08 ichung08 commented Jun 6, 2024

Description

  • Add team and teams data source to terraform provider astro.
  • Added a new custom func to check if an attribute exists (even if the value is ""

🎟 Issue(s)

#67

🧪 Functional Testing

  • added new acceptance tests

Can get a team and output its value:
Screenshot 2024-06-06 at 3 24 44 PM

Can get all teams and output their values:
Screenshot 2024-06-07 at 7 34 43 AM

📸 Screenshots

📋 Checklist

  • Rebased from the main (or release if patching) branch (before testing)
  • Added/updated applicable tests
  • Added/updated examples in the examples/ directory
  • Tested against Astro-API
  • Communicated to/tagged owners of respective clients potentially impacted by these changes.
  • Updated any related documentation

@ichung08 ichung08 self-assigned this Jun 6, 2024
@ichung08 ichung08 linked an issue Jun 6, 2024 that may be closed by this pull request
1 task
@ichung08 ichung08 marked this pull request as ready for review June 7, 2024 15:02
@ichung08 ichung08 requested review from sunkickr and a team as code owners June 7, 2024 15:02
@@ -90,6 +90,7 @@ jobs:
ASTRO_API_HOST: https://api.astronomer-dev.io
SKIP_CLUSTER_RESOURCE_TESTS: ${{ env.SKIP_CLUSTER_RESOURCE_TESTS }}
HOSTED_TEAM_ID: clwbclrc100bl01ozjj5s4jmq
TF_HOSTED_TEAM_ID: clx44rvzr01nc01o06pze6qb7
Copy link
Collaborator

@vandyliu vandyliu Jun 7, 2024

Choose a reason for hiding this comment

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

can we use the same team_id as the one above instead of adding a new env var in the meantime (before we convert to terraform-only orgs)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

i can remove these env vars for now - i'm still using the hosted team id ones

@@ -105,3 +106,93 @@ func GetDataSourcesLength(state *terraform.State, tfVarName, dataSourceName stri

return instanceState, numAttribute, nil
}

func TestCheckResourceAttrExists(name, key string, isOptional bool) resource.TestCheckFunc {
Copy link
Collaborator

Choose a reason for hiding this comment

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

let's remove these functions since it doesn't offer too much
if an optional value is set or not set shouldn't be a huge test case for us
furthermore the code seems rather unmaintainable for us and i prefer not to have too many internal detail code in our repo
i do appreciate the level of effort though to get something like this working so kudos!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

sounds good!

)

func TestAcc_DataSourceTeam(t *testing.T) {
teamId := os.Getenv("HOSTED_TEAM_ID")
Copy link
Collaborator

Choose a reason for hiding this comment

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

once we add team resource we should create a team using it instead of an existing team

ichung08 and others added 4 commits June 7, 2024 15:57
Co-authored-by: Vandy Liu <33995460+vandyliu@users.noreply.github.com>
Co-authored-by: Vandy Liu <33995460+vandyliu@users.noreply.github.com>
…omer/astronomer-terraform-provider into 67-add-team-and-teams-data-source
@ichung08 ichung08 merged commit cfce3a8 into main Jun 7, 2024
7 checks passed
@ichung08 ichung08 deleted the 67-add-team-and-teams-data-source branch June 7, 2024 23:38
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.

Add team and teams data source
2 participants