-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
New Resource azurerm_app_configuration_replica
#21689
Conversation
} | ||
} | ||
|
||
func (r ReplicaResource) Create() sdk.ResourceFunc { |
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.
rather than being a separate resource, this likely should be embedded within the App Configuration resource as a replica
block, in the same way we've done for CosmosDB, since when making changes to the primary it can be necessary to make changes to the replicas too?
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 replica resource has its own API endpoint to create/delete, and it only rely on the resource ID of App Configuration resource, so I think it's better we create a new resource for this? If we put this inline, it might have issue when App Configuration is successfully created but the Replica fail.
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.
@teowa, it is a 1:1 mapping, so unless there is a reason it needs to be separate, ie permissions / policy need updating with the created resource id before replication, it should be within the parent resource. also, as tom mentioned it simplifies the situations when the primary/secondary needs to be updated before/after a change
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.
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.
If we make the replica
a inline block inside the azurerm_app_configuration, but in create/update if the replica fails to create but its parent resource is successfully created, we still need to write parent resource to state? if we don't write the parent resource into state, there will be tf.ImportAsExistsError
error. So how can we write partial state under current design(we call read function to write the state only if the whole create/update successfully)?
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.
in create/update if the replica fails to create but its parent resource is successfully created, we still need to write parent resource to state
we would fail creation then.
this is much like the cosmosdb resource with its replication locations property. As tom said this shouljd be part of the parent resource we should mimic the way cosmos db does it?
@@ -49,73 +49,6 @@ func (c Client) LinkWorkaroundDataPlaneClientWithEndpoint(configurationStoreEndp | |||
return &workaroundClient, nil | |||
} | |||
|
|||
func (c Client) DataPlaneClient(ctx context.Context, configurationStoreId string) (*appconfiguration.BaseClient, error) { |
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 is to remove unused code (superseded by
func (c Client) DataPlaneClientWithEndpoint(configurationStoreEndpoint string) (*appconfiguration.BaseClient, error) { |
Looking forward to have that merged and available in this' week release ! |
Met some issue when I try to provision 2 Replicas under 1 App Configuration, the error message is obscure:
Seems the SDK has some issue, still investigate this. The error message is related to #21870. |
} | ||
|
||
// concurrent creation of replicas under one configuration store will fail | ||
locks.ByName(id.ConfigurationStoreName, r.ResourceType()) |
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 API has limitation that we cannot create two replica under one Configuration Store at the same time, here a lock is added.
looking forward for this feature. thank you for your work on this. |
@katbyte anything missing for this to be merged ? |
I have submitted another PR to support the inline |
Closing in favour of #22452 |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
resolves #21634
references:
test: