Git Product home page Git Product logo

learn-terraform-modules-create's Introduction

Learn Terraform Modules Create

Learn what Terraform modules are and how to create one.

This repo is a companion repo to the Build a Module tutorial.

learn-terraform-modules-create's People

Contributors

brianmmcclain avatar dlaguerta avatar duplo83 avatar im2nguyen avatar judithpatudith avatar kakakakakku avatar monegim avatar robin-norwood avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

learn-terraform-modules-create's Issues

The given value is not suitable for child module variable "nic_id" defined at module\nsg\variable.tf:14,1-18: string required.

Hi,

i'm new to child modules and i want to create multiple resource with child module using loop but getting error while creating resources. Please help me to fix this issue.

resource "azurerm_resource_group" "rg" {
name = var.resource_group_name
location = var.resource_group_location
}

module "vnet" {
source = "./module/vnet"
resource_group_name = var.resource_group_name
resource_group_location = var.resource_group_location
vnet_name = var.vnet_name
address_space = var.address_space

}

module "subnet" {
source = "./module/subnet"
subent_name = var.subent_name
resource_group_name = var.resource_group_name
vnet_name_outout = module.vnet.vnet_name_outout # output
address_prefixes = var.address_prefixes
}

module "nic" {
source = "./module/nic"
resource_group_name = var.resource_group_name
resource_group_location = var.resource_group_location
nic_names_list = toset(var.nic_names_list)
prodsubnet_id = module.subnet.prodsubnet_id # output
}

module "nsg" {
source = "./module/nsg"
resource_group_name = var.resource_group_name
resource_group_location = var.resource_group_location
nsg_names_list = toset(var.nsg_names_list)
nic_id = module.nic.nic_id # output "nic_id"
}

output "nic_id" {
value = [for s in azurerm_network_interface.web_windows_vm_nic : s.id]
}

Error: Invalid value for module argument

│ on main.tf line 28, in module "nsg":
│ 28: nic_id = module.nic.nic_id

│ The given value is not suitable for child module variable "nic_id" defined at module\nsg\variable.tf:14,1-18: string required.

resource "azurerm_network_interface_security_group_association" "web_vmnic_nsg_associate" {
for_each = azurerm_network_security_group.prod_subnet_nsg
network_interface_id = var.nic_id
network_security_group_id = each.value.id
}

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.