Skip to content
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

Add iot TopicRuleDestination to v1beta1 #1015

Merged
merged 4 commits into from
Dec 13, 2023

Conversation

mbbush
Copy link
Collaborator

@mbbush mbbush commented Dec 7, 2023

Description of your changes

Fixes #361

I have:

  • Run make check-diff lint test to ensure this PR is ready for review.

How has this code been tested

make e2e UPTEST_EXAMPLE_LIST=examples/iot/topicruledestination.yaml

The test takes about 15 minutes to run, due to AWS being slow to create and delete these resources. The equivalent acceptance test in the terraform provider takes basically the same amount of time.

Note that in the example, I used a management policy that excludes Delete for the IAM role. This is necessary to allow the IoT service to assume the role during deletion of the topic rule destination, to delete the ENIs it created. Otherwise deletion of the VPC fails because there are leftover resources in it. The result is that the IAM role won't be cleaned up. But that shouldn't be a problem. It's got a name that's unlikely to conflict with anything else, and rerunning the test a second time when the role already exist works just fine. That's one reason I used an inline policy, so I could only have a single leftover resource, rather than also leaving behind an IAM policy.

@turkenf
Copy link
Collaborator

turkenf commented Dec 7, 2023

@mbbush, since you are now a contributor, you should be able to trigger uptest on open PRs.

@mbbush
Copy link
Collaborator Author

mbbush commented Dec 7, 2023

/test-examples="examples/iot/topicruledestination.yaml"

@mbbush
Copy link
Collaborator Author

mbbush commented Dec 7, 2023

Nifty! I thought it was only allowed for upbound org members. This is going to be useful, thanks for letting me know!

@mbbush mbbush force-pushed the iot-topic-rule-destination branch from 304db0d to f95d15a Compare December 8, 2023 02:19
@mbbush
Copy link
Collaborator Author

mbbush commented Dec 8, 2023

/test-examples="examples/iot/topicruledestination.yaml"

@mbbush mbbush marked this pull request as ready for review December 8, 2023 03:34
Copy link
Collaborator

@turkenf turkenf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @mbbush, I left a few comments for you to consider.

config/iot/config.go Outdated Show resolved Hide resolved
config/iot/config.go Outdated Show resolved Hide resolved
examples/iot/topicruledestination.yaml Outdated Show resolved Hide resolved
@@ -2081,6 +2078,9 @@ var NoForkExternalNameConfigs = map[string]config.ExternalName{
"aws_iot_thing_type": config.IdentifierFromProvider,
// IoT Topic Rules can be imported using the name
"aws_iot_topic_rule": config.NameAsIdentifier,
// IoT topic rule destinations can be imported using the arn
// arn:aws:iot:us-west-2:123456789012:ruledestination/vpc/2ce781c8-68a6-4c52-9c62-63fe489ecc60
"aws_iot_topic_rule_destination": TemplatedStringAsProviderDefinedIdentifier("arn:aws:iot:{{ .setup.configuration.region }}:{{ .setup.client_metadata.account_id }}:ruledestination/vpc/{{ .external_name }}"),
Copy link
Collaborator Author

@mbbush mbbush Dec 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about the relative merits of using just the provider-generated UUID suffix as the external name (as I've done here) vs the full arn (which is also the terraform id)? The arn is certainly longer, and more cumbersome, but also perhaps easier for new users to discover, since we don't currently have any way of documenting the expected format for an external name. The UUID is shorter, and is the minimum amount of information necessary to track, so there's no redundancy or room for conflict between e.g. the arn and the spec.

Copy link
Collaborator

@turkenf turkenf Dec 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am okay with the above configuration and if we think this is better in terms of API normalization we can go with this.

@mbbush
Copy link
Collaborator Author

mbbush commented Dec 10, 2023

/test-examples="examples/iot/topicruledestination.yaml"

@mbbush
Copy link
Collaborator Author

mbbush commented Dec 11, 2023

@turkenf Thanks for the testhook recommendation. It worked great.

I think the only thing left before this can merge is a decision on whether to use the short identifier or the longer but more "discoverable" full ARN as the external name. I see pros and cons with both options, and am willing to go either way.

Copy link
Collaborator

@turkenf turkenf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @mbbush, LGTM.

@turkenf turkenf merged commit 2849b79 into crossplane-contrib:main Dec 13, 2023
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Moving iot (1) resource to v1beta1 version
2 participants