Giter VIP home page Giter VIP logo

Comments (6)

bobhlo avatar bobhlo commented on June 3, 2024 1

@PacoDw , thanks for the fix. The issue is resolved.

from terraform-provider-mongodbatlas.

PacoDw avatar PacoDw commented on June 3, 2024

Hello @bobhlo thanks for your review, could you share us your terraform configuration to recreate the issue? just avoiding sensitive information.

from terraform-provider-mongodbatlas.

bobhlo avatar bobhlo commented on June 3, 2024

Hi @PacoDw,

Please see following configuration in the module. One thing noted is terraform tried to update resource "mongodbatlas_network_peering.rest" with atlas_cidr_block which was not changed.

module.dev_jcdigital_test345_atlas.mongodbatlas_network_peering.rest will be updated in-place

~ resource "mongodbatlas_network_peering" "rest" {
+ atlas_cidr_block = "192.168.32.0/24"
atlas_id = ""
azure_directory_id = ""
azure_subscription_id = ""
container_id = ""
id = ""
peer_id = ""
project_id = ""
provider_name = "AZURE"
resource_group_name = "dev-jcdigital-test345-rg"
status = "AVAILABLE"
vnet_name = "dev-jcdigital-test345-vnet"
}

Code starts below:

# Create file for peering role
data "template_file" "peering_role" {
  template = "${file("${path.module}/templates/peering-role.tpl")}"

  vars = {
    subscription_id   = "${var.subscription_id}"
    rg                = "${var.rg}"
    vnet              = "${var.vnet}"
  }
}

# Peering role files
resource "local_file" "peering_role" {
  content     = "${data.template_file.peering_role.rendered}"
  filename    = "${path.module}/files/{var.environment}-${var.customer}-${var.site}-peering-role.json"
}

# Configure the MongoDB Atlas Provider
provider "mongodbatlas" {
  public_key  = "${var.atlas_public_key}"
  private_key = "${var.atlas_private_key}"
}

# Create a Group
resource "mongodbatlas_project" "rest" {
  org_id = "${var.atlas_org_id}"
  name   = "${var.environment}-${var.customer}-${var.site}"
}

# Create a Container
resource "mongodbatlas_network_container" "rest" {
  project_id          = "${mongodbatlas_project.rest.id}"
  atlas_cidr_block    = "${var.atlas_cidr_block}"
  provider_name       = "${var.atlas_provider_name}"
  region              = "${var.atlas_region}"
}

#Create a Network Peering Connection
resource "mongodbatlas_network_peering" "rest" {
    project_id                = "${mongodbatlas_project.rest.id}"
    atlas_cidr_block          = "${var.atlas_cidr_block}"
    container_id              = "${mongodbatlas_network_container.rest.container_id}"
    provider_name             = "${var.atlas_provider_name}"
    azure_directory_id        = "${var.tenant_id}"
    azure_subscription_id     = "${var.subscription_id}"
    resource_group_name       = "${var.rg}"
    vnet_name                 = "${var.vnet}"
}

# Whitelist REST and JConnect vnets
resource "mongodbatlas_project_ip_whitelist" "rest" {
    project_id = "${mongodbatlas_project.rest.id}"

    whitelist {
      cidr_block = "${var.vnet_cidr}"
      comment    = "cidr block for ${var.vnet}"
    }
    whitelist {
      cidr_block = "${var.prod_jcdigital_jconnect_cidr}"
      comment    = "cidr block for ${var.prod_jcdigital_jconnect_vnet}"
    }
}

# Create Atlas cluster for sense-rest
resource "mongodbatlas_cluster" "rest" {
  project_id   = "${mongodbatlas_project.rest.id}"
  name         = "${var.environment}-${var.customer}-${var.site}"
  disk_size_gb = 64
  num_shards   = 1
  mongo_db_major_version       = "${var.atlas_mongodb_version}"

  replication_factor           = 3
  backup_enabled               = true
  auto_scaling_disk_gb_enabled = true

  //Provider Settings "block"
  provider_name               = "${var.atlas_provider_name}"
  provider_encrypt_ebs_volume = false
  provider_instance_size_name = "${var.atlas_cluster_tier}"
  provider_region_name        = "${var.atlas_region}"
  provider_disk_type_name     = "P6"
}

# DB admin user to manage the database
resource "mongodbatlas_database_user" "rest" {
    username        = "${var.dbuser}"
    password        = "${var.atlas_dbuser_password}"
    project_id      = "${mongodbatlas_project.rest.id}"
    database_name   = "admin"   # DB where db user created

    roles {
        role_name     = "readWrite"
        database_name = "${var.rest_db_name}"
    }
}

from terraform-provider-mongodbatlas.

PacoDw avatar PacoDw commented on June 3, 2024

Thanks, we will check it to find the solution as soon as possible 👍

from terraform-provider-mongodbatlas.

marinsalinas avatar marinsalinas commented on June 3, 2024

@bobhlo, Modified your code to make it more readable.

from terraform-provider-mongodbatlas.

PacoDw avatar PacoDw commented on June 3, 2024

Hello @@bobhlo, the issue was resolved you can test it on pr #22

If you have another issue or comments just let us know, thank you.

from terraform-provider-mongodbatlas.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.