-
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
resource/aws_dx_private_virtual_interface: Update resource to support MTU param #6141
resource/aws_dx_private_virtual_interface: Update resource to support MTU param #6141
Conversation
Please add verification of the resource.TestCheckResourceAttr("aws_dx_private_virtual_interface.foo", "mtu", "9001"),
resource.TestCheckResourceAttr("aws_dx_private_virtual_interface.foo", "jumbo_frame_enabled", "1"), |
Computed: true, | ||
ForceNew: true, | ||
}, | ||
"jumbo_frame_enabled": { |
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.
Nitpick - In the documentation the feature is called Jumbo Frames. For consistency I suggest naming the attribute jumbo_frames_enabled
or jumbo_frame_capable
(to match the API).
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.
Oops, I meant to have this match the API but I just spaced on it. This will be corrected in my next commit.
@@ -84,6 +84,16 @@ func resourceAwsDxPrivateVirtualInterface() *schema.Resource { | |||
Computed: true, | |||
ForceNew: true, | |||
}, | |||
"mtu": { |
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.
See ValidateFunc
comment: https://github.com/terraform-providers/terraform-provider-aws/pull/6142/files#r224971730.
Type: schema.TypeInt, | ||
Default: 1500, | ||
Optional: true, | ||
ForceNew: true, |
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.
@ewbankkit I believe I have addressed your comments with this latest commit. I ran out of time today to test and write tests so I will likely circle back to that tomorrow or Tuesday. It looks to me that my changes "should work" so if you have spare cycles to test before I get to it please feel free. |
@@ -219,3 +235,22 @@ func dxPrivateVirtualInterfaceWaitUntilAvailable(d *schema.ResourceData, conn *d | |||
directconnect.VirtualInterfaceStateDown, | |||
}) | |||
} | |||
|
|||
func IntInSlice(valid []int) schema.SchemaValidateFunc { |
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.
Again, haven't fully tested this yet but would this be a good candidate to move to the core validation library?
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.
Yes, I think it would but given the churn in the codebase with v0.12 it is probably best to wait until that settles down.
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.
Probably better to move this to validators.go
and rename it to something like validateIntInSlice
and add a unit test to validators_test.go
.
OK, I'll look at testing this week. |
@slapula I made a couple of mainly cosmetic changes and pushed to my
I should be able to run the acceptance tests in the next couple of days - I'll make any modifications on that branch and you can then merge back. |
@slapula I took your latest code (fixed a merge error) and ran acceptance tests for the new test case. resource.TestCheckResourceAttr("aws_dx_private_virtual_interface.foo", "jumbo_frame_capable", "true")
->
resource.TestCheckResourceAttr("aws_dx_private_virtual_interface.foo", "jumbo_frame_capable", "1") the test passes: $ DX_CONNECTION_ID=dxcon-xxxxxxxx AWS_DEFAULT_REGION=us-east-1 make testacc TESTARGS='-run=TestAccAwsDxPrivateVirtualInterface_mtuUpdate'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -parallel 20 -run=TestAccAwsDxPrivateVirtualInterface_mtuUpdate -timeout 120m
? github.com/terraform-providers/terraform-provider-aws [no test files]
=== RUN TestAccAwsDxPrivateVirtualInterface_mtuUpdate
--- PASS: TestAccAwsDxPrivateVirtualInterface_mtuUpdate (1252.51s)
PASS
ok github.com/terraform-providers/terraform-provider-aws/aws 1270.641s If you merge the latest changes from https://github.com/ewbankkit/terraform-provider-aws/tree/slapula-dx-private-virtual-interface-mtu I can the run all the |
@ewbankkit Thanks for the help on this! I totally spaced on the |
testAccCheckAwsDxPrivateVirtualInterfaceExists("aws_dx_private_virtual_interface.foo"), | ||
resource.TestCheckResourceAttr("aws_dx_private_virtual_interface.foo", "name", vifName), | ||
resource.TestCheckResourceAttr("aws_dx_private_virtual_interface.foo", "mtu", "1500"), | ||
resource.TestCheckResourceAttr("aws_dx_private_virtual_interface.foo", "jumbo_frame_capable", "1"), |
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.
Need to change this to
resource.TestCheckResourceAttr("aws_dx_private_virtual_interface.foo", "jumbo_frame_capable", "true"),
or else will get errors like
$ DX_CONNECTION_ID=dxcon-xxxxxxxx AWS_DEFAULT_REGION=us-east-1 make testacc TESTARGS='-run=TestAccAwsDxPrivateVirtualInterface_mtuUpdate'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -parallel 20 -run=TestAccAwsDxPrivateVirtualInterface_mtuUpdate -timeout 120m
? github.com/terraform-providers/terraform-provider-aws [no test files]
=== RUN TestAccAwsDxPrivateVirtualInterface_mtuUpdate
--- FAIL: TestAccAwsDxPrivateVirtualInterface_mtuUpdate (667.21s)
testing.go:538: Step 0 error: Check failed: Check 4/4 error: aws_dx_private_virtual_interface.foo: Attribute 'jumbo_frame_capable' expected "1", got "true"
FAIL
FAIL github.com/terraform-providers/terraform-provider-aws/aws 668.068s
make: *** [testacc] Error 1
@slapula Left a comment on changing |
Oh ok, I misread your previous comment. I'll update that in a moment. |
OK, tested the code (serially as there is a problem with running the acceptance tests in parallel, #6244, which shouldn't block this PR). $ git rev-parse HEAD
da69517c8d918611b8ab9599b7e82ee1445c8be4
$ DX_CONNECTION_ID=dxcon-xxxxxxxx AWS_DEFAULT_REGION=us-east-1 make testacc TESTARGS='-run=TestAccAwsDxPrivateVirtualInterface_mtuUpdate'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -parallel 20 -run=TestAccAwsDxPrivateVirtualInterface_mtuUpdate -timeout 120m
? github.com/terraform-providers/terraform-provider-aws [no test files]
=== RUN TestAccAwsDxPrivateVirtualInterface_mtuUpdate
--- PASS: TestAccAwsDxPrivateVirtualInterface_mtuUpdate (1252.51s)
PASS
ok github.com/terraform-providers/terraform-provider-aws/aws (cached)
$ DX_CONNECTION_ID=dxcon-xxxxxxxx AWS_DEFAULT_REGION=us-east-1 make testacc TESTARGS='-run=TestAccAwsDxPrivateVirtualInterface_basic'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -parallel 20 -run=TestAccAwsDxPrivateVirtualInterface_basic -timeout 120m
? github.com/terraform-providers/terraform-provider-aws [no test files]
=== RUN TestAccAwsDxPrivateVirtualInterface_basic
=== PAUSE TestAccAwsDxPrivateVirtualInterface_basic
=== CONT TestAccAwsDxPrivateVirtualInterface_basic
--- PASS: TestAccAwsDxPrivateVirtualInterface_basic (409.98s)
PASS
ok github.com/terraform-providers/terraform-provider-aws/aws 410.875s
$ DX_CONNECTION_ID=dxcon-xxxxxxxx AWS_DEFAULT_REGION=us-east-1 make testacc TESTARGS='-run=TestAccAwsDxPrivateVirtualInterface_dxGateway'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -parallel 20 -run=TestAccAwsDxPrivateVirtualInterface_dxGateway -timeout 120m
? github.com/terraform-providers/terraform-provider-aws [no test files]
=== RUN TestAccAwsDxPrivateVirtualInterface_dxGateway
=== PAUSE TestAccAwsDxPrivateVirtualInterface_dxGateway
=== CONT TestAccAwsDxPrivateVirtualInterface_dxGateway
--- PASS: TestAccAwsDxPrivateVirtualInterface_dxGateway (589.50s)
PASS
ok github.com/terraform-providers/terraform-provider-aws/aws 590.384s |
This PR is now ready for review. |
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.
LGTM, thanks @slapula and @ewbankkit! 🚀
@@ -97,17 +115,17 @@ func dxVirtualInterfaceStateRefresh(conn *directconnect.DirectConnect, vifId str | |||
} | |||
} | |||
|
|||
func dxVirtualInterfaceWaitUntilAvailable(d *schema.ResourceData, conn *directconnect.DirectConnect, pending, target []string) error { | |||
func dxVirtualInterfaceWaitUntilAvailable(conn *directconnect.DirectConnect, vifId string, timeout time.Duration, pending, target []string) 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 has been released in version 1.42.0 of the 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! |
Fixes #6136
Changes proposed in this pull request:
aws_dx_private_virtual_interface
resource to support new MTU parameterOutput from acceptance testing: