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

INTMDB-198: Fixes a bug where it appears empty private endpoint in cluster #481

Merged
merged 4 commits into from
Jun 28, 2021

Conversation

coderGo93
Copy link
Contributor

@coderGo93 coderGo93 commented Jun 24, 2021

Description

  • Added a refresh state for cluster when it can wait for private endpoint to be available if will be used if the provider name is AWS or AZURE with 10 minutes as timeout in datasource of cluster.

This was tested manually because in issue, was using an existing cluster with datasource.

The example is the same in folder /examples/aws-atlas-privatelink with small modifications in file atlas-cluster.tf like this

data "mongodbatlas_cluster" "cluster-atlas" {
  project_id                   = var.atlasprojectid
  name                         = "cluster-atlas"
  depends_on                   = [mongodbatlas_private_endpoint_interface_link.atlaseplink]
}

output "atlasclusterstring" {
  value = data.mongodbatlas_cluster.cluster-atlas.connection_strings
}
output "plstring" {
  value = lookup(data.mongodbatlas_cluster.cluster-atlas.connection_strings[0].aws_private_link_srv, aws_vpc_endpoint.ptfe_service.id)
}

The results are OK after waiting for data.mongodbatlas_cluster.cluster-atlas, it took between 3-5 min

Apply complete! Resources: 9 added, 0 changed, 0 destroyed.

Outputs:

atlasclusterstring = tolist([
  {
    "aws_private_link" = tomap({
      "vpce-0ecdf684cbe5b980a" = "mongodb://pl-0-us-east-1.fg84w.mongodb.net:1108,pl-0-us-east-1.fg84w.mongodb.net:1109,pl-0-us-east-1.fg84w.mongodb.net:1110/?ssl=true&authSource=admin&replicaSet=atlas-2hsx2e-shard-0"
    })
    "aws_private_link_srv" = tomap({
      "vpce-0ecdf684cbe5b980a" = "mongodb+srv://cluster-atlas-pl-0.fg84w.mongodb.net"
    })
    "private" = ""
    "private_endpoint" = tolist([
      {
        "connection_string" = "mongodb://pl-0-us-east-1.fg84w.mongodb.net:1108,pl-0-us-east-1.fg84w.mongodb.net:1109,pl-0-us-east-1.fg84w.mongodb.net:1110/?ssl=true&authSource=admin&replicaSet=atlas-2hsx2e-shard-0"
        "endpoints" = tolist([
          {
            "endpoint_id" = "vpce-0ecdf684cbe5b980a"
            "provider_name" = "AWS"
            "region" = "US_EAST_1"
          },
        ])
        "srv_connection_string" = "mongodb+srv://cluster-atlas-pl-0.fg84w.mongodb.net"
        "type" = "MONGOD"
      },
    ])
    "private_srv" = ""
    "standard" = "mongodb://cluster-atlas-shard-00-00.fg84w.mongodb.net:27017,cluster-atlas-shard-00-01.fg84w.mongodb.net:27017,cluster-atlas-shard-00-02.fg84w.mongodb.net:27017/?ssl=true&authSource=admin&replicaSet=atlas-2hsx2e-shard-0"
    "standard_srv" = "mongodb+srv://cluster-atlas.fg84w.mongodb.net"
  },
])
plstring = "mongodb+srv://cluster-atlas-pl-0.fg84w.mongodb.net"

Link to any related issue(s):
#422

Type of change:

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

Required Checklist:

  • I have signed the MongoDB CLA
  • I have read the Terraform contribution guidelines
  • 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

Further comments

@themantissa themantissa requested review from a team, andreaangiolillo and threebee and removed request for andreaangiolillo and a team June 24, 2021 23:39
@themantissa
Copy link
Collaborator

@threebee I added you since the APIx group added Andrea who is OOO. Hope this is okay! If not feel free to reassign.

Copy link
Collaborator

@themantissa themantissa left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link

@threebee threebee left a comment

Choose a reason for hiding this comment

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

LGTM!

@themantissa
Copy link
Collaborator

@coderGo93 I talked with Chris who works with private link quite a bit and he feels Azure should be given the same amount of time. Can we do this for both providers?

@coderGo93
Copy link
Contributor Author

Hi @themantissa , just updated validation so it can be refreshed if the provider is azure or aws

@coderGo93 coderGo93 requested a review from themantissa June 25, 2021 15:28
Copy link
Contributor

@thetonymaster thetonymaster left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@themantissa themantissa left a comment

Choose a reason for hiding this comment

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

LGTM, thank you for the add.

@coderGo93 coderGo93 added the run-testacc To run acceptance tests label Jun 28, 2021
@coderGo93 coderGo93 merged commit a5756de into master Jun 28, 2021
@coderGo93 coderGo93 deleted the INTMDB-198 branch June 28, 2021 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
run-testacc To run acceptance tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants