-
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
New Resource: appsync_graphql_api #2494
New Resource: appsync_graphql_api #2494
Conversation
atsushi-ishibashi
commented
Nov 30, 2017
•
edited
Loading
edited
- docs
656cdd5
to
910366b
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.
Hi @atsushi-ishibashi
thanks for the PR, this is looking pretty good, very close to mergeable state!
I left you some comments to address.
resp, err := conn.GetGraphqlApi(input) | ||
if err != nil { | ||
if isAWSErr(err, appsync.ErrCodeNotFoundException, "") { | ||
d.SetId("") |
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.
Do you mind adding our usual WARN
log message here?
}, | ||
StateFunc: func(v interface{}) string { | ||
return strings.ToUpper(v.(string)) | ||
}, |
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.
Can't we avoid this just by tightening the validation above (i.e. by not accepting lowercase)?
} | ||
} | ||
errors = append(errors, fmt.Errorf("expected %s to be one of %v, got %s", k, validTypes, value)) | ||
return |
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.
Would you mind using constants available in the SDK?
Also we have a built-in validation helper for this:
ValidateFunc: validation.StringInSlice([]string{
appsync.AuthenticationTypeApiKey,
appsync.AuthenticationTypeAwsIam,
appsync.AuthenticationTypeAmazonCognitoUserPools,
}, false),
😉
}, | ||
StateFunc: func(v interface{}) string { | ||
return strings.ToUpper(v.(string)) | ||
}, |
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.
Same question as above ^
} | ||
errors = append(errors, fmt.Errorf("expected %s to be one of %v, got %s", k, validTypes, value)) | ||
return | ||
}, |
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.
Same question as above ^
return err | ||
} | ||
|
||
d.SetId("") |
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.
Likewise ^
if isAWSErr(err, appsync.ErrCodeNotFoundException, "") { | ||
d.SetId("") | ||
return nil | ||
} |
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 can't think of a reason why the user would want to silently fail updating API when it doesn't exist. 🤔 Is there any?
The most common cases (refresh, deletion) are covered correctly, but I think we should just error out on update.
input := &appsync.CreateGraphqlApiInput{ | ||
AuthenticationType: aws.String(d.Get("authentication_type").(string)), | ||
Name: aws.String(d.Get("name").(string)), | ||
UserPoolConfig: expandAppsyncGraphqlApiUserPoolConfig(d.Get("user_pool_config").([]interface{})), |
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 am admittedly surprised this isn't causing a crash in the attached test where user_pool_config
is not present. It's no big deal as it's not crashing, but it may be safer to always wrap optional fields in d.GetOk()
.
--- | ||
layout: "aws" | ||
page_title: "AWS: aws_appsync_graphql_api" | ||
sidebar_current: "docs-aws-resource-appsync-praphql-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.
Typo 👓 praphql
-> graphql
authentication_type = "AMAZON_COGNITO_USER_POOLS" | ||
name = "tf_appsync_%s" | ||
user_pool_config { | ||
aws_region = "us-west-2" |
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.
Although our tests commonly run in us-west-2
I think we should keep the test region-agnostic. Do you mind adding aws_region
data source here?
@radeksimko Thank you for your review. OK👍
|
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, I just removed the not-found check from Update()
as mentioned. I hope you don't mind.
@radeksimko Ok👍I misunderstood what you said in the above review. |
Is the plan to accrete pieces for appsync gradually or is there a consistent plan? @atsushi-ishibashi |
I have no plan to implement anymore. In my opinion, |
This has been released in version 1.10.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! |