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-939: [Terraform] Feature Add: Shared-Tier Snapshots #1323

Merged
merged 21 commits into from
Jul 21, 2023

Conversation

andreaangiolillo
Copy link
Collaborator

@andreaangiolillo andreaangiolillo commented Jul 17, 2023

Description

Ticket: INTMDB-939
This PR adds support to mongodbatlas_shared_tier_snapshot and mongodbatlas_shared_tier_snapshots

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 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

Tested Locally

terraform state show data.mongodbatlas_shared_tier_snapshot.test

# data.mongodbatlas_shared_tier_snapshot.test:
data "mongodbatlas_shared_tier_snapshot" "test" {
    cluster_name     = "Cluster0"
    expiration       = "2023-07-26 07:30:47 +0000 UTC"
    finish_time      = "2023-07-18 07:33:54 +0000 UTC"
    id               = "64b63fb50288d52922020d24"
    mongo_db_version = "6.0.8"
    project_id       = "63dcfc256af00a5934e60924"
    scheduled_time   = "2023-07-18 07:30:47 +0000 UTC"
    snapshot_id      = "64b63fb50288d52922020d24"
    start_time       = "2023-07-18 07:31:07 +0000 UTC"
    status           = "COMPLETED"
}
terraform state show data.mongodbatlas_shared_tier_snapshots.test
# data.mongodbatlas_shared_tier_snapshots.test:
data "mongodbatlas_shared_tier_snapshots" "test" {
    cluster_name = "Cluster0"
    id           = "terraform-20230718091336580300000001"
    project_id   = "63dcfc256af00a5934e60924"
    results      = [
        {
            expiration       = "2023-07-26 07:30:47 +0000 UTC"
            finish_time      = "2023-07-18 07:33:54 +0000 UTC"
            mongo_db_version = "6.0.8"
            scheduled_time   = "2023-07-18 07:30:47 +0000 UTC"
            snapshot_id      = "64b63fb50288d52922020d24"
            start_time       = "2023-07-18 07:31:07 +0000 UTC"
            status           = "COMPLETED"
        },
    ]
    total_count  = 1
}

@andreaangiolillo andreaangiolillo marked this pull request as ready for review July 19, 2023 11:14
@andreaangiolillo andreaangiolillo requested a review from a team as a code owner July 19, 2023 11:14
Copy link
Collaborator

@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.

Few doc comments, otherwise LGTM

andreaangiolillo and others added 4 commits July 20, 2023 08:12
Co-authored-by: Zuhair Ahmed <zuhair.ahmed@mongodb.com>
Co-authored-by: Zuhair Ahmed <zuhair.ahmed@mongodb.com>
Co-authored-by: Zuhair Ahmed <zuhair.ahmed@mongodb.com>
Co-authored-by: Zuhair Ahmed <zuhair.ahmed@mongodb.com>
@andreaangiolillo andreaangiolillo requested a review from a team July 20, 2023 06:13
func dataSourceMongoDBAtlasSharedTierSnapshot() *schema.Resource {
return &schema.Resource{
ReadContext: dataSourceMongoDBAtlasSharedTierSnapshotRead,
Schema: map[string]*schema.Schema{
Copy link
Member

Choose a reason for hiding this comment

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

FYI - We could easily generate initial schemas for developers to adapt them in the future.
We have that capability in the SDK - just need to adjust it to your needs.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Could you share more details about it? A link to the SDK codebase where I can look at would be enough. Thanks!

Copy link
Member

Choose a reason for hiding this comment

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

I missed that comment.
We have a doc for using custom templates:

https://github.com/mongodb/atlas-sdk-go/blob/main/tools/CONTRIBUTING.md#generating-custom-files

We can generate some level of boilerplate for the team like TF schemas.
We can release it under separate module or package.

@andreaangiolillo andreaangiolillo merged commit f308aea into master Jul 21, 2023
17 checks passed
@andreaangiolillo andreaangiolillo deleted the INTMDB-939 branch July 21, 2023 08:20
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.

None yet

4 participants