-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Workspaces Directory Access Properties #16688
Workspaces Directory Access Properties #16688
Conversation
0f5a8bd
to
ddbda6b
Compare
MaxItems: 1, | ||
Elem: &schema.Resource{ | ||
Schema: map[string]*schema.Schema{ | ||
"device_type_android": { |
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.
lets keep the API structure here and use string and validate values.
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 don't mind, but in this case self_service_permissions
block attributes should be changed too as far as they have a similar semantic. If it makes sense to you, please could you suggest the best way to handle self_service_permissions
backward compatibility?
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.
It may require a breaking change in the future but lets keep to the scope of this PR as this is a new block added. from my experience maintainers usually prefer(and i agree) to keep the original type used in the SDK. we dont know the reason why this was not bool and in the future this opens a door for more values (as unlikely as it looks now) and it means breaking this interface or adding extra arguments.
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.
Make total sense to me. Thank you, Ilia 🙇 Revamping...
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.
Done.
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.
Indeed API doesn't specify the defaults, here is my best effort to guess the sensible values. Is it OK to rely on the current non-specified default values from API response? I mean they may be changed in the future by AWS.
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.
Yeah, they are defacto defaults. they still may change but more unlikely. just adding the test to basic would be fine we can use optional with default. i would avoid computed to catch config drift. so the way it was before is good just keep the check for basic test as well.
sorry for the multiple cycles if i wasnt clear.
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.
No worries, I appreciate your thoughtful review 🙇
- Removed
Default
schema options in favor of API default values - Added default values assertions to the basic test
Could you elaborate on Computed
schema option removal? If I understand correctly, user may skip workspace_access_properties
attribute configuration and API returns default values, which are populated to state on Read
. This kind of behavior should be marked as Computed
. Also, basic
acc test should contain assertions exactly for Computed
+ Optional
attributes.
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.
Doesnt the current setting cause config drift?
there should be a computed: true or default value.
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.
workspace_access_properties
doesn't have a default value right now. The plan is empty at the end of each test step.
MaxItems: 1, | ||
Elem: &schema.Resource{ | ||
Schema: map[string]*schema.Schema{ | ||
"device_type_android": { |
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.
Whats the default based on?
https://docs.aws.amazon.com/workspaces/latest/api/API_WorkspaceAccessProperties.html doesnt specify a value.
if this is indeed the defaults returned lets also add a check to the base test.
Schema: map[string]*schema.Schema{ | ||
"device_type_android": { | ||
Type: schema.TypeString, | ||
Optional: 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.
data source no need for optional
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.
Good point, fixed. I've removed MaxItems
too.
MaxItems: 1, | ||
Elem: &schema.Resource{ | ||
Schema: map[string]*schema.Schema{ | ||
"device_type_android": { |
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.
Doesnt the current setting cause config drift?
there should be a computed: true or default value.
5af9c55
to
5daa021
Compare
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.
Looks Good to me.
5daa021
to
6f2cda0
Compare
6f2cda0
to
408b892
Compare
LGTM 🚀 Thanks @Tensho Verified Acceptance Tests in Commercial (us-west-2) make testacc TEST=./aws TESTARGS='-run=TestAccAwsWorkspacesDirectory_workspaceAccessProperties'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAwsWorkspacesDirectory_workspaceAccessProperties -timeout 120m
=== RUN TestAccAwsWorkspacesDirectory_workspaceAccessProperties
=== PAUSE TestAccAwsWorkspacesDirectory_workspaceAccessProperties
=== CONT TestAccAwsWorkspacesDirectory_workspaceAccessProperties
--- PASS: TestAccAwsWorkspacesDirectory_workspaceAccessProperties (600.33s)
PASS
ok github.com/terraform-providers/terraform-provider-aws/aws 602.247s
make testacc TEST=./aws TESTARGS='-run=TestAccDataSourceAwsWorkspacesDirectory_basic'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccDataSourceAwsWorkspacesDirectory_basic -timeout 120m
=== RUN TestAccDataSourceAwsWorkspacesDirectory_basic
=== PAUSE TestAccDataSourceAwsWorkspacesDirectory_basic
=== CONT TestAccDataSourceAwsWorkspacesDirectory_basic
--- PASS: TestAccDataSourceAwsWorkspacesDirectory_basic (613.22s)
PASS
ok github.com/terraform-providers/terraform-provider-aws/aws 615.085s Acceptance Tests fail in GovCloud due to SimpleAD not being available, there is code to handle this occurrence in the make testacc TEST=./aws TESTARGS='-run=TestAccDataSourceAwsWorkspacesDirectory_basic'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccDataSourceAwsWorkspacesDirectory_basic -timeout 120m
=== RUN TestAccDataSourceAwsWorkspacesDirectory_basic
=== PAUSE TestAccDataSourceAwsWorkspacesDirectory_basic
=== CONT TestAccDataSourceAwsWorkspacesDirectory_basic
data_source_aws_workspaces_directory_test.go:17: Step 1/1 error: Error running apply: 2021/01/13 14:34:41 [DEBUG] Using modified User-Agent: Terraform/0.12.29 HashiCorp-terraform-exec/0.12.0
Error: ClientException: Simple AD directory creation is currently not supported in this region. : RequestId: e70ba230-04f3-4f62-acad-6e2614a0c687 : RequestId: e70ba230-04f3-4f62-acad-6e2614a0c687
{
RespMetadata: {
StatusCode: 400,
RequestID: "e70ba230-04f3-4f62-acad-6e2614a0c687"
},
Message_: "Simple AD directory creation is currently not supported in this region. : RequestId: e70ba230-04f3-4f62-acad-6e2614a0c687 : RequestId: e70ba230-04f3-4f62-acad-6e2614a0c687",
RequestId: "e70ba230-04f3-4f62-acad-6e2614a0c687"
}
--- FAIL: TestAccDataSourceAwsWorkspacesDirectory_basic (8.80s)
FAIL
FAIL github.com/terraform-providers/terraform-provider-aws/aws 10.774s
FAIL
make: *** [testacc] Error 1 |
This has been released in version 3.24.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks! |
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! |
Community Note
Closes #12866
Release note for CHANGELOG:
Unit Tests
Acceptance Tests
Resource
Data Source
Fixes
References