How to get the network interface used by the current codebuild container?

I have just started to use AWS codebuild to test my infra with Terraform.

The codebuild container runs in a VPC, and I am wondering can I use terraform to determine the network interface id of the current codebuild container? How might I do that?

Alternatively could I acquire that information in the shell before running terraform and setting an env var?

Once I have this, I’d be able to attach security groups to that interface, which should be easy from that point.

Thanks for any pointers!

is the intention to change the defined CodeBuild project Security Group configuration? Wouldn’t this be configured ahead of running the build?

I want to attach an extra security group, in this scenario right now, for vault and consul permissions - but there will probably be other reasons later.

If ECS metadata is available within the CodeBuild Container, then this should provide the task which has the security group definition.
I still have the feeling that the SGs should be attached ahead for the build in scope.

Thanks @tbugfinder , yes I have actually scraped this Json data but couldn’t find an interface (or a security group). Which keys are you referring to?