* enforce region validation on all AWS config loading
Replace direct uses of `github.com/aws/aws-sdk-go-v2/config.LoadDefaultConfig`
with the internal `lib/cloud/aws/config.LoadDefaultConfig` wrapper, which
validates any explicitly requested AWS region before use. Enforces this via a
new forbidigo linter rule.
Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
* Apply suggestions from code review
Co-authored-by: Nic Klaassen <nic@nicklaassen.ca>
* fix unit tests
* include underscores and uppercase letters
* add ConfigureRegion
---------
Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
Co-authored-by: Nic Klaassen <nic@nicklaassen.ca>
* Auto Discover GCP GCE: add project id label
This PR adds a new label when auto configuring the teleport.yaml for a
VM in GCP.
This new label has the project id.
We already had the project id, but it was in a protected/internal only
label and so the users couldn't see it in the WebUI.
* Update api/types/constants.go
Co-authored-by: Alan Parra <alan.parra@goteleport.com>
* Update api/types/constants.go
Co-authored-by: Alan Parra <alan.parra@goteleport.com>
* Update lib/srv/server/installer/autodiscover_test.go
Co-authored-by: Alan Parra <alan.parra@goteleport.com>
* fix var name and remove godoc from not implemented methods
---------
Co-authored-by: Alan Parra <alan.parra@goteleport.com>
The imds pacakges are inteneded to be very lightweight
and consumable by client tools without any additional
cloud specific dependencies. By inverting dependencies
such that lib/cloud/gcp depends on lib/cloud/imds/gcp
client tools no longer transatively import the very
large `cloud.google.com/go/compute/apiv1`.
The depguard rules were also updated to prevent any
accidental regressions.
* Azure IMDS: add location, vmid, subscription and group
This PR adds a new method to fetch instance metada information.
It will include the instance/metadata endpoint to retrieve them.
* fix test
* improve error assertion
* Move imds related code into their own packages
Separating imds from cloud vm, kubernetes, etc. prevents the
dependency tree expanding to include extra cloud related things
for callers that only require an imds client.
* Move cloud constructors for types.KubeCluster out of lib/services
lib/services is meant to be a relatively dependency free package
that provides basic interfaces and functions for dealing with
types. NewKubeClusterFromGCPGKE, NewKubeClusterFromAWSEKS, NewKubeClusterFromAzureAKS
caused a slew of cloud related dependencies to be imported in
lib/services which increases binary sizes of client tools.
They have all been moved into lib/srv/discovery/common since
they were only consumed by other code in lib/srv/discovery.
* Decouple servicecfg and lib/auth/keystore
This was the last remaining way for lib/cloud/gcp to slip
into client tools that aren't importing lib/auth directly.
```
goda tree "reach(github.com/gravitational/teleport/tool/tctl...:all, cloud.google.com/go/compute/apiv1)"
├ github.com/gravitational/teleport/tool/tctl
└ github.com/gravitational/teleport/tool/tctl/common
├ github.com/gravitational/teleport/lib/config
├ github.com/gravitational/teleport/lib/pam
└ github.com/gravitational/teleport/lib/service/servicecfg
└ github.com/gravitational/teleport/lib/auth/keystore
└ github.com/gravitational/teleport/lib/cloud
└ github.com/gravitational/teleport/lib/cloud/gcp
└ cloud.google.com/go/compute/apiv1
└ github.com/gravitational/teleport/lib/service/servicecfg ~
├ github.com/gravitational/teleport/lib/service/servicecfg ~
├ github.com/gravitational/teleport/tool/tctl/common/accessmonitoring
└ github.com/gravitational/teleport/lib/service/servicecfg ~
├ github.com/gravitational/teleport/tool/tctl/common/loginrule
└ github.com/gravitational/teleport/lib/service/servicecfg ~
├ github.com/gravitational/teleport/tool/tctl/sso/configure
├ github.com/gravitational/teleport/lib/service/servicecfg ~
└ github.com/gravitational/teleport/tool/tctl/sso/tester
└ github.com/gravitational/teleport/lib/service/servicecfg ~
└ github.com/gravitational/teleport/tool/tctl/sso/tester ~
```
* fix lints
* tidy integrations/event-handler
* fix license
* fix: only populate cloud clients if aws kms configured