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

feat: add contact_email to equinix_metal_connection datasource and resource #412

Conversation

displague
Copy link
Member

@displague displague commented Oct 13, 2023

fixes #340

note:

  • contact_email should be updatable but packngo does not offer the update field. Defining the field as ForceNew until this resource is rewritten with metal-go packngo is deprecated. Use equinix-sdk-go #402
  • e2e between the zside and shared test, we should have coverage that contact_email is optional and will be read back in as computed or as given. We are not adding a test that requires a project api key to trigger the backend required behavior.

@displague displague linked an issue Oct 13, 2023 that may be closed by this pull request
@displague displague temporarily deployed to internal October 13, 2023 22:58 — with GitHub Actions Inactive
@@ -221,6 +228,11 @@ func resourceMetalConnectionCreate(d *schema.ResourceData, meta interface{}) err
Type: connType,
}

// missing email is tolerated for user keys (can't be reasonably detected)
if contactEmail, ok := d.GetOk("contact_email"); ok {
Copy link
Member Author

Choose a reason for hiding this comment

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

nit: this doesn't match the ok pattern elsewhere

@displague displague temporarily deployed to internal October 13, 2023 23:08 — with GitHub Actions Inactive
@displague displague requested a review from t0mk October 13, 2023 23:09
@displague displague requested a deployment to internal October 16, 2023 14:26 — with GitHub Actions Abandoned
Copy link
Contributor

@ctreatma ctreatma left a comment

Choose a reason for hiding this comment

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

I had one small nit but I see that the relevant tests pass, so this is good to go as far as I'm concerned.

@@ -118,6 +121,7 @@ The following arguments are supported:
* `facility` - (**Deprecated**) Facility where the connection will be created. Use metro instead; read the [facility to metro migration guide](https://registry.terraform.io/providers/equinix/equinix/latest/docs/guides/migration_guide_facilities_to_metros_devices)
* `redundancy` - (Required) Connection redundancy - redundant or primary.
* `type` - (Required) Connection type - dedicated or shared.
* `contact_email` - (Required) The preferred email used for communication and notifications about the Equinix Fabric interconnection. Required when using a Project API key. Optional and defaults to the primary user email address when using a User API key.
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I'm not totally sold on labeling this (Required), since it isn't always required; it looks like we went the opposite way with project_id, which is marked (Optional).

Copy link
Member Author

Choose a reason for hiding this comment

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

Fair enough. I'll merge and change that in a subsequent PR so as not to offend the pass status on tests.

@displague displague merged commit 88d0411 into main Oct 16, 2023
6 of 7 checks passed
@displague displague deleted the 340-equinix_metal_connection-should-support-api-field-contact_email branch October 16, 2023 16:53
ctreatma pushed a commit that referenced this pull request Oct 16, 2023
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.

equinix_metal_connection should support API field contact_email
2 participants