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

add ddos_protection_plan configuration to vnet #66

Merged
merged 3 commits into from
Aug 8, 2022

Conversation

jeongkyeong
Copy link

@jeongkyeong jeongkyeong commented Aug 2, 2022

Modify vnet's ddos protection plan to be configurable.
The default value is 'null', so set it only when it is necessary.

Input variable example

module "vnet" {
  source              = "Azure/vnet/azurerm"
  
  ...
  ddos_protection_plan = {
      enable = true
      id     = azurerm_network_ddos_protection_plan.ddos_protection_plan.id
  }
}

Fixes #000

Changes proposed in the pull request:

@ghost
Copy link

ghost commented Aug 2, 2022

CLA assistant check
All CLA requirements met.

Copy link

@ianychoi ianychoi left a comment

Choose a reason for hiding this comment

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

Tagging @lonegunmanb to ask for review (who reviewed last several PRs).

@jeongkyeong: would you describe how it would be applicable by specifying use case(s) you are on mind?

Note that I am not an authorized reviewer regarding your PR but hope it helps.

variables.tf Outdated Show resolved Hide resolved
main.tf Outdated Show resolved Hide resolved
@jeongkyeong
Copy link
Author

jeongkyeong commented Aug 4, 2022

Tagging @lonegunmanb to ask for review (who reviewed last several PRs).

@jeongkyeong: would you describe how it would be applicable by specifying use case(s) you are on mind?

Note that I am not an authorized reviewer regarding your PR but hope it helps.

Added one of the features of vnet, which allows you to set up a ddos protection plan. And this feature is also officially supported by Terraform.

This is a use case in terraform code(which is also being used as a module) using the azure vnet module.

variable "ddos_protection_plan" {
  type    = bool
  default = false
}

resource "azurerm_network_ddos_protection_plan" "ddos_protection_plan" {
  count               = var.ddos_protection_plan ? 1 : 0
  name                = "ddos-protection-${var.name}"
  location            = azurerm_resource_group.rg.location
  resource_group_name = azurerm_resource_group.rg.name
}

module "vnet" {
  source              = "Azure/vnet/azurerm"
  vnet_name           = var.name
  resource_group_name = azurerm_resource_group.rg.name
  address_space       = [var.vpc_address_space]
  subnet_prefixes     = [var.public_subnet_cidr, var.private_subnet_cidr]
  subnet_names        = var.subnet_names

  tags = local.tags

  ddos_protection_plan = var.ddos_protection_plan ? {
    enable = var.ddos_protection_plan
    id     = azurerm_network_ddos_protection_plan.ddos_protection_plan[0].id
  } : null
}

variables.tf Show resolved Hide resolved
Copy link
Member

@lonegunmanb lonegunmanb left a comment

Choose a reason for hiding this comment

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

LGTM!

@lonegunmanb lonegunmanb merged commit bee4282 into Azure:master Aug 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants