Skip to content

feat: return team members and slack channels in team data source #53

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

c4po
Copy link

@c4po c4po commented Jun 27, 2025

Summary

This pull request enhances the Terraform Cortex provider by improving the team data source to return both team members and Slack channels.
It also addresses a compatibility issue with the Terraform Plugin Framework by ensuring all struct fields used for schema mapping have the required tfsdk struct tags.

Changes

  • Feature:
    • The team data source now returns detailed information about team members and Slack channels, making it easier for users to access and utilize this data in their Terraform configurations.
  • Bugfix / Compatibility:
    • Added tfsdk struct tags to the TeamSlackChannel struct fields in internal/cortex/teams.go to resolve errors related to missing struct tags required by the Terraform Plugin Framework.

Motivation

#52

Testing

Verified that the team data source now returns both team members and Slack channels as expected.

provider "cortex" {
  token = "..."
}

data "cortex_team" "team" {
  tag = "..."
}

output "team" {
  value = data.cortex_team.squad
}
Changes to Outputs:
  + team = {
      + id             = "..."
      + members        = [
          + {
              + description = "..."
              + email       = "..."
              + name        = "..."
            },
...
        ]
      + slack_channels = [
          + {
              + name                  = "..."
              + notifications_enabled = true
            },
          + {
              + name                  = "..."
              + notifications_enabled = false
            },
        ]
      + tag            = "..."
    }

Copy link

@stpierre stpierre left a comment

Choose a reason for hiding this comment

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

Couple of small things. Please be sure to add tests as appropriate.

data.SlackChannels = teamResponse.SlackChannels
} else {
data.SlackChannels = nil
}

Choose a reason for hiding this comment

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

Are these if blocks strictly necessary? At a glance it looks like this would be equivalent to:

data.Members = teamResponse.CortexTeam.Members
data.SlackChannels = teamResponse.SlackChannels

@stpierre stpierre added the enhancement New feature or request label Jun 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants