-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
Enhancement/add lifecycle notebook sm #7586
Conversation
Just wondering if there's anything else that needs to be done on my end to get this approved? |
@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 |
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.
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 |
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.
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).
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.
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, ¬ebook),
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)
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. |
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! |
Enhancement #2999
Changes proposed in this pull request: