Skip to content

Conversation

@Gnoale
Copy link
Contributor

@Gnoale Gnoale commented May 16, 2025

As a user bring recently, in most of the modules, we ignore the project_id parameter set at the provider level in some cases, because the environment takes precedence over the provider config here

partly fixes #3068

The provider configuration should probably override other configuration sources but this could be impactful / breaking for users used to provide environment variables

The change imply to explicitly find a project_id at the resource / client level and raise an error if not found, instead of relying on the SDK logic to eventually find it or use an empty string in some cases.

=> Now when running the test in CI, we need to inject a project ID in the meta configuration.

But this reveal another corner case: resources calling HTTP GET query with the optional project_id parameter that where not using it, namespace container datasource for instance, are now using the fake project_id set in the test suite (&project_id=1111111).
So we strip this parameter from the query to address these kind of cases

@github-actions github-actions bot added rdb Managed MySQL and PostgreSQL issues, bugs and feature requests load-balancer Load-balancer issues, bugs and feature requests k8s Kubernetes Kapsule issues, bugs and feature requests instance Instance issues, bugs and feature requests domain Domains issues, bugs and feature requests registry Managed Container Registry issues, bugs and feature requests container Container issues, bugs and feature requests vpc Virtual Private Cloud (VPC) issues, bugs and feature requests apple-silicon Apple Silicon issues, bugs and feature requests flexible-ip Flexible IP issues, bugs and feature requests iot IoT issues, bugs and feature requests function Serverless function issues, bugs and feature requests redis Managed Redis issues, bugs and feature requests iam IAM issues, bugs and feature requests tem Transactional Email issues, bugs and feature requests mnq Messaging and queuing issues, bugs and feature requests webhosting Webhosting issues, bugs and feature requests billing Billing issues, bugs and feature requests secret Managed Secret Manager issues, bugs and feature requests baremetal vpcgw sdb labels May 16, 2025
@Gnoale Gnoale force-pushed the provider-projectids branch 2 times, most recently from ee3784b to 4d8374a Compare May 19, 2025 12:36
@Gnoale Gnoale removed rdb Managed MySQL and PostgreSQL issues, bugs and feature requests load-balancer Load-balancer issues, bugs and feature requests k8s Kubernetes Kapsule issues, bugs and feature requests instance Instance issues, bugs and feature requests domain Domains issues, bugs and feature requests registry Managed Container Registry issues, bugs and feature requests labels May 19, 2025
@Gnoale Gnoale removed function Serverless function issues, bugs and feature requests redis Managed Redis issues, bugs and feature requests iam IAM issues, bugs and feature requests tem Transactional Email issues, bugs and feature requests mnq Messaging and queuing issues, bugs and feature requests webhosting Webhosting issues, bugs and feature requests billing Billing issues, bugs and feature requests secret Managed Secret Manager issues, bugs and feature requests baremetal vpcgw sdb labels May 19, 2025
@Gnoale Gnoale marked this pull request as ready for review May 19, 2025 12:40
@Gnoale Gnoale requested a review from a team as a code owner May 19, 2025 12:40
@Gnoale Gnoale force-pushed the provider-projectids branch from 4d8374a to 9a5e157 Compare May 19, 2025 12:41
@Gnoale Gnoale changed the title Use meta.ExtractProjectID everywhere use project_id from provider configuration May 19, 2025
@Gnoale Gnoale changed the title use project_id from provider configuration (container): use project_id from provider configuration May 19, 2025
@Gnoale Gnoale changed the title (container): use project_id from provider configuration container: use project_id from provider configuration May 19, 2025
if !ok {
containerName := d.Get("name").(string)

projectID, _, err := meta.ExtractProjectID(d, m)
Copy link
Member

Choose a reason for hiding this comment

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

Is there a way to ensure that it is taken into account with a test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the test would break without the ForceProjectID in meta.Config

@Gnoale Gnoale force-pushed the provider-projectids branch from 917a68d to d27a4ac Compare May 19, 2025 14:05
@Gnoale Gnoale requested a review from a team as a code owner May 20, 2025 09:07
@github-actions github-actions bot added account Account issues, bugs and feature requests billing Billing issues, bugs and feature requests labels May 20, 2025
@Gnoale Gnoale force-pushed the provider-projectids branch 2 times, most recently from 29f5548 to d525d9f Compare May 20, 2025 13:09
@Gnoale Gnoale force-pushed the provider-projectids branch from d525d9f to 85426a2 Compare May 20, 2025 13:26
@Gnoale
Copy link
Contributor Author

Gnoale commented May 21, 2025

Closing for now

@Gnoale Gnoale closed this May 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

account Account issues, bugs and feature requests billing Billing issues, bugs and feature requests container Container issues, bugs and feature requests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

container_namespace should infer project_id from provider but doesn't

3 participants