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

r/aws_networkmanager_core_network: Support multiple regions in the base policy #29622

Closed
GlennChia opened this issue Feb 24, 2023 · 3 comments · Fixed by #29623
Closed

r/aws_networkmanager_core_network: Support multiple regions in the base policy #29622

GlennChia opened this issue Feb 24, 2023 · 3 comments · Fixed by #29623
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/networkmanager Issues and PRs that pertain to the networkmanager service.
Milestone

Comments

@GlennChia
Copy link
Collaborator

Description

For VPC Attachments to be used with Core Networks, a Policy Document with the region that the VPC is created in is required. Currently the aws_networkmanager_core_network resource only supports specifying one region via the base_policy_region argument. This means that the first Terraform apply will only work with VPCs in one region. There could be a use-case that involves multi-region.

Proposed fix

  1. Introduce a new argument base_policy_regions that allow users to specify multiple regions in the base policy
  2. This also involves refactoring how the base policy is constructed. An idea is to use the the structs that are also used in the aws_networkmanager_core_network_policy_document data source to help format the policy
  3. Deprecate the base_policy_region argument

Relates #28867

Affected Resource(s) and/or Data Source(s)

  • aws_networkmanager_core_network

Potential Terraform Configuration

resource "aws_networkmanager_global_network" "example" {}

data "aws_networkmanager_core_network_policy_document" "example" {
  core_network_configuration {
    asn_ranges = ["65022-65534"]

    edge_locations {
      location = "us-west-2"
    }

    edge_locations {
      location = "us-east-1"
    }
  }

  segments {
    name = "segment"
  }

  segments {
    name = "segment2"
  }

  segment_actions {
    action  = "create-route"
    segment = "segment"
    destination_cidr_blocks = [
      "10.0.0.0/16"
    ]
    destinations = [
      aws_networkmanager_vpc_attachment.example_us_west_2.id,
    ]
  }

  segment_actions {
    action  = "create-route"
    segment = "segment"
    destination_cidr_blocks = [
      "10.1.0.0/16"
    ]
    destinations = [
      aws_networkmanager_vpc_attachment.example_us_east_1.id,
    ]
  }
}

resource "aws_networkmanager_core_network" "example" {
  global_network_id  = aws_networkmanager_global_network.example.id
  base_policy_regions = ["us-west-2", "us-east-1"]
  create_base_policy = true
}

resource "aws_networkmanager_core_network_policy_attachment" "example" {
  core_network_id = aws_networkmanager_core_network.example.id
  policy_document = data.aws_networkmanager_core_network_policy_document.example.json
}

resource "aws_networkmanager_vpc_attachment" "example_us_west_2" {
  core_network_id = aws_networkmanager_core_network.example.id
  subnet_arns     = aws_subnet.example_us_west_2[*].arn
  vpc_arn         = aws_vpc.example_us_west_2.arn
}

resource "aws_networkmanager_vpc_attachment" "example_us_east_1" {
  provider = "alternate"

  core_network_id = aws_networkmanager_core_network.example.id
  subnet_arns     = aws_subnet.example_us_east_1[*].arn
  vpc_arn         = aws_vpc.example_us_east_1.arn
}

References

PR that introduced the create_base_policy and base_policy_region arguments in aws_networkmanager_core_network: #29097

Would you like to implement a fix?

Yes

@GlennChia GlennChia added enhancement Requests to existing resources that expand the functionality or scope. needs-triage Waiting for first response or review from a maintainer. labels Feb 24, 2023
@github-actions
Copy link

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added the service/networkmanager Issues and PRs that pertain to the networkmanager service. label Feb 24, 2023
@ewbankkit ewbankkit removed the needs-triage Waiting for first response or review from a maintainer. label Feb 25, 2023
@github-actions github-actions bot added this to the v4.57.0 milestone Mar 2, 2023
@github-actions
Copy link

github-actions bot commented Mar 3, 2023

This functionality has been released in v4.57.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

github-actions bot commented Apr 4, 2023

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/networkmanager Issues and PRs that pertain to the networkmanager service.
Projects
None yet
2 participants