Terraform can't add github repo to Sagemaker space settings

123 views Asked by At

I'm trying to add a git repository to an AWS Sagemaker space, but on terraform apply I get the following error:

│ Error: updating SageMaker Space: ValidationException: Unknown parameter CodeRepositories in JupyterServerAppSettings for SpaceSettings.
│   status code: 400, request id: 492c767a-ad2b-4cd3-b0e8-d3b402d43a00
│ 
│   with module.sagemaker_studio_notebooks.aws_sagemaker_space.this,
│   on ../modules/sagemaker-studio-notebooks/main.tf line 65, in resource "aws_sagemaker_space" "this":
│   65: resource "aws_sagemaker_space" "this" {

It's happening for both space creation and modification.

Here is the terraform code:

resource "aws_sagemaker_code_repository" "this" {
  code_repository_name = "this-code-repo"

  git_config {
    repository_url = local.repo_url
    secret_arn = aws_secretsmanager_secret.github_login_token.arn
  }

  depends_on = [
    aws_secretsmanager_secret_version.github_login_token,
  ]
}

resource "aws_sagemaker_space" "this" {
  domain_id = aws_sagemaker_domain.this.id
  space_name = "my-space-name"

  space_settings {
    jupyter_server_app_settings {
      default_resource_spec {
        instance_type = "system"
      }

      code_repository {
        repository_url = local.repo_url
      }
    }
  }
}

Terraform backend:

terraform {
  required_providers {
    aws = {
      source = "hashicorp/aws"
      version = "~> 5.21.0"
    }
  }

  required_version = ">= 1.6.0"
}

I can see the git repo associated with the Sagemaker service in the AWS console. Am I doing this wrong?

0

There are 0 answers