Closed KostyaZgara closed 4 years ago
Hi @KostyaZgara
Just went through source code and documentation, and its a limitation in MongoDB Atlas API.
Availability limited to the following regions:
US_EAST_1 US_EAST_2 US_WEST_2 EU_WEST_1 EU_CENTRAL_1 AP_NORTHEAST_1
https://docs.atlas.mongodb.com/reference/api/clusters-create-one/
Terraform Provider is using go-mongodbatlas-client.
@xmariopereira Thank you for an answer. So, it means there no options to add supporting other regions? If I send regionName
in providerSettings
block all works. It's only one missing property, because. Here my request payload and response
As you can see, all works. And mu cluster was created in me-south-1 region
I suppose this issue in go-mongodbatlas-client? Who can help me to add this option? Because I don't know Go language and create PR will take to much time for me :)
Sorry, I didn't read correctly the documentation.
M140 is not available in that Regions. Sorry!!!
Still checking the code it shouldn't error out.
//See more: https://docs.atlas.mongodb.com/reference/api/clusters-create-one/
func (s *ClustersServiceOp) Create(ctx context.Context, groupID string, createRequest *Cluster) (*Cluster, *Response, error) {
if createRequest == nil {
return nil, nil, NewArgError("createRequest", "cannot be nil")
}
path := fmt.Sprintf(clustersPath, groupID)
req, err := s.client.NewRequest(ctx, http.MethodPost, path, createRequest)
if err != nil {
return nil, nil, err
}
root := new(Cluster)
resp, err := s.client.Do(ctx, req, root)
if err != nil {
return nil, resp, err
}
return root, resp, err
}
type Cluster struct {
AutoScaling AutoScaling `json:"autoScaling,omitempty"`
BackupEnabled *bool `json:"backupEnabled,omitempty"`
BiConnector BiConnector `json:"biConnector,omitempty"`
ClusterType string `json:"clusterType,omitempty"`
DiskSizeGB *float64 `json:"diskSizeGB,omitempty"`
EncryptionAtRestProvider string `json:"encryptionAtRestProvider,omitempty"`
Labels []Label `json:"labels,omitempty"`
ID string `json:"id,omitempty"`
GroupID string `json:"groupId,omitempty"`
MongoDBVersion string `json:"mongoDBVersion,omitempty"`
MongoDBMajorVersion string `json:"mongoDBMajorVersion,omitempty"`
MongoURI string `json:"mongoURI,omitempty"`
MongoURIUpdated string `json:"mongoURIUpdated,omitempty"`
MongoURIWithOptions string `json:"mongoURIWithOptions,omitempty"`
Name string `json:"name,omitempty"`
NumShards *int64 `json:"numShards,omitempty"`
Paused *bool `json:"paused,omitempty"`
PitEnabled *bool `json:"pitEnabled,omitempty"`
ProviderBackupEnabled *bool `json:"providerBackupEnabled,omitempty"`
ProviderSettings *ProviderSettings `json:"providerSettings,omitempty"`
ReplicationFactor *int64 `json:"replicationFactor,omitempty"`
ReplicationSpec map[string]RegionsConfig `json:"replicationSpec,omitempty"`
ReplicationSpecs []ReplicationSpec `json:"replicationSpecs,omitempty"`
SrvAddress string `json:"srvAddress,omitempty"`
StateName string `json:"stateName,omitempty"`
}```
type ProviderSettings struct {
BackingProviderName string `json:"backingProviderName,omitempty"`
DiskIOPS *int64 `json:"diskIOPS,omitempty"`
DiskTypeName string `json:"diskTypeName,omitempty"`
EncryptEBSVolume *bool `json:"encryptEBSVolume,omitempty"`
InstanceSizeName string `json:"instanceSizeName,omitempty"`
ProviderName string `json:"providerName,omitempty"`
RegionName string `json:"regionName,omitempty"`
VolumeType string `json:"volumeType,omitempty"`
}
M140 is not available in that Region. Sorry!!!
Okay, if it not available, why I can still create a cluster in that region via curl request? Or I'm something missed?
@KostyaZgara I have one of our developers looking into this (@PacoDw). @xmariopereira thank you so much for providing help here too!
fyi @shum for 👁 while I'm OOO^
Hi! @KostyaZgara and @xmariopereira thank you so much for help sharing essential details, I resolved it on #158 branch, could you check if it's okay?
If you have another comment or concern, just let us know 👍
@PacoDw Thanks for the fast reaction! I really appreciate your work. Could you say me, when approximately the PR would be merged and I can use an updated provider in the terraform?
P.S. Can I close an issue?
Ahhh the regions here hardcoded in the provider.go.
Glad I could help!
Thank you so much! @KostyaZgara The PR will be open due to we are discussing what's implementation is better to leave :S, but I think it will be closed/merged this week or at the beginning of the next week.
Hi again!
I see you released a new version 0.4.1 of MongoDB atlas terraform plugin that should fix the issue with the creation cluster in other regions. But seems it still doesn't work correctly. Here my logs:
2020-03-05T11:48:38.039+0200 [DEBUG] plugin: starting plugin: path=/infrastructure/database/.terraform/plugins/darwin_amd64/terraform-provider-mongodbatlas_v0.4.1_x4 args=[/infrastructure/database/.terraform/plugins/darwin_amd64/terraform-provider-mongodbatlas_v0.4.1_x4]
2020-03-05T11:48:38.044+0200 [DEBUG] plugin: plugin started: path=/infrastructure/database/.terraform/plugins/darwin_amd64/terraform-provider-mongodbatlas_v0.4.1_x4 pid=14729
2020-03-05T11:48:38.044+0200 [DEBUG] plugin: waiting for RPC address: path=/infrastructure/database/.terraform/plugins/darwin_amd64/terraform-provider-mongodbatlas_v0.4.1_x4
2020-03-05T11:48:38.059+0200 [INFO] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: configuring server automatic mTLS: timestamp=2020-03-05T11:48:38.059+0200
2020-03-05T11:48:38.087+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: plugin address: address=/var/folders/f4/k3qn9j2j35ndplwkq7lhrw_w0000gn/T/plugin882298716 network=unix timestamp=2020-03-05T11:48:38.087+0200
2020-03-05T11:48:38.087+0200 [DEBUG] plugin: using plugin: version=5
2020-03-05T11:48:38.159+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: 2020/03/05 11:48:38 [DEBUG] setting computed for "bi_connector" from ComputedKeys
2020-03-05T11:48:38.159+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: 2020/03/05 11:48:38 [DEBUG] setting computed for "plugin" from ComputedKeys
2020-03-05T11:48:38.159+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: 2020/03/05 11:48:38 [DEBUG] setting computed for "advanced_configuration" from ComputedKeys
2020-03-05T11:48:38.159+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: 2020/03/05 11:48:38 [DEBUG] setting computed for "labels" from ComputedKeys
2020-03-05T11:48:38.159+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: 2020/03/05 11:48:38 [DEBUG] setting computed for "replication_specs" from ComputedKeys
2020-03-05T11:48:38.160+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: 2020/03/05 11:48:38 [DEBUG] MongoDB Atlas API Request Details:
2020-03-05T11:48:38.160+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: ---[ REQUEST ]---------------------------------------
2020-03-05T11:48:38.160+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: POST /api/atlas/v1.0/groups/5da9bcf4ff7a259463368a07/clusters HTTP/1.1
2020-03-05T11:48:38.160+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: Host: cloud.mongodb.com
2020-03-05T11:48:38.160+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: User-Agent: go-mongodbatlas0.1
2020-03-05T11:48:38.160+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: Content-Length: 359
2020-03-05T11:48:38.160+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: Accept: application/json
2020-03-05T11:48:38.160+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: Content-Type: application/json
2020-03-05T11:48:38.160+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: Accept-Encoding: gzip
2020-03-05T11:48:38.160+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4:
2020-03-05T11:48:38.160+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: {
2020-03-05T11:48:38.160+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: "autoScaling": {
2020-03-05T11:48:38.160+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: "diskGBEnabled": true
2020-03-05T11:48:38.160+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: },
2020-03-05T11:48:38.160+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: "backupEnabled": false,
2020-03-05T11:48:38.160+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: "biConnector": {},
2020-03-05T11:48:38.160+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: "clusterType": "REPLICASET",
2020-03-05T11:48:38.160+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: "diskSizeGB": 10,
2020-03-05T11:48:38.160+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: "mongoDBMajorVersion": "4.2",
2020-03-05T11:48:38.160+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: "name": "sportstars",
2020-03-05T11:48:38.160+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: "numShards": 1,
2020-03-05T11:48:38.160+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: "pitEnabled": false,
2020-03-05T11:48:38.160+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: "providerBackupEnabled": true,
2020-03-05T11:48:38.160+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: "providerSettings": {
2020-03-05T11:48:38.160+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: "diskIOPS": 100,
2020-03-05T11:48:38.160+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: "encryptEBSVolume": true,
2020-03-05T11:48:38.160+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: "instanceSizeName": "M10",
2020-03-05T11:48:38.160+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: "providerName": "AWS"
2020-03-05T11:48:38.160+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: },
2020-03-05T11:48:38.160+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: "replicationFactor": 3
2020-03-05T11:48:38.160+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: }
2020-03-05T11:48:38.160+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4:
2020-03-05T11:48:38.160+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: -----------------------------------------------------
2020-03-05T11:48:38.973+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: 2020/03/05 11:48:38 [DEBUG] MongoDB Atlas API Response Details:
2020-03-05T11:48:38.973+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: ---[ RESPONSE ]--------------------------------------
2020-03-05T11:48:38.973+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: HTTP/2.0 400 Bad Request
2020-03-05T11:48:38.973+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: Content-Length: 160
2020-03-05T11:48:38.973+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: Content-Type: application/json
2020-03-05T11:48:38.973+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: Date: Thu, 05 Mar 2020 09:48:40 GMT
2020-03-05T11:48:38.973+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: Strict-Transport-Security: max-age=31536000
2020-03-05T11:48:38.973+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: X-Mongodb-Service-Version: gitHash=9b1dcf89d42c0585cbcb8206e5f8619bfd6329a5; versionString=v20200218
2020-03-05T11:48:38.973+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4:
2020-03-05T11:48:38.973+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: {
2020-03-05T11:48:38.973+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: "detail": "The required attribute regionName was not specified.",
2020-03-05T11:48:38.973+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: "error": 400,
2020-03-05T11:48:38.973+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: "errorCode": "MISSING_ATTRIBUTE",
2020-03-05T11:48:38.973+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: "parameters": [
2020-03-05T11:48:38.973+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: "regionName"
2020-03-05T11:48:38.973+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: ],
2020-03-05T11:48:38.973+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: "reason": "Bad Request"
2020-03-05T11:48:38.973+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: }
2020-03-05T11:48:38.973+0200 [DEBUG] plugin.terraform-provider-mongodbatlas_v0.4.1_x4: -----------------------------------------------------
What can be wrong? I have tried to make terraform init -upgrade
multiple times, but the issue doesn't disappear
Edit - I don't think this fix made it in 0.4.1 and will be in our next release. I'm going to test with the master branch @KostyaZgara I tested ME_SOUTH_1 creation and it failed for me as well - however creating it directly via the API did work so it seems the provider is still not working correctly for this region. I apologize for that. @PacoDw and @marinsalinas the fix in 0.4.1 does not seem to work.
@themantissa this is not in the new release, just in master branch.
@PacoDw I realized that right after I posted my reply, apologizes. @KostyaZgara the fix for this will be in 0.4.2 but I will test it to be sure in the current master branch.
@KostyaZgara 0.4.2 is out. You should be good now!
I am trying to create M10 cluster in AWS me-south-1 region but got an error.
Here my request payload in trace mode
And the response from them
My terraform file And plan
Also, I have tried to create cluster in us-east-1 region and them was successful
Seems to terraform provider erase my
regionName
when I setME_SOUTH_1
but why? In documentation mentioned that Mongo Atlas supports me-south-1 regionCan you help me? Thanks in advance!