Skip to content

Conversation

LijieZhang1998
Copy link
Collaborator

Description

This ticket added one authentication mechanism to the Kafka connection.

Link to any related issue(s): https://jira.mongodb.org/browse/CLOUDP-338207

Type of change:

  • Bug fix (non-breaking change which fixes an issue). Please, add the "bug" label to the PR.
  • New feature (non-breaking change which adds functionality). Please, add the "enhancement" label to the PR. A migration guide must be created or updated if the new feature will go in a major version.
  • Breaking change (fix or feature that would cause existing functionality to not work as expected). Please, add the "breaking change" label to the PR. A migration guide must be created or updated.
  • This change requires a documentation update
  • Documentation fix/enhancement

Required Checklist:

  • I have signed the MongoDB CLA
  • I have read the contributing guides
  • I have checked that this change does not generate any credentials and that they are NOT accidentally logged anywhere.
  • I have added tests that prove my fix is effective or that my feature works per HashiCorp requirements
  • I have added any necessary documentation (if appropriate)
  • I have run make fmt and formatted my code
  • If changes include deprecations or removals I have added appropriate changelog entries.
  • If changes include removal or addition of 3rd party GitHub actions, I updated our internal document. Reach out to the APIx Integration slack channel to get access to the internal document.

Further comments

@LijieZhang1998 LijieZhang1998 changed the title feat: support OIDC configs in mongodbatlas_stream_connection feat: Support OIDC configs in mongodbatlas_stream_connection Sep 10, 2025
@LijieZhang1998 LijieZhang1998 marked this pull request as ready for review September 10, 2025 17:35
@LijieZhang1998 LijieZhang1998 requested review from a team as code owners September 10, 2025 17:35
Copy link
Contributor

APIx bot: a message has been sent to Docs Slack channel

* `username` - Username of the account to connect to the Kafka cluster.
* `password` - Password of the account to connect to the Kafka cluster.
* `token_endpoint_url` - OAUTH issuer token endpoint HTTP(S) URI used to retrieve the token.
* `client_id` - Public identifier for the kafka client. It must be unique across all clients that the authorization server handles.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* `client_id` - Public identifier for the kafka client. It must be unique across all clients that the authorization server handles.
* `client_id` - Public identifier for the Kafka client. It must be unique across all clients that the authorization server handles.

what is the consequence of this not being unique? Guessing a token wouldn't be issued, but it's not clear why this must be unique.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The uniqueness is applied to the authorization server(IdP provider). If I remove the second sentence, does it make sense to you?

* `client_secret` - Secret known only to the kafka client and the authorization server.
* `scope` - Kafka clients use this to specify the scope of the access request to the broker.
* `sasl_oauthbearer_extensions` - Additional information to be provided to the kafka broker.
* `https_ca_pem` - The CA certificates as a PEM string.
Copy link
Collaborator

@jwilliams-mongo jwilliams-mongo Sep 10, 2025

Choose a reason for hiding this comment

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

do you think it would be helpful to note these should be concatenated? Any specific certs in the chain that are not required? is a specific order required?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

What do you mean by "be concatenated"? No specific order is required. We don't want to mark optional on the fields because the OpenID protocol is very flexible. We can't guarantee whether field is a must or not. For backward compatibility, we don't indicate whether it is mandatory or not.

* `username` - Username of the account to connect to the Kafka cluster.
* `password` - Password of the account to connect to the Kafka cluster.
* `token_endpoint_url` - OAUTH issuer token endpoint HTTP(S) URI used to retrieve the token.
Copy link
Collaborator

Choose a reason for hiding this comment

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

do you think it would help to clarify that this is usually an IdP

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Is this ok?

Suggested change
* `token_endpoint_url` - OAUTH issuer token endpoint HTTP(S) URI used to retrieve the token.
* `token_endpoint_url` - OAUTH issuer(IdP provider) token endpoint HTTP(S) URI used to retrieve the token.

@lantoli
Copy link
Member

lantoli commented Sep 12, 2025

as discussed offline please don't merge until 2.0.0 is released

@@ -0,0 +1,3 @@
```release-note:enhancement
resource/mongodbatlas_stream_connection: Add new authentication mechanism(OIDC) to the Kafka connection
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
resource/mongodbatlas_stream_connection: Add new authentication mechanism(OIDC) to the Kafka connection
resource/mongodbatlas_stream_connection: Adds new authentication mechanism(OIDC) to the Kafka connection

3rd person for changelog messages

@@ -0,0 +1,3 @@
```release-note:enhancement
Copy link
Member

Choose a reason for hiding this comment

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

changelog entries for the 2 datasources are missing

* `username` - Username of the account to connect to the Kafka cluster.
* `password` - Password of the account to connect to the Kafka cluster.
* `token_endpoint_url` - OAUTH issuer(IdP provider) token endpoint HTTP(S) URI used to retrieve the token.
* `client_id` - Public identifier for the Kafka client.
Copy link
Member

Choose a reason for hiding this comment

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

do all new attributes apply to Kafka? in that case consider having them inside a kafka_config nested attribute, although it's probably better to follow as it's in the Atlas API

@@ -55,6 +55,38 @@ resource "mongodbatlas_stream_connection" "test" {
}
```

### Example Kafka SASL OAuthbearer Connection
Copy link
Member

@lantoli lantoli Sep 12, 2025

Choose a reason for hiding this comment

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

new attributes description is missing in resource doc page

Optional: true,
Sensitive: true,
},
"scope": schema.StringAttribute{
Copy link
Member

Choose a reason for hiding this comment

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

q: does Atlas return some default value if not provided by the client? in that case the atribute might need to be Optional & Computed, although better to keep it as Optional if possible

resource.ParallelTest(t, *testCase)
}

func testCaseKafkaOAuthBearer(t *testing.T, nameSuffix string) *resource.TestCase {
Copy link
Member

@lantoli lantoli Sep 12, 2025

Choose a reason for hiding this comment

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

why not inline testCaseKafkaOAuthBearer in TestAccStreamRSStreamConnection_kafkaOAuthBearer ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants