-
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
Issue #5774 - Fix the update issues in aws_appsync_datasource #5814
Conversation
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.
Initial feedback below -- please let us know if you have any questions or do not have time to implement the changes. Thanks!
@@ -188,6 +213,7 @@ resource "aws_appsync_datasource" "test" { | |||
api_id = "${aws_appsync_graphql_api.test.id}" | |||
name = "tf_appsync_%s" | |||
type = "AMAZON_DYNAMODB" | |||
description = "appsync datasource version1" |
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: Generally its cleaner to parameterize the test configuration values when changing a single one instead of creating a mostly duplicated new test configuration, e.g.
func testAccAppsyncDatasourceConfig_ddb(rName, description string) string {
// ...
description = %q
// ...
`, rName, rName, rName, rName, rName, rName, description)
}
} | ||
|
||
if d.HasChange("description") { | ||
input.Description = aws.String(d.Get("description").(string)) | ||
} | ||
if d.HasChange("service_role_arn") { |
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.
Given this type of change, I'm worried that all parameters must be provided during the update call. We should probably add an acceptance test that has something optional like description
set, then attempts to update something else like dynamodb_config
, then verifies that description
is still the original value as expected.
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.
@bflad Reverted the changes which I did for service_role_arn
attr to provide the proper solution.
As you said, looks like all parameters should be provided during the update call and covered this issue with acceptance test TestAccAwsAppsyncDatasource_update
, working on fix.
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.
@bflad Could you guide me the way how to handle this?
Since all parameters need to be provided in update call, I am thinking to use Get funcs.
@bflad used Get funcs for update. $ make testacc TEST=./aws TESTARGS='-run=TestAccAwsAppsyncDatasource_update' |
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.
Thanks, @saravanan30erd! 🚀
5 tests passed (all tests)
--- PASS: TestAccAwsAppsyncDatasource_ddb (22.58s)
--- PASS: TestAccAwsAppsyncDatasource_lambda (23.28s)
--- PASS: TestAccAwsAppsyncDatasource_updateDescription (27.18s)
--- PASS: TestAccAwsAppsyncDatasource_update (40.85s)
--- PASS: TestAccAwsAppsyncDatasource_es (772.27s)
@@ -46,13 +46,14 @@ func TestAccAwsAppsyncDatasource_es(t *testing.T) { | |||
} | |||
|
|||
func TestAccAwsAppsyncDatasource_lambda(t *testing.T) { | |||
Desc := "appsync datasource" |
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.
FYI, starting variable names with a capital letter is special in Go (makes them exportable). While it shouldn't matter in this case, its generally best practice to lowerCamelCase unless otherwise necessary.
This has been released in version 1.40.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 #5774
Changes proposed in this pull request:
Type
is required field, added in construct.If the datasource type is either dynamodb, elasticsearch or lambda, it requires
service_role_arn
.Output from acceptance testing: