-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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 Datasource: aws_transfer_server #7977
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.
Some initial items below but otherwise looking great. Thanks so much @atsushi-ishibashi 🥇
"invocation_role": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
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.
Since invocation_role
and the below attributes cannot be configured to lookup the Transfer server, Optional: true
should be removed from them 👍
|
||
resp, err := conn.DescribeServer(input) | ||
if err != nil { | ||
if isAWSErr(err, transfer.ErrCodeResourceNotFoundException, "") { |
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.
Currently, Terraform data sources should always error when their associated resource is not found, so this handling should be removed.
log.Printf("[ERROR] Transfer Server (%s) not found", serverID) | ||
return nil | ||
} | ||
return err |
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.
We should provide error context for operators and code maintainers here, e.g.
return err | |
return fmt.Errorf("error describing Transfer Server (%s): %s", serverID, err) |
{ | ||
Config: testAccDataSourceAwsTransferServerConfig_basic, | ||
Check: resource.ComposeTestCheckFunc( | ||
testAccDataSourceAwsTransferServerCheck(datasourceName, resourceName), |
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.
We can remove the custom function by using resource.TestCheckResourceAttrPair()
, e.g.
testAccDataSourceAwsTransferServerCheck(datasourceName, resourceName), | |
resource.TestCheckResourceAttrPair(datasourceName, "arn", resourceName, "arn"), | |
resource.TestCheckResourceAttrPair(datasourceName, "endpoint", resourceName, "endpoint"), | |
resource.TestCheckResourceAttrPair(datasourceName, "identity_provider_type", resourceName, "identity_provider_type"), | |
resource.TestCheckResourceAttrPair(datasourceName, "invocation_role", resourceName, "invocation_role"), | |
resource.TestCheckResourceAttrPair(datasourceName, "logging_role", resourceName, "logging_role"), | |
resource.TestCheckResourceAttrPair(datasourceName, "url", resourceName, "url"), |
Along with simplifying the code, we prefer using this upstream function since it also has some special handling in the upcoming Terraform 0.12 Provider SDK to ignore differences between missing values and zero-values. 😄
Thanks for working on this. What about filters? |
@StephenKing if you are referring to the |
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 @atsushi-ishibashi 🚀 (TravisCI failures related to #7993)
--- PASS: TestAccDataSourceAwsTransferServer_basic (11.79s)
--- PASS: TestAccDataSourceAwsTransferServer_service_managed (13.22s)
--- PASS: TestAccDataSourceAwsTransferServer_apigateway (19.66s)
This has been released in version 2.3.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
I see. As the hostname parameter isn't supported by TF atm., there is actually nothing to filter.. |
@atsushi-ishibashi @bflad is there a way to connect this Transfer Server as I can in the console using the endpoint type of Public or VPC? |
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 #7976
Changes proposed in this pull request:
aws_transfer_server
Output from acceptance testing: