Skip to content

feat: Adds support for region & customer_endpoint_dns_name in privatelink #1982

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

Merged

Conversation

EspenAlbert
Copy link
Collaborator

@EspenAlbert EspenAlbert commented Mar 1, 2024

Description

Adds support for region & customer_endpoint_dns_name in privatelinkendpointservicedatafederationonlinearchive.
Also, enables editing of the comment attribute.

Link to any related issue(s): CLOUDP-229354
GH Issue: #1878

Type of change:

  • Bug fix (non-breaking change which fixes an issue). Please, add the "bug" label to the PR.
  • New feature (non-breaking change which adds functionality). Please, add the "enhancement" label to the PR.
  • Breaking change (fix or feature that would cause existing functionality to not work as expected). Please, add the "breaking change" label to the PR.
  • This change requires a documentation update
  • Documentation fix/enhancement

Required Checklist:

  • I have signed the MongoDB CLA
  • I have read the contribution guidelines
  • I have checked that this change does not generate any credentials and that they are NOT accidentally logged anywhere.
  • I have added tests that prove my fix is effective or that my feature works per HashiCorp requirements
  • I have added any necessary documentation (if appropriate)
  • I have run make fmt and formatted my code
  • If changes include deprecations or removals, I defined an isolated PR with a relevant title as it will be used in the auto-generated changelog.
  • If changes include removal or addition of 3rd party GitHub actions, I updated our internal document. Reach out to the APIx Integration slack channel to get access to the internal document.

Further comments

Minimal setup for testing manually:

variable "project_id" {
  type = string
}

variable "vpc_id" {
  type = string 
}

variable "subnet_ids" {
  type = list(string)
}
variable "security_group_ids" {
  type = list(string)
}

resource "aws_vpc_endpoint" "vpce_east" {
  vpc_id             = var.vpc_id
  service_name       = "com.amazonaws.vpce.us-east-1.vpce-svc-0a7247db33497082e" #see screenshot below
  vpc_endpoint_type  = "Interface"
  subnet_ids         = var.subnet_ids
  security_group_ids = var.security_group_ids
}

resource "mongodbatlas_privatelink_endpoint_service_data_federation_online_archive" "test" {
  project_id    = var.project_id
  endpoint_id   = aws_vpc_endpoint.vpce_east.id
  provider_name = "AWS"

  comment       = "Terraform Acceptance Test Manual"
  region        = "US_EAST_1"
  customer_endpoint_dns_name = aws_vpc_endpoint.vpce_east.dns_entry[0].dns_name
}
output "vpc_endpoint_id" {
  value = aws_vpc_endpoint.vpce_east.id
}

How to find the service_name:

image

After creating the resource in the Atlas UI:

image

Running CI tests locally:

export MONGODB_ATLAS_LAST_VERSION="1.15.1"
export MONGODB_ATLAS_PRIVATE_ENDPOINT_ID={OUTPUTS.vpc_endpoint_id}
go test -timeout 2400s -run ^(TestAccNetworkPrivatelinkEndpointServiceDataFederationOnlineArchivesDSPlural_basic|TestAccMigrationNetworkPrivatelinkEndpointServiceDataFederationOnlineArchive_basic|TestAccNetworkPrivatelinkEndpointServiceDataFederationOnlineArchive_basic|TestAccNetworkPrivatelinkEndpointServiceDataFederationOnlineArchive_updateComment|TestAccNetworkPrivatelinkEndpointServiceDataFederationOnlineArchive_basicWithRegionDnsName|TestAccNetworkPrivatelinkEndpointServiceDataFederationOnlineArchiveDS_basic)$ github.com/mongodb/terraform-provider-mongodbatlas/internal/service/privatelinkendpointservicedatafederationonlinearchive -count=1 -v

image

@EspenAlbert EspenAlbert changed the title privatelink: region-customerEndpointDNSName-params feat: add support for region & customer_endpoint_dns_name in privatelink Mar 1, 2024
@EspenAlbert EspenAlbert changed the title feat: add support for region & customer_endpoint_dns_name in privatelink feat: Add support for region & customer_endpoint_dns_name in privatelink Mar 1, 2024
@EspenAlbert EspenAlbert force-pushed the CLOUDP-229354-region-customerEndpointDNSName-params branch from b14634a to 8252f58 Compare March 4, 2024 10:32
@EspenAlbert EspenAlbert marked this pull request as ready for review March 5, 2024 15:40
@EspenAlbert EspenAlbert requested a review from a team as a code owner March 5, 2024 15:40
@EspenAlbert EspenAlbert changed the title feat: Add support for region & customer_endpoint_dns_name in privatelink feat: Adds support for region & customer_endpoint_dns_name in privatelink Mar 6, 2024
Copy link
Member

@lantoli lantoli left a comment

Choose a reason for hiding this comment

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

LGTM, just a couple of minor comments

Copy link
Contributor

@Zuhairahmed Zuhairahmed left a comment

Choose a reason for hiding this comment

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

Left a few comments, questions, and made a few commits directly to this PR. I don't need to review again, overall great first PR @EspenAlbert!

Need to support testing in different environments and value should be set based on the vpc endpoint created outside the test.
…pdate examples with actual example values instead of placeholders
Copy link
Collaborator

@maastha maastha left a comment

Choose a reason for hiding this comment

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

LGTM

project_id = var.project_id
endpoint_id = aws_vpc_endpoint.vpce_east.id
provider_name = "AWS"
comment = "Terraform Acceptance Test"
Copy link
Member

Choose a reason for hiding this comment

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

knitpit: i would change this comment as it's in the example folder and it's intended to be used by customers as a template, e.g.: "Example of data federation online archive"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated in d62a3ae 👍

@EspenAlbert EspenAlbert merged commit f899b80 into master Mar 8, 2024
@EspenAlbert EspenAlbert deleted the CLOUDP-229354-region-customerEndpointDNSName-params branch March 8, 2024 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants