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: migrate users data source to tf framework #795

Merged
merged 8 commits into from
Oct 9, 2024
Merged

Conversation

N-lson
Copy link
Contributor

@N-lson N-lson commented Oct 8, 2024

TF Config

data "octopusdeploy_users" "example" {
}

output "users" {
  value = data.octopusdeploy_users.example
}

Pre-migration

users = {
  "filter" = tostring(null)
  "id" = "Users 2024-10-09 00:33:05.6752504 +0000 UTC"
  "ids" = tolist(null) /* of string */
  "skip" = tonumber(null)
  "space_id" = tostring(null)
  "take" = tonumber(null)
  "users" = tolist([
    {
      "can_password_be_edited" = true
      "display_name" = "admin"
      "email_address" = ""
      "id" = "Users-1"
      "identity" = toset([])
      "is_active" = true
      "is_requestor" = false
      "is_service" = false
      "password" = ""
      "username" = "admin"
    },
    {
      "can_password_be_edited" = true
      "display_name" = "Bob Smith"
      "email_address" = ""
      "id" = "Users-83"
      "identity" = toset([])
      "is_active" = true
      "is_requestor" = false
      "is_service" = false
      "password" = ""
      "username" = "bsmith"
    },
    {
      "can_password_be_edited" = true
      "display_name" = "No permissions user"
      "email_address" = ""
      "id" = "Users-21"
      "identity" = toset([])
      "is_active" = true
      "is_requestor" = false
      "is_service" = false
      "password" = ""
      "username" = "noPerms"
    },
    {
      "can_password_be_edited" = true
      "display_name" = "testuser"
      "email_address" = ""
      "id" = "Users-61"
      "identity" = toset([])
      "is_active" = true
      "is_requestor" = false
      "is_service" = false
      "password" = ""
      "username" = "testuser"
    },
  ])
}

Post-migration

users = {
  "filter" = tostring(null)
  "id" = "Users 2024-10-09 00:34:05.4305356 +0000 UTC"
  "ids" = tolist(null) /* of string */
  "skip" = tonumber(null)
  "space_id" = tostring(null)
  "take" = tonumber(null)
  "users" = tolist([
    {
      "can_password_be_edited" = true
      "display_name" = "admin"
      "email_address" = ""
      "id" = "Users-1"
      "identity" = toset([])
      "is_active" = true
      "is_requestor" = true
      "is_service" = false
      "username" = "admin"
    },
    {
      "can_password_be_edited" = true
      "display_name" = "Bob Smith"
      "email_address" = ""
      "id" = "Users-83"
      "identity" = toset([])
      "is_active" = true
      "is_requestor" = false
      "is_service" = false
      "username" = "bsmith"
    },
    {
      "can_password_be_edited" = true
      "display_name" = "No permissions user"
      "email_address" = ""
      "id" = "Users-21"
      "identity" = toset([])
      "is_active" = true
      "is_requestor" = false
      "is_service" = false
      "username" = "noPerms"
    },
    {
      "can_password_be_edited" = true
      "display_name" = "testuser"
      "email_address" = ""
      "id" = "Users-61"
      "identity" = toset([])
      "is_active" = true
      "is_requestor" = false
      "is_service" = false
      "username" = "testuser"
    },
  ])
}

Changes

  • password has been removed. This was always an empty string before.
  • is_requestor now returns the correct value for the user running terraform apply.

- `ids` (List of String) A filter to search by a list of IDs.
- `skip` (Number) A filter to specify the number of items to skip in the response.
- `space_id` (String) A Space ID to filter by. Will revert what is specified on the provider if not set.
- `space_id` (String) The space ID associated with this user.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think space_id should be removed entirely since users aren't space-scoped but I've left it in for backwards compatibility.

Copy link
Contributor

Choose a reason for hiding this comment

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

hmm, good point. Lets mark it as deprecated.

Copy link
Contributor

@domenicsim1 domenicsim1 left a comment

Choose a reason for hiding this comment

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

This looks good, let mark the space_id as deprecated as it does nothing and we will remove it in 1.0 release.

- `ids` (List of String) A filter to search by a list of IDs.
- `skip` (Number) A filter to specify the number of items to skip in the response.
- `space_id` (String) A Space ID to filter by. Will revert what is specified on the provider if not set.
- `space_id` (String) The space ID associated with this user.
Copy link
Contributor

Choose a reason for hiding this comment

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

hmm, good point. Lets mark it as deprecated.

@N-lson N-lson merged commit 6c31839 into main Oct 9, 2024
22 checks passed
@N-lson N-lson deleted the nelson/users branch October 9, 2024 22:01
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