-
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
New Resource: aws_iot_thing_type
#3302
Conversation
908a9e5
to
113982c
Compare
113982c
to
c2f6c80
Compare
c2f6c80
to
ce0f69d
Compare
ce0f69d
to
ce6efae
Compare
aws/resource_aws_iot_thing_type.go
Outdated
d.Set("deprecated", out.ThingTypeMetadata.Deprecated) | ||
} | ||
|
||
d.Set("arn", *out.ThingTypeArn) |
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 you defer the dereferencing to Set()
and prevent potential crash here?
func resourceAwsIotThingTypeUpdate(d *schema.ResourceData, meta interface{}) error { | ||
conn := meta.(*AWSClient).iotconn | ||
|
||
if d.HasChange("deprecated") { |
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.
Unless I'm mistaken this will always be triggered for new resources during creation, even though it's IMO not necessary as we can assume new resource doesn't need "undeprecation" (no-op API call)?
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.
Theoretically we could just modify the condition here to also check for d.IsNewResource()
and the real value of deprecated
.
aws/resource_aws_iot_thing_type.go
Outdated
return resource.NonRetryableError(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.
Nitpick: I know we have that in many resources still, but it's redundant. The ID is emptied automatically in the core.
"github.com/hashicorp/terraform/helper/resource" | ||
) | ||
|
||
func TestAccAWSIotThingTypeTest_importbasic(t *testing.T) { |
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: importBasic
#ocd
aws/resource_aws_iot_thing_type.go
Outdated
Type: schema.TypeString, | ||
ValidateFunc: validateIotThingTypeSearchableAttribute, | ||
}, | ||
}, |
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.
Is there any particular reason we should be drifting away from the API here? i.e. not nest description
and searchable_attributes
under properties
?
Obviously we don't know how is the API going to evolve. It's a guessing game at this point, but it has proven to me in the past that it's better to stick to the API. 😉
@radeksimko this issue is still targeted to |
ce6efae
to
161b3d3
Compare
161b3d3
to
77e88e9
Compare
@radeksimko Should be all ok now :) |
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, just left you some nitpicky comments, but no blockers.
LGTM.
|
||
In addition to the arguments above, the following attributes are exported: | ||
|
||
* `arn` - The ARN of the created AWS IoT thing_type |
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: thing_type
-> Thing Type
"github.com/hashicorp/terraform/helper/resource" | ||
) | ||
|
||
func TestAccAWSIotThingTypeTest_importBasic(t *testing.T) { |
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: TestAccAWSIotThingTypeTest_
-> TestAccAWSIotThingType_
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.
Don't even know where these XTest_ come from, it's not even copy-pasta 🤔
"github.com/hashicorp/terraform/terraform" | ||
) | ||
|
||
func TestAccAWSIotThingTypeTest_basic(t *testing.T) { |
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: as above - we don't need Test
twice in the name 😉
}) | ||
} | ||
|
||
func TestAccAWSIotThingTypeTest_full(t *testing.T) { |
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: as above - we don't need Test
twice in the name 😉
}) | ||
} | ||
|
||
func testAccCheckAWSIotThingTypeTestDestroy(s *terraform.State) 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.
Nitpick: as above - we don't need Test
twice in the name 😉
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 catch, thanks!
return nil | ||
} | ||
|
||
func testAccAWSIotThingTypeTest_basic(rName int) 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.
Nitpick: We tend to call this Config
rather than Test
.
`, rName) | ||
} | ||
|
||
func testAccAWSIotThingTypeTest_full(rName int) 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.
Nitpick: We tend to call this Config
rather than Test
.
`, rName) | ||
} | ||
|
||
func testAccAWSIotThingTypeTest_fullUpdated(rName int) 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.
Nitpick: We tend to call this Config
rather than Test
.
77e88e9
to
03b5fb3
Compare
03b5fb3
to
9427513
Compare
@radeksimko Just fixed nitpicks, thanks for the review.
|
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! |
Description
This adds a new resource for IoT called
aws_iot_thing_type
.Related issues
Tests