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

Missing spacelift_user data source #548

Open
HighwayofLife opened this issue May 7, 2024 · 0 comments
Open

Missing spacelift_user data source #548

HighwayofLife opened this issue May 7, 2024 · 0 comments

Comments

@HighwayofLife
Copy link

Description:

Currently, the Spacelift Terraform Provider lacks a spacelift_user data source, which would allow users to retrieve information about existing Spacelift users. Adding this data source would enable users to manage existing users/policy mapping more efficiently and avoid potential conflicts when importing them into Terraform management.

Use Case:

When managing Spacelift users with Terraform, it is common to have a mix of existing users and new users. In order to properly manage existing users, it is necessary to retrieve their information from Spacelift and use it in the Terraform configuration. Without a spacelift_user data source, users are forced to manually provide the necessary information with a custom python script to retrieve the users through the GraphQL API, which is error-prone and inefficient.

Proposed Solution:

Implement a new data source called spacelift_user in the Spacelift Terraform Provider. This data source should allow users to retrieve information about existing Spacelift users based on their username or email address.

Proposed Attributes:

  • username (String, Required): The username of the Spacelift user.
  • email (String, Optional): The email address associated with the Spacelift user.
  • id (String, Computed): The unique identifier of the Spacelift user.
  • policy (map..., Computed):
    • role (String, Computed): The role assigned to the Spacelift user.
    • space_id (String, Computed): The ID of the space the user belongs to.

Example Usage:

data "spacelift_user" "existing_user" {
  username = "[email protected]"
}

output "existing_user_id" {
  value = data.spacelift_user.existing_user.id
}

output "existing_user_policy" {
  value = data.spacelift_user.existing_user.policy
}

Benefits:

  • Simplifies the management of existing Spacelift users in Terraform.
  • Avoids potential conflicts and errors when importing existing users.
  • Enables users to retrieve accurate and up-to-date information about Spacelift users.
  • Improves the overall user experience and efficiency when managing Spacelift resources with Terraform.
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

No branches or pull requests

1 participant