Skip to content
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

Enhancement/add lifecycle notebook sm #7586

Merged
merged 2 commits into from
Apr 5, 2019
Merged

Enhancement/add lifecycle notebook sm #7586

merged 2 commits into from
Apr 5, 2019

Conversation

StuartLox
Copy link

@StuartLox StuartLox commented Feb 16, 2019

Enhancement #2999

Changes proposed in this pull request:

  • Adding lifecycle configuration name as an optional param for Create Notebook Instance
  • Update sagemaker documentation to include lifecycle configuration name.

@ghost ghost added size/XS Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. service/sagemaker Issues and PRs that pertain to the sagemaker service. labels Feb 16, 2019
@bflad bflad added the enhancement Requests to existing resources that expand the functionality or scope. label Feb 16, 2019
@StuartLox
Copy link
Author

Just wondering if there's anything else that needs to be done on my end to get this approved?

@bcatubig
Copy link
Contributor

@StuartLox Looks good to me. I would add a test case as well to this pr. You probably want to remove the vendor files as well

Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

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

When #7585 is merged we can add an acceptance test for this and get this in. 👍

@@ -28,11 +28,11 @@ require (
github.com/hashicorp/go-version v1.0.0
github.com/hashicorp/hcl v0.0.0-20170504190234-a4b07c25de5f // indirect
github.com/hashicorp/hcl2 v0.0.0-20171003232734-44bad6dbf549 // indirect
github.com/hashicorp/hil v0.0.0-20170512213305-fac2259da677 // indirect
github.com/hashicorp/hil v0.0.0-20190212132231-97b3a9cdfa93 // indirect
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd recommend removing any go.mod and go.sum changes to this pull request as they should be unrelated to this change and likely cause merge conflicts (as they are currently).

@bflad bflad added this to the v2.5.0 milestone Apr 5, 2019
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

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

Hi again @StuartLox 👋 Thanks again for submitting this! I went ahead and removed the merge conflicts and added a quick acceptance test in a followup commit so we can get this released today. Everything looks good! 🚀

Acceptance testing added:

func TestAccAWSSagemakerNotebookInstance_LifecycleConfigName(t *testing.T) {
  var notebook sagemaker.DescribeNotebookInstanceOutput
  rName := resource.PrefixedUniqueId(sagemakerTestAccSagemakerNotebookInstanceResourceNamePrefix)
  resourceName := "aws_sagemaker_notebook_instance.test"
  sagemakerLifecycleConfigResourceName := "aws_sagemaker_notebook_instance_lifecycle_configuration.test"

  resource.ParallelTest(t, resource.TestCase{
    PreCheck:     func() { testAccPreCheck(t) },
    Providers:    testAccProviders,
    CheckDestroy: testAccCheckAWSSagemakerNotebookInstanceDestroy,
    Steps: []resource.TestStep{
      {
        Config: testAccAWSSagemakerNotebookInstanceConfigLifecycleConfigName(rName),
        Check: resource.ComposeTestCheckFunc(
          testAccCheckAWSSagemakerNotebookInstanceExists(resourceName, &notebook),
          resource.TestCheckResourceAttrPair(resourceName, "lifecycle_config_name", sagemakerLifecycleConfigResourceName, "name"),
        ),
      },
      {
        ResourceName:      resourceName,
        ImportState:       true,
        ImportStateVerify: true,
      },
    },
  })
}

func testAccAWSSagemakerNotebookInstanceConfigLifecycleConfigName(rName string) string {
  return fmt.Sprintf(`
data "aws_iam_policy_document" "assume_role" {
  statement {
    actions = [ "sts:AssumeRole" ]
    principals {
      identifiers = ["sagemaker.amazonaws.com"]
      type        = "Service"
    }
  }
}

resource "aws_iam_role" "test" {
  assume_role_policy = "${data.aws_iam_policy_document.assume_role.json}"
  name               = %[1]q
  path               = "/"
}

resource "aws_sagemaker_notebook_instance_lifecycle_configuration" "test" {
  name = %[1]q
}

resource "aws_sagemaker_notebook_instance" "test" {
  instance_type         = "ml.t2.medium"
  lifecycle_config_name = "${aws_sagemaker_notebook_instance_lifecycle_configuration.test.name}"
  name                  = %[1]q
  role_arn              = "${aws_iam_role.test.arn}"
}
`, rName)
}

Output from acceptance testing:

--- PASS: TestAccAWSSagemakerNotebookInstance_basic (241.98s)
--- PASS: TestAccAWSSagemakerNotebookInstance_tags (257.93s)
--- PASS: TestAccAWSSagemakerNotebookInstance_LifecycleConfigName (260.38s)
--- PASS: TestAccAWSSagemakerNotebookInstance_disappears (286.50s)
--- PASS: TestAccAWSSagemakerNotebookInstance_update (424.51s)

@bflad bflad merged commit b6be353 into hashicorp:master Apr 5, 2019
bflad added a commit that referenced this pull request Apr 5, 2019
@bflad
Copy link
Contributor

bflad commented Apr 5, 2019

This has been released in version 2.5.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@ghost
Copy link

ghost commented Mar 30, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. enhancement Requests to existing resources that expand the functionality or scope. service/sagemaker Issues and PRs that pertain to the sagemaker service. size/XS Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants