crossplane-contrib / provider-upjet-aws

Official AWS Provider for Crossplane by Upbound.
https://marketplace.upbound.io/providers/upbound/provider-aws
Apache License 2.0
137 stars 112 forks source link

feat: implement ec2_instance_connect_endpoint #1358

Open josegonzalez opened 2 weeks ago

josegonzalez commented 2 weeks ago

Description of your changes

This pull request implements the ec2_instance_connect_endpoint resource, allowing folks to setup EC2 Instance Connect against a given subnet. This allows for remote instance access without exposing any resources publicly or having a bastion.

https://aws.amazon.com/blogs/compute/secure-connectivity-from-public-to-private-introducing-ec2-instance-connect-endpoint-june-13-2023/

I have:

How has this code been tested

I haven't tested this PR yet, wanted to know if the automated testing would pick this up or maybe get some help from folks to figure out how to get this running/tested. I'll reach out via slack tomorrow for help on the latter :)

mbbush commented 2 weeks ago

/test-examples="examples/ec2/v1beta1/instanceconnectendpoint.yaml"

mbbush commented 2 weeks ago

Thanks for the PR @josegonzalez!

I kicked off the testing pipelines for you, and I can take a more detailed look tomorrow.

josegonzalez commented 2 weeks ago

@mbbush is there an easy way to see what exactly failed? There's thousands of lines of output in the logs and its not clear what I can fix :)

mbbush commented 2 weeks ago

From the artifacts section of https://github.com/crossplane-contrib/provider-upjet-aws/actions/runs/9493572569, download the control plane dump, and look at the logs for the provider-aws-ec2 pod in the upbound-system namespace. Here it is

==== START logs for container package-runtime of pod upbound-system/provider-aws-ec2-provider-aws-d5ddccd65-fzwm2 ====
2024-06-13T04:40:25Z    DEBUG   provider-aws    Starting    {"sync-interval": "1h0m0s", "poll-interval": "10m0s", "poll-jitter": "30s", "max-reconcile-rate": 100}
panic: resource "aws_ec2_instance_connect_endpoint" is configured to be reconciled with Terraform Plugin SDKbut either config.Provider.TerraformProvider is not configured or the Go schema does not exist for the resource

goroutine 1 [running]:
github.com/crossplane/upjet/pkg/config.NewProvider({0xc004df2000?, 0xc00170d1e8?, 0x0?}, {0x16926652, 0x3}, {0x16a8f959, 0x1f}, {0x2420e4e0, 0x54ff55, 0x54ff55}, ...)
    github.com/crossplane/upjet@v1.4.1/pkg/config/provider.go:346 +0xe1c
github.com/upbound/provider-aws/config.GetProvider({0x19731f80?, 0x24dd1800?}, 0x0)
    github.com/upbound/provider-aws/config/registry.go:96 +0xa2b
main.main()
    github.com/upbound/provider-aws/cmd/provider/ec2/zz_main.go:159 +0x2e85
==== END logs for container package-runtime of pod upbound-system/provider-aws-ec2-provider-aws-d5ddccd65-fzwm2 ====

This probably means that the resource you're implementing uses the terraform plugin framework, not the terraform sdk. There's a separate map to add it to at the top of externalname.go

turkenf commented 1 week ago

Hi @josegonzalez,

Thank you for your effort in this PR, as @mbbush said, this is a Framework Resource, you should move the external name configuration under TerraformPluginFrameworkExternalNameConfigs.

josegonzalez commented 6 days ago

Sounds good! I'll get to that on thursday when I'm back at work :)