Please include a summary of the fix/feature/change, including any relevant motivation and context.
Type of Change
[ ] Bug fix (non-breaking change which fixes an issue). Please, add the "bug" label to the PR.
[x] New feature (non-breaking change which adds functionality). Please, add the "enhancement" label to the PR.
[ ] Breaking change (fix or feature that would cause existing functionality to not work as expected). Please, add the "breaking change" label to the PR.
[ ] This change requires a documentation update
[ ] Documentation fix/enhancement
Manual Testing Approach
How was this change tested and do you have evidence? (REQUIRED: Select at least 1)
[x] Manually tested
[ ] Unit tested
[ ] Acceptance tested
[ ] Unable to test / will not test (Please provide comments in section below)
Testing
Get Azure VNET Peering CLI Command API-
Error received when trying to access the command without admin consent granted-
Planning failed. Terraform encountered an error while generating this plan.
╷
│ Error: Error Reading Azure network peer command
│
│ with data.couchbase-capella_azure_network_peer_command.azure_network_peer_command,
│ on get_network_peer_command.tf line 5, in data "couchbase-capella_azure_network_peer_command" "azure_network_peer_command":
│ 5: data "couchbase-capella_azure_network_peer_command" "azure_network_peer_command" {
│
│ Could not read Azure network peer command: unexpected code: 422, expected: 200, body: {"code":4061,"hint":"Returned when trying to retrieve command when the admin consent has not been granted by the customer or the consent
│ granted by the customer has not been successfully verified.","httpStatusCode":422,"message":"Unable to retrieve role assignment command. Admin consent not granted or failed to verify admin consent granted to the AD app for vnet
│ peering. Please try granting the admin consent and retry retrieving command again."}null
╵
Terraform apply-
terraform apply
╷
│ Warning: Provider development overrides are in effect
│
│ The following provider development overrides are set in the CLI configuration:
│ - couchbasecloud/couchbase-capella in /Users/paulomee.de/go/bin
│
│ The behavior may therefore not match any released version of the provider and applying changes may cause the state to become incompatible with published releases.
╵
data.couchbase-capella_azure_network_peer_command.azure_network_peer_command: Reading...
data.couchbase-capella_azure_network_peer_command.azure_network_peer_command: Read complete after 0s
Changes to Outputs:
+ azure_network_peer_command = {
+ cluster_id = "ffffffff-aaaa-1414-eeee-000000000000"
+ command = "az role assignment create --assignee-object-id ffffffff-aaaa-1414-eeee-000000000000 --role \"Network Contributor\" --scope /subscriptions/ffffffff-aaaa-1414-eeee-000000000000/resourceGroups/peerer_test/providers/Microsoft.Network/VirtualNetworks/vnet-test --assignee-principal-type ServicePrincipal"
+ organization_id = "ffffffff-aaaa-1414-eeee-000000000000"
+ project_id = "ffffffff-aaaa-1414-eeee-000000000000"
+ resource_group = "peerer_test"
+ subscription_id = "ffffffff-aaaa-1414-eeee-000000000000"
+ tenant_id = "ffffffff-aaaa-1414-eeee-000000000000"
+ vnet_id = "vnet-test"
+ vnet_peering_service_principal = "ffffffff-aaaa-1414-eeee-000000000000"
}
You can apply this plan to save these new output values to the Terraform state, without changing any real infrastructure.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
Apply complete! Resources: 0 added, 0 changed, 0 destroyed.
Outputs:
azure_network_peer_command = {
"cluster_id" = "ffffffff-aaaa-1414-eeee-000000000000"
"command" = "az role assignment create --assignee-object-id ffffffff-aaaa-1414-eeee-000000000000 --role \"Network Contributor\" --scope /subscriptions/ffffffff-aaaa-1414-eeee-000000000000/resourceGroups/peerer_test/providers/Microsoft.Network/VirtualNetworks/vnet-test --assignee-principal-type ServicePrincipal"
"organization_id" = "ffffffff-aaaa-1414-eeee-000000000000"
"project_id" = "ffffffff-aaaa-1414-eeee-000000000000"
"resource_group" = "peerer_test"
"subscription_id" = "ffffffff-aaaa-1414-eeee-000000000000"
"tenant_id" = "ffffffff-aaaa-1414-eeee-000000000000"
"vnet_id" = "vnet-test"
"vnet_peering_service_principal" = "ffffffff-aaaa-1414-eeee-000000000000"
}
Create Network Peering API-
terraform plan
terraform plan
╷
│ Warning: Provider development overrides are in effect
│
│ The following provider development overrides are set in the CLI configuration:
│ - couchbasecloud/couchbase-capella in /Users/paulomee.de/go/bin
│
│ The behavior may therefore not match any released version of the provider and applying changes may cause the state to become incompatible with published releases.
╵
data.couchbase-capella_network_peers.existing_network_peers: Reading...
data.couchbase-capella_network_peers.existing_network_peers: Read complete after 0s
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# couchbase-capella_network_peer.new_network_peer will be created
+ resource "couchbase-capella_network_peer" "new_network_peer" {
+ audit = (known after apply)
+ cluster_id = "ffffffff-aaaa-1414-eeee-00000000000"
+ commands = (known after apply)
+ id = (known after apply)
+ name = "VNETPeerTFTestAZURE"
+ organization_id = "ffffffff-aaaa-1414-eeee-00000000000"
+ project_id = "ffffffff-aaaa-1414-eeee-00000000000"
+ provider_config = {
+ azure_config = {
+ cidr = "10.6.0.0/16"
+ provider_id = (known after apply)
+ resource_group = "test-rg"
+ subscription_id = "ffffffff-aaaa-1414-eeee-00000000000"
+ tenant_id = "ffffffff-aaaa-1414-eeee-00000000000"
+ vnet_id = "test-vnet"
}
}
+ provider_type = "azure"
+ status = (known after apply)
}
Plan: 1 to add, 0 to change, 0 to destroy.
Changes to Outputs:
+ network_peers_list = {
+ cluster_id = "ffffffff-aaaa-1414-eeee-00000000000"
+ data = [
+ {
+ audit = {
+ created_at = "2024-08-23 23:30:39.790107885 +0000 UTC"
+ created_by = "s10qrydhDaic9GsWZ6BYpJfSK7wARDCv"
+ modified_at = "2024-08-23 23:35:39.359925093 +0000 UTC"
+ modified_by = "ffffffff-aaaa-1414-eeee-00000000000"
+ version = 6
}
+ id = "ffffffff-aaaa-1414-eeee-00000000000"
+ name = "VNETPeerTFTestAZURE"
+ provider_config = {
+ aws_config = null
+ azure_config = {
+ cidr = "10.6.0.0/16"
+ provider_id = ""
+ resource_group = "\"test-rg\""
+ subscription_id = "\"ffffffff-aaaa-1414-eeee-00000000000\""
+ tenant_id = "\"ffffffff-aaaa-1414-eeee-00000000000\""
+ vnet_id = "\"test-vnet\""
}
+ gcp_config = null
}
+ status = {
+ reasoning = ""
+ state = "failed"
}
},
]
+ organization_id = "ffffffff-aaaa-1414-eeee-00000000000"
+ project_id = "ffffffff-aaaa-1414-eeee-00000000000"
}
+ new_network_peer = {
+ audit = (known after apply)
+ cluster_id = "ffffffff-aaaa-1414-eeee-00000000000"
+ commands = (known after apply)
+ id = (known after apply)
+ name = "VNETPeerTFTestAZURE"
+ organization_id = "ffffffff-aaaa-1414-eeee-00000000000"
+ project_id = "ffffffff-aaaa-1414-eeee-00000000000"
+ provider_config = {
+ aws_config = null
+ azure_config = {
+ cidr = "10.6.0.0/16"
+ provider_id = (known after apply)
+ resource_group = "test-rg"
+ subscription_id = "ffffffff-aaaa-1414-eeee-00000000000"
+ tenant_id = "ffffffff-aaaa-1414-eeee-00000000000"
+ vnet_id = "test-vnet"
}
+ gcp_config = null
}
+ provider_type = "azure"
+ status = (known after apply)
}
+ peer_id = (known after apply)
terraform apply
terraform apply
╷
│ Warning: Provider development overrides are in effect
│
│ The following provider development overrides are set in the CLI configuration:
│ - couchbasecloud/couchbase-capella in /Users/paulomee.de/go/bin
│
│ The behavior may therefore not match any released version of the provider and applying changes may cause the state to become incompatible with published releases.
╵
data.couchbase-capella_network_peers.existing_network_peers: Reading...
data.couchbase-capella_network_peers.existing_network_peers: Read complete after 0s
Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# couchbase-capella_network_peer.new_network_peer will be created
+ resource "couchbase-capella_network_peer" "new_network_peer" {
+ audit = (known after apply)
+ cluster_id = "ffffffff-aaaa-1414-eeee-00000000000"
+ commands = (known after apply)
+ id = (known after apply)
+ name = "VNETPeerTFTestAZURE"
+ organization_id = "ffffffff-aaaa-1414-eeee-00000000000"
+ project_id = "ffffffff-aaaa-1414-eeee-00000000000"
+ provider_config = {
+ azure_config = {
+ cidr = "10.6.0.0/16"
+ provider_id = (known after apply)
+ resource_group = "test-rg"
+ subscription_id = "ffffffff-aaaa-1414-eeee-00000000000"
+ tenant_id = "ffffffff-aaaa-1414-eeee-00000000000"
+ vnet_id = "test-vnet"
}
}
+ provider_type = "azure"
+ status = (known after apply)
}
Plan: 1 to add, 0 to change, 0 to destroy.
Changes to Outputs:
+ network_peers_list = {
+ cluster_id = "ffffffff-aaaa-1414-eeee-00000000000"
+ data = [
+ {
+ audit = {
+ created_at = "2024-08-23 23:30:39.790107885 +0000 UTC"
+ created_by = "s10qrydhDaic9GsWZ6BYpJfSK7wARDCv"
+ modified_at = "2024-08-23 23:35:39.359925093 +0000 UTC"
+ modified_by = "ffffffff-aaaa-1414-eeee-00000000000"
+ version = 6
}
+ id = "ffffffff-aaaa-1414-eeee-00000000000"
+ name = "VNETPeerTFTestAZURE"
+ provider_config = {
+ aws_config = null
+ azure_config = {
+ cidr = "10.6.0.0/16"
+ provider_id = ""
+ resource_group = "\"test-rg\""
+ subscription_id = "\"ffffffff-aaaa-1414-eeee-00000000000\""
+ tenant_id = "\"ffffffff-aaaa-1414-eeee-00000000000\""
+ vnet_id = "\"test-vnet\""
}
+ gcp_config = null
}
+ status = {
+ reasoning = ""
+ state = "failed"
}
},
]
+ organization_id = "ffffffff-aaaa-1414-eeee-00000000000"
+ project_id = "ffffffff-aaaa-1414-eeee-00000000000"
}
+ new_network_peer = {
+ audit = (known after apply)
+ cluster_id = "ffffffff-aaaa-1414-eeee-00000000000"
+ commands = (known after apply)
+ id = (known after apply)
+ name = "VNETPeerTFTestAZURE"
+ organization_id = "ffffffff-aaaa-1414-eeee-00000000000"
+ project_id = "ffffffff-aaaa-1414-eeee-00000000000"
+ provider_config = {
+ aws_config = null
+ azure_config = {
+ cidr = "10.6.0.0/16"
+ provider_id = (known after apply)
+ resource_group = "test-rg"
+ subscription_id = "ffffffff-aaaa-1414-eeee-00000000000"
+ tenant_id = "ffffffff-aaaa-1414-eeee-00000000000"
+ vnet_id = "test-vnet"
}
+ gcp_config = null
}
+ provider_type = "azure"
+ status = (known after apply)
}
+ peer_id = (known after apply)
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
couchbase-capella_network_peer.new_network_peer: Creating...
couchbase-capella_network_peer.new_network_peer: Still creating... [10s elapsed]
couchbase-capella_network_peer.new_network_peer: Still creating... [20s elapsed]
couchbase-capella_network_peer.new_network_peer: Still creating... [30s elapsed]
couchbase-capella_network_peer.new_network_peer: Still creating... [40s elapsed]
couchbase-capella_network_peer.new_network_peer: Creation complete after 43s [id=ffffffff-aaaa-1414-eeee-00000000000]
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
Outputs:
network_peers_list = {
"cluster_id" = "ffffffff-aaaa-1414-eeee-00000000000"
"data" = tolist([
{
"audit" = {
"created_at" = "2024-08-23 23:30:39.790107885 +0000 UTC"
"created_by" = "s10qrydhDaic9GsWZ6BYpJfSK7wARDCv"
"modified_at" = "2024-08-23 23:35:39.359925093 +0000 UTC"
"modified_by" = "ffffffff-aaaa-1414-eeee-00000000000"
"version" = 6
}
"id" = "ffffffff-aaaa-1414-eeee-00000000000"
"name" = "VNETPeerTFTestAZURE"
"provider_config" = {
"aws_config" = null /* object */
"azure_config" = {
"cidr" = "10.6.0.0/16"
"provider_id" = ""
"resource_group" = "\"test-rg\""
"subscription_id" = "\"ffffffff-aaaa-1414-eeee-00000000000\""
"tenant_id" = "\"ffffffff-aaaa-1414-eeee-00000000000\""
"vnet_id" = "\"test-vnet\""
}
"gcp_config" = null /* object */
}
"status" = {
"reasoning" = ""
"state" = "failed"
}
},
])
"organization_id" = "ffffffff-aaaa-1414-eeee-00000000000"
"project_id" = "ffffffff-aaaa-1414-eeee-00000000000"
}
new_network_peer = {
"audit" = {
"created_at" = "2024-08-24 00:01:23.524305127 +0000 UTC"
"created_by" = "s10qrydhDaic9GsWZ6BYpJfSK7wARDCv"
"modified_at" = "2024-08-24 00:02:05.606678591 +0000 UTC"
"modified_by" = "s10qrydhDaic9GsWZ6BYpJfSK7wARDCv"
"version" = 2
}
"cluster_id" = "ffffffff-aaaa-1414-eeee-00000000000"
"commands" = toset([])
"id" = "ffffffff-aaaa-1414-eeee-00000000000"
"name" = "VNETPeerTFTestAZURE"
"organization_id" = "ffffffff-aaaa-1414-eeee-00000000000"
"project_id" = "ffffffff-aaaa-1414-eeee-00000000000"
"provider_config" = {
"aws_config" = null /* object */
"azure_config" = {
"cidr" = "10.6.0.0/16"
"provider_id" = "/subscriptions/ffffffff-aaaa-1414-eeee-00000000000/resourceGroups/rg-ffffffff-aaaa-1414-eeee-00000000000/providers/Microsoft.Network/virtualNetworks/cc-ffffffff-aaaa-1414-eeee-00000000000/virtualNetworkPeerings/cc-ffffffff-aaaa-1414-eeee-00000000000-test-vnet"
"resource_group" = "test-rg"
"subscription_id" = "ffffffff-aaaa-1414-eeee-00000000000"
"tenant_id" = "ffffffff-aaaa-1414-eeee-00000000000"
"vnet_id" = "test-vnet"
}
"gcp_config" = null /* object */
}
"provider_type" = "azure"
"status" = {
"reasoning" = ""
"state" = "complete"
}
}
peer_id = "ffffffff-aaaa-1414-eeee-00000000000"
Network peering record -
Remaining all operations are in the README files.
NOTE: Getting_started folder already has an example for VPC Peering hence not updating that again.
Testing
Required Checklist:
[x] I have checked that this change does not generate any credentials and that they are NOT accidentally logged anywhere.
[x] I have added tests that prove my fix is effective or that my feature works per HashiCorp requirements
[x] I have added any necessary documentation (if required)
[x] I have run make fmt and formatted my code
[x] I have made sure that no schema field is marked with both requiresReplace and computed
Jira
Description
Please include a summary of the fix/feature/change, including any relevant motivation and context.
Type of Change
Manual Testing Approach
How was this change tested and do you have evidence? (REQUIRED: Select at least 1)
Testing
Get Azure VNET Peering CLI Command API-
Terraform apply-
Create Network Peering API-
terraform plan
terraform apply
Network peering record -
Remaining all operations are in the README files.
NOTE: Getting_started folder already has an example for VPC Peering hence not updating that again.
Testing
Required Checklist:
Further comments