Skip to content

Commit

Permalink
INTMDB-183: Migrate to TF SDK 2 (#489)
Browse files Browse the repository at this point in the history
* initial migrate sdk v2

* refactor: deleted maxitems for datasource because it's bad practice for make test

* refactor: changed typemap to typelist for datasource and resources because it's bad practice for make test and not supported in sdk v2

* refactor: changed Provider to ProviderFactories in tests

* updated name of funcs for sdk v2

* refactor: changed Provider to ProviderFactories in tests

* refactor: get the old fields of typemap because of possibly of future issues related to state

* docs: updated upgrade guide for migration

* fixes bug

* fixes linter

* fixes linter

* fixes linter

* fixes bug for restore job

* fixes bug

* refactor: changed create without timeout to normal

* refactor: changed to context without timeout for cluster resource since it can take a while usually depending of the case

* fix: fixes some testacc

* fixes linter

* docs: updated changes suggested by melissa

* refactor: made changes suggested by tony

* migrated event triggers

* fix: random error related to client

* fixes import for search

Co-authored-by: Edgar Lopez <[email protected]>
  • Loading branch information
coderGo93 and Edgar Lopez authored Jul 27, 2021
1 parent 0008dcd commit 1fcff25
Show file tree
Hide file tree
Showing 173 changed files with 3,830 additions and 2,569 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/automated-test-acceptances.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.14
go-version: 1.16
- name: Acceptance Tests
env:
SKIP_TEST_EXTERNAL_CREDENTIALS: ${{ secrets.SKIP_TEST_EXTERNAL_CREDENTIALS }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/automated-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.14
go-version: 1.16
- name: Code Lint
run: make tools && make lint
- name: Website
Expand Down
4 changes: 2 additions & 2 deletions examples/atlas-cloud-provider-access/aws/aws-roles.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ resource "aws_iam_role" "test_role" {
{
"Effect": "Allow",
"Principal": {
"AWS": "${mongodbatlas_cloud_provider_access_setup.setup_only.aws.atlas_aws_account_arn}"
"AWS": "${mongodbatlas_cloud_provider_access_setup.setup_only.aws.0.atlas_aws_account_arn}"
},
"Action": "sts:AssumeRole",
"Condition": {
"StringEquals": {
"sts:ExternalId": "${mongodbatlas_cloud_provider_access_setup.setup_only.aws.atlas_assumed_role_external_id}"
"sts:ExternalId": "${mongodbatlas_cloud_provider_access_setup.setup_only.aws.0.atlas_assumed_role_external_id}"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion examples/atlas-cloud-provider-access/aws/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ resource "mongodbatlas_cloud_provider_access_authorization" "auth_role" {
project_id = var.project_id
role_id = mongodbatlas_cloud_provider_access_setup.setup_only.role_id

aws = {
aws {
iam_assumed_role_arn = aws_iam_role.test_role.arn
}
}
4 changes: 2 additions & 2 deletions examples/atlas-dataLake-roles/aws-roles.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ resource "aws_iam_role" "test_role" {
{
"Effect": "Allow",
"Principal": {
"AWS": "${mongodbatlas_cloud_provider_access_setup.setup_only.aws.atlas_aws_account_arn}"
"AWS": "${mongodbatlas_cloud_provider_access_setup.setup_only.aws.0.atlas_aws_account_arn}"
},
"Action": "sts:AssumeRole",
"Condition": {
"StringEquals": {
"sts:ExternalId": "${mongodbatlas_cloud_provider_access_setup.setup_only.aws.atlas_assumed_role_external_id}"
"sts:ExternalId": "${mongodbatlas_cloud_provider_access_setup.setup_only.aws.0.atlas_assumed_role_external_id}"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions examples/atlas-dataLake-roles/import/aws-roles.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ resource "aws_iam_role" "test_role" {
{
"Effect": "Allow",
"Principal": {
"AWS": "${mongodbatlas_cloud_provider_access_setup.setup_only.aws.atlas_aws_account_arn}"
"AWS": "${mongodbatlas_cloud_provider_access_setup.setup_only.aws.0.atlas_aws_account_arn}"
},
"Action": "sts:AssumeRole",
"Condition": {
"StringEquals": {
"sts:ExternalId": "${mongodbatlas_cloud_provider_access_setup.setup_only.aws.atlas_assumed_role_external_id}"
"sts:ExternalId": "${mongodbatlas_cloud_provider_access_setup.setup_only.aws.0.atlas_assumed_role_external_id}"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion examples/atlas-dataLake-roles/import/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ resource "mongodbatlas_cloud_provider_access_authorization" "auth_role" {
project_id = mongodbatlas_project.test.id
role_id = mongodbatlas_cloud_provider_access_setup.setup_only.role_id

aws = {
aws {
iam_assumed_role_arn = aws_iam_role.test_role.arn
}
}
Expand Down
2 changes: 1 addition & 1 deletion examples/atlas-dataLake-roles/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ resource "mongodbatlas_cloud_provider_access_authorization" "auth_role" {
project_id = mongodbatlas_project.test.id
role_id = mongodbatlas_cloud_provider_access_setup.setup_only.role_id

aws = {
aws {
iam_assumed_role_arn = aws_iam_role.test_role.arn
}
}
Expand Down
4 changes: 2 additions & 2 deletions examples/atlas-encryption-at-rest/aws/aws-roles.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ resource "aws_iam_role" "test_role" {
{
"Effect": "Allow",
"Principal": {
"AWS": "${mongodbatlas_cloud_provider_access_setup.setup_only.aws.atlas_aws_account_arn}"
"AWS": "${mongodbatlas_cloud_provider_access_setup.setup_only.aws.0.atlas_aws_account_arn}"
},
"Action": "sts:AssumeRole",
"Condition": {
"StringEquals": {
"sts:ExternalId": "${mongodbatlas_cloud_provider_access_setup.setup_only.aws.atlas_assumed_role_external_id}"
"sts:ExternalId": "${mongodbatlas_cloud_provider_access_setup.setup_only.aws.0.atlas_assumed_role_external_id}"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion examples/atlas-encryption-at-rest/aws/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ resource "mongodbatlas_cloud_provider_access_authorization" "auth_role" {
project_id = var.project_id
role_id = mongodbatlas_cloud_provider_access_setup.setup_only.role_id

aws = {
aws {
iam_assumed_role_arn = aws_iam_role.test_role.arn
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ resource "mongodbatlas_cloud_provider_snapshot_restore_job" "test" {
project_id = data.mongodbatlas_project.test.id
cluster_name = mongodbatlas_cloud_provider_snapshot.test.cluster_name
snapshot_id = mongodbatlas_cloud_provider_snapshot.test.id
delivery_type = {
delivery_type {
download = true
}
}
Expand Down
9 changes: 5 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
module github.com/mongodb/terraform-provider-mongodbatlas

go 1.14
go 1.16

require (
github.com/client9/misspell v0.3.4
github.com/go-test/deep v1.0.7
github.com/gruntwork-io/terratest v0.32.20
github.com/hashicorp/terraform-plugin-sdk v1.14.0
github.com/hashicorp/hcl/v2 v2.10.0 // indirect
github.com/hashicorp/terraform-plugin-sdk/v2 v2.7.0
github.com/hashicorp/terraform-provider-google v1.20.1-0.20210625223728-379bcb41c06b
github.com/mongodb-forks/digest v1.0.1
github.com/mwielbut/pointy v1.1.0
github.com/spf13/cast v1.3.1
github.com/terraform-providers/terraform-provider-aws v1.60.1-0.20200518153306-40099de47e37
github.com/terraform-providers/terraform-provider-google v1.20.1-0.20200518165017-1dd21651c496
github.com/terraform-providers/terraform-provider-aws v1.60.1-0.20210625132053-af2d5c0ad54f
go.mongodb.org/atlas v0.10.0
go.mongodb.org/realm v0.0.0-20210618220639-e70c919266f2
)
Loading

0 comments on commit 1fcff25

Please sign in to comment.