terraform-aws-sagemaker
terraform-aws-sagemaker copied to clipboard
Failing to recreate SageMaker notebook instance
If a SageMaker notebook instance created with this module is tainted, it will fail to recreate.
Steps to reproduce
- Create a SageMaker notebook instance with this module. Specify a particular name with the
sagemaker_notebook_instance_name
variable. - Taint and attempt to create the notebook instance, for instance by using the command
terraform apply -replace='module.sagemaker.aws_sagemaker_notebook_instance.sagemaker_notebook_instance[0]'
Error messages
Error: creating SageMaker Notebook Instance: ValidationException: Cannot create a duplicate Notebook Instance (arn:aws:sagemaker:<region>:<account id>:notebook-instance/<notebook name>)
status code: 400, request id: <request id>
with module.sagemaker.aws_sagemaker_notebook_instance.sagemaker_notebook_instance[0],
on .terraform/modules/sagemaker/sagemaker_notebook_instance.tf line 4, in resource "aws_sagemaker_notebook_instance" "sagemaker_notebook_instance":
4: resource "aws_sagemaker_notebook_instance" "sagemaker_notebook_instance" {
Suggested fix
I believe this is due to this configuration. If the notebook were destroyed first, then recreated, this issue would be avoided.