-
Notifications
You must be signed in to change notification settings - Fork 178
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
doc: Updates examples & docs that use replicaSet clusters #2428
Changes from 25 commits
0e6a89f
f148ae7
6ea079e
28e4c82
47886df
c8fb713
2bffd43
837cf4f
5d918bf
164f644
3db3316
9976946
4cfb163
744f4c7
fce2f18
e53b7fa
945057e
f48f5b2
5c310e4
54a5751
87da7b7
f56d1c8
2401ec9
bb71c4a
c350caa
115180e
63c97b8
8ecaf0f
cf4327e
c5043a0
e27302a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"problemMatcher": [ | ||
{ | ||
"owner": "tflint-compact", | ||
"severity": "warning", | ||
"pattern": [ | ||
{ | ||
"regexp": "^(.+):(\\d+):(\\d+):\\s(Error|Warning|Notice)\\s-\\s(.+)\\s\\((.+)\\)$", | ||
"file": 1, | ||
"line": 2, | ||
"column": 3, | ||
"severity": 4, | ||
"message": 5, | ||
"code": 6 | ||
} | ||
] | ||
} | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,52 +15,27 @@ env: | |
jobs: | ||
tf-validate: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
terraform_version: ["${{vars.TF_VERSION_LATEST}}"] | ||
permissions: {} | ||
steps: | ||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 | ||
with: | ||
fetch-depth: 0 | ||
- run: echo "GO_VERSION=$(cat .go-version)" >> "${GITHUB_ENV}" | ||
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 | ||
with: | ||
go-version-file: 'go.mod' | ||
- name: go build | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. make it easier to run TF validate in local, so no magic is done in GH Actions and everything happens in the script |
||
run: go build -o terraform-plugin-dir/terraform-provider-mongodbatlas-dev_v99.99.99_x5 . | ||
- name: override plugin | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you clarify how the override of our provider is handled now? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it uses the recommended way: https://developer.hashicorp.com/terraform/cli/config/config-file#development-overrides-for-provider-developers (i've also added the info in the PR description) |
||
run: | | ||
# For newer versions | ||
mkdir -p ~/.terraform.d/plugins/registry.terraform.io/hashicorp/mongodbatlas-dev/99.99.99/"$(go env GOOS)"_"$(go env GOARCH)"/ | ||
cp terraform-plugin-dir/terraform-provider-mongodbatlas-dev_v99.99.99_x5 ~/.terraform.d/plugins/registry.terraform.io/hashicorp/mongodbatlas-dev/99.99.99/"$(go env GOOS)"_"$(go env GOARCH)"/ | ||
- name: replace names of provider for local development | ||
run: grep --include=\*versions.tf -rnl './examples' -e 'source = "mongodb/mongodbatlas"' | xargs sed -i s@mongodb/mongodbatlas@hashicorp/mongodbatlas-dev@g | ||
- name: remove version of provider for local development | ||
run: grep --include=\*versions.tf -rnl './examples' -e 'version =' | xargs sed -i '/^\s*version =/d' | ||
- name: Fix format after substitutions | ||
run: grep --include=\*versions.tf -rnl './examples' -e 'source[[:space:]]\+=' | xargs sed -i 's@\(\([[:space:]]*\)source\)[[:space:]]\+=[[:space:]]*@\2source = @g' | ||
- uses: hashicorp/setup-terraform@651471c36a6092792c552e8b1bef71e592b462d8 | ||
with: | ||
terraform_version: ${{ matrix.terraform_version }} | ||
# Needed to use the output of `terraform validate -json` | ||
terraform_version: ${{ vars.TF_VERSION_LATEST }} | ||
terraform_wrapper: false | ||
- name: tf-validate | ||
run: make tools tf-validate | ||
tflint: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
terraform_version: ["${{vars.TF_VERSION_LATEST}}"] | ||
permissions: {} | ||
steps: | ||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 | ||
with: | ||
go-version-file: 'go.mod' | ||
- name: tflint | ||
run: make tools tflint | ||
run: | | ||
echo "::add-matcher::.github/tflint-matcher.json" | ||
make tools tflint |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ terraform.tfplan | |
terraform.tfstate | ||
.terraform.lock.hcl | ||
bin/ | ||
bin-examples/ | ||
/pkg/ | ||
.vagrant/ | ||
*.backup | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# Data Source: mongodbatlas_clusters | ||
|
||
`mongodbatlas_cluster` describes all Advanced Clusters by the provided project_id. The data source requires your Project ID. | ||
`mongodbatlas_advanced_cluster` describes all Advanced Clusters by the provided project_id. The data source requires your Project ID. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. header for adv_cluster plural ds was wrong |
||
|
||
-> **NOTE:** Groups and projects are synonymous terms. You may find group_id in the official documentation. | ||
|
||
|
@@ -11,7 +11,7 @@ | |
## Example Usage | ||
|
||
```terraform | ||
resource "mongodbatlas_cluster" "example" { | ||
resource "mongodbatlas_advanced_cluster" "example" { | ||
project_id = "<YOUR-PROJECT-ID>" | ||
name = "cluster-test" | ||
cluster_type = "REPLICASET" | ||
|
@@ -29,8 +29,8 @@ resource "mongodbatlas_cluster" "example" { | |
} | ||
} | ||
|
||
data "mongodbatlas_clusters" "example" { | ||
project_id = mongodbatlas_cluster.example.project_id | ||
data "mongodbatlas_advanced_clusters" "example" { | ||
project_id = mongodbatlas_advanced_cluster.example.project_id | ||
} | ||
``` | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ terraform { | |
required_providers { | ||
mongodbatlas = { | ||
source = "mongodb/mongodbatlas" | ||
version = "~> 1.13.2" | ||
version = "~> 1.0" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so it can run with the current provider (version >= 1, < 2) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is it possible that for versions below 1.13.2 this examples does not work? Cant recall in what version we made changes to the pak resources. |
||
} | ||
} | ||
required_version = ">= 1.0" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,22 @@ | ||
resource "mongodbatlas_cluster" "cluster" { | ||
project_id = mongodbatlas_project.project1.id | ||
name = "MongoDB_Atlas" | ||
mongo_db_major_version = "7.0" | ||
cluster_type = "REPLICASET" | ||
resource "mongodbatlas_advanced_cluster" "cluster" { | ||
project_id = mongodbatlas_project.project1.id | ||
name = "MongoDB_Atlas" | ||
cluster_type = "REPLICASET" | ||
backup_enabled = true | ||
|
||
replication_specs { | ||
num_shards = 1 | ||
regions_config { | ||
region_name = var.region | ||
electable_nodes = 3 | ||
priority = 7 | ||
read_only_nodes = 0 | ||
region_configs { | ||
priority = 7 | ||
provider_name = "AWS" | ||
region_name = var.region | ||
electable_specs { | ||
instance_size = "M10" | ||
node_count = 3 | ||
} | ||
} | ||
} | ||
# Provider Settings "block" | ||
cloud_backup = true | ||
auto_scaling_disk_gb_enabled = true | ||
provider_name = "AWS" | ||
disk_size_gb = 10 | ||
provider_instance_size_name = "M10" | ||
} | ||
|
||
output "atlasclusterstring" { | ||
value = mongodbatlas_cluster.cluster.connection_strings | ||
value = mongodbatlas_advanced_cluster.cluster.connection_strings | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to show TF linter errors in GH UI