Closed sameesin closed 4 weeks ago
Voting for Prioritization
Volunteering to Work on This Issue
I'm able to reproduce this using the configuration files provided by @sameesin. It looks like using the create_base_policy
argument with no other arguments causes the provider to generate an invalid base policy.
Note this is also causing multiple acceptance test failures:
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.5 test ./internal/service/networkmanager/... -v -count 1 -parallel 1 -run='TestAccNetworkManagerCoreNetwork_createBasePolicyDocument*' -timeout 360m
=== RUN TestAccNetworkManagerCoreNetwork_createBasePolicyDocumentWithoutRegion
=== PAUSE TestAccNetworkManagerCoreNetwork_createBasePolicyDocumentWithoutRegion
=== RUN TestAccNetworkManagerCoreNetwork_createBasePolicyDocumentWithRegion
=== PAUSE TestAccNetworkManagerCoreNetwork_createBasePolicyDocumentWithRegion
=== RUN TestAccNetworkManagerCoreNetwork_createBasePolicyDocumentWithMultiRegion
=== PAUSE TestAccNetworkManagerCoreNetwork_createBasePolicyDocumentWithMultiRegion
=== RUN TestAccNetworkManagerCoreNetwork_createBasePolicyDocumentWithPolicyDocument
=== PAUSE TestAccNetworkManagerCoreNetwork_createBasePolicyDocumentWithPolicyDocument
=== CONT TestAccNetworkManagerCoreNetwork_createBasePolicyDocumentWithoutRegion
core_network_test.go:161: Step 1/2 error: Error running apply: exit status 1
Error: creating Core Network: CoreNetworkPolicyException: Incorrect policy.
{
RespMetadata: {
StatusCode: 400,
RequestID: "dad105b7-d07d-43c8-90ef-9e039a62e05b"
},
Errors: [{
ErrorCode: "TYPE_MISMATCH",
Message: "$.network-function-groups: null found, array expected",
Path: "$.network-function-groups"
}],
Message_: "Incorrect policy."
}
with aws_networkmanager_core_network.test,
on terraform_plugin_test.tf line 14, in resource "aws_networkmanager_core_network" "test":
14: resource "aws_networkmanager_core_network" "test" {
--- FAIL: TestAccNetworkManagerCoreNetwork_createBasePolicyDocumentWithoutRegion (11.52s)
=== CONT TestAccNetworkManagerCoreNetwork_createBasePolicyDocumentWithMultiRegion
core_network_test.go:239: Step 1/2 error: Error running apply: exit status 1
Error: creating Core Network: CoreNetworkPolicyException: Incorrect policy.
{
RespMetadata: {
StatusCode: 400,
RequestID: "43f62dae-fa67-4d83-81bb-fe9320adf038"
},
Errors: [{
ErrorCode: "TYPE_MISMATCH",
Message: "$.network-function-groups: null found, array expected",
Path: "$.network-function-groups"
}],
Message_: "Incorrect policy."
}
with aws_networkmanager_core_network.test,
on terraform_plugin_test.tf line 14, in resource "aws_networkmanager_core_network" "test":
14: resource "aws_networkmanager_core_network" "test" {
--- FAIL: TestAccNetworkManagerCoreNetwork_createBasePolicyDocumentWithMultiRegion (9.49s)
=== CONT TestAccNetworkManagerCoreNetwork_createBasePolicyDocumentWithPolicyDocument
=== CONT TestAccNetworkManagerCoreNetwork_createBasePolicyDocumentWithRegion
--- PASS: TestAccNetworkManagerCoreNetwork_createBasePolicyDocumentWithPolicyDocument (1488.82s)
=== NAME TestAccNetworkManagerCoreNetwork_createBasePolicyDocumentWithRegion
core_network_test.go:200: Step 1/2 error: Error running apply: exit status 1
Error: creating Core Network: CoreNetworkPolicyException: Incorrect policy.
{
RespMetadata: {
StatusCode: 400,
RequestID: "95c44732-d429-463d-bd36-3c72459eb55e"
},
Errors: [{
ErrorCode: "TYPE_MISMATCH",
Message: "$.network-function-groups: null found, array expected",
Path: "$.network-function-groups"
}],
Message_: "Incorrect policy."
}
with aws_networkmanager_core_network.test,
on terraform_plugin_test.tf line 14, in resource "aws_networkmanager_core_network" "test":
14: resource "aws_networkmanager_core_network" "test" {
--- FAIL: TestAccNetworkManagerCoreNetwork_createBasePolicyDocumentWithRegion (9.14s)
FAIL
FAIL github.com/hashicorp/terraform-provider-aws/internal/service/networkmanager 1524.612s
FAIL
make: *** [testacc] Error 1
Use the base_policy_document
argument in the aws_networkmanager_core_network
resource to force the use of a working policy:
resource "aws_networkmanager_core_network" "core_network" {
global_network_id = aws_networkmanager_global_network.cloudwan-automation-test.id
create_base_policy = true
base_policy_document = data.aws_networkmanager_core_network_policy_document.policy1.json
}
Use the AWSCC provider and the corresponding resource type to create and manage the core network:
resource "awscc_networkmanager_core_network" "example" {
global_network_id = aws_networkmanager_global_network.cloudwan-automation-test.id
description = "example"
}
[!WARNING] This issue has been closed, meaning that any additional comments are hard for our team to see. Please assume that the maintainers will not see them.
Ongoing conversations amongst community members are welcome, however, the issue will be locked after 30 days. Moving conversations to another venue, such as the AWS Provider forum, is recommended. If you have additional concerns, please open a new issue, referencing this one where needed.
This functionality has been released in v5.62.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!
Terraform Core Version
1.9.1
AWS Provider Version
5.57.0
Affected Resource(s)
Expected Behavior
The core network should get created but the code fails with an error stating incorrect policy
Actual Behavior
{ │ RespMetadata: { │ StatusCode: 400, │ RequestID: "<>" │ }, │ Errors: [{ │ ErrorCode: "TYPEMISMATCH", │ Message: "$.network-function-groups: null found, array expected", │ Path: "$.network-function-groups" │ }], │ Message: "Incorrect policy." │ }
Relevant Error/Panic Output Snippet
Terraform Configuration Files
Steps to Reproduce
terraform init terraform plan --out t terraform apply t
Debug Output
No response
Panic Output
No response
Important Factoids
No response
References
No response
Would you like to implement a fix?
No