-
Notifications
You must be signed in to change notification settings - Fork 208
feat: Add workspace_name field in stream_connection resource and datasource #3610
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
base: master
Are you sure you want to change the base?
Conversation
6777bf6
to
4530ef5
Compare
APIx bot: a message has been sent to Docs Slack channel |
86df792
to
096bc32
Compare
internal/service/streamconnection/data_source_stream_connection.go
Outdated
Show resolved
Hide resolved
resp.Schema = conversion.DataSourceSchemaFromResource(ResourceSchema(ctx), &conversion.DataSourceSchemaRequest{ | ||
RequiredFields: []string{"project_id", "instance_name", "connection_name"}, | ||
RequiredFields: []string{"project_id", "connection_name"}, | ||
OverridenFields: map[string]dsschema.Attribute{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do we mean here with overridden?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was unnecessary. I removed it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually looks like we still need this so that terraform can use the workspace_name field in place of the instance name field. Without this we get errors due to terraform thinking that the datasource is being modified due to the mapping of the instance_name and workspace_name fields
connV2 := d.Client.AtlasV2 | ||
projectID := streamConnectionConfig.ProjectID.ValueString() | ||
instanceName := streamConnectionConfig.InstanceName.ValueString() | ||
effectiveWorkspaceName := getEffectiveWorkspaceName(&streamConnectionConfig) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will this now fail if they pass instanceSize only?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The check below will error if workspace_name and instance_name are both undefined. If both are defined, then there will also be an error in NewTFStreamConnectionWithInstanceName
So one of workspace_name and instance_name is essentially required
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah ok, so for whoever continues to use instance_name
there will be no impact, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, that's correct!
"workspace_name": schema.StringAttribute{ | ||
Optional: true, | ||
PlanModifiers: []planmodifier.String{ | ||
stringplanmodifier.RequiresReplace(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this means that if user changes workspace_name, Delete and Create will be called instead of Update.
qq: is this the behavior we want? there are 3 main alternatives:
- Destroy and create a new resource (current approach)
- Handle workspace_name changes in Update
- Raise an error that workspace_name can't be updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Double checked and discussed with our team. This is intentional behavior. The same happens with the equivalent instance_name attribute today
internal/service/streamconnection/resource_stream_connection_test.go
Outdated
Show resolved
Hide resolved
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Description
JIRA: CLOUDP-339895, following the plan discussed with APIx team in CLOUDP-336156
As part of an ongoing effort to rename stream instances to stream workspaces, we will support a
workspace_name
field for thestream_connection
resource and datasource that will function identically to 1instance_name`. To avoid confusion, only one of instance_name or workspace name will be allowed to be setIn a future major version of terraform, we will remove the instance_name field
Link to any related issue(s):
Type of change:
Required Checklist:
Further comments