oracle / terraform-provider-oci

Terraform Oracle Cloud Infrastructure provider
https://www.terraform.io/docs/providers/oci/
Mozilla Public License 2.0
758 stars 674 forks source link

API Gateway Deployment data source always returns a null specification #1115

Closed mjmuller68 closed 4 years ago

mjmuller68 commented 4 years ago

Community Note

Terraform Version and Provider Version

Terraform v0.12.28

Affected Resource(s)

oci_apigateway_deployments

Terraform Configuration Files

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. 
# Please remove any sensitive information from configuration files before sharing them. 

variable "tenancy_ocid" {} variable "user_ocid" {} variable "fingerprint" {} variable "private_key_path" {} variable "compartment_ocid" {} variable "region" {} variable "gateway_display_name" {}

provider "oci" { tenancy_ocid = "${var.tenancy_ocid}" user_ocid = "${var.user_ocid}" fingerprint = "${var.fingerprint}" private_key_path = "${var.private_key_path}" region = "${var.region}" }

data "oci_apigateway_gateways" "test_gateways" {

Required

compartment_id = "${var.compartment_ocid}"

display_name = "${var.gateway_display_name}" state = "ACTIVE" }

data "oci_apigateway_deployments" "test_deployments" {

Required

compartment_id = "${var.compartment_ocid}"

Optional

display_name = "${var.deployment_display_name}" gateway_id = "${data.oci_apigateway_gateways.test_gateways.gateway_collection[0].id}" state = "ACTIVE" }

output "api-gw" { value = data.oci_apigateway_gateways.test_gateways.gateway_collection

value = data.oci_apigateway_gateways.test_gateways.gateway_collection[0]

}

output "test-deployments" { value = data.oci_apigateway_deployments.test_deployments.deployment_collection }

Debug Output

Panic Output

Expected Behavior

The output for the APIGW deployment should list the routing specification details under the "specification" field.

Actual Behavior

The specification field is blank. Example output: { "compartment_id" = "ocid1.compartment.oc1..aaaaaaaark4c3nv7lcak5jspffnpb6frc5wpstwdqwuvytu6mbq"

"display_name" = "as_deployment"
"endpoint" = "https://denk3zohymwqqrsid54wd5a.apigateway.us-phoenix-1.oci.customer-oci.com/cloudnativesaas"
"freeform_tags" = {}
"gateway_id" = "ocid1.apigateway.oc1.phx.amaaaaaah7pzzmqa5gw4faztug4h5guefodkxdbub2fq6qmdqcdnfhxq"
"id" = "ocid1.apideployment.oc1.phx.amaaaaaah7pzzmqarq2r5btfo2lyqof7gbwfayd5hseoksqnjsdxi5waa"
"lifecycle_details" = ""
"path_prefix" = "/cloudnativesaas"
"specification" = []
"state" = "ACTIVE"
"time_created" = "2020-04-14 23:53:54.001 +0000 UTC"
"time_updated" = "2020-04-14 23:54:11.897 +0000 UTC"

}

Steps to Reproduce

  1. terraform apply

Important Factoids

References

jotruon commented 4 years ago

Hi @mjmuller68 , Thanks for reporting this bug. You are correct, the datasource missing schema for specification which result in empty output.

jotruon commented 4 years ago

I create a ticket to fix this issue. In the meantime, you can use specifcation directly from the resource oci_apigateway_deployment:

output "test-deployments" {
  value = "${oci_apigateway_deployment.test_deployment.specification}"
}

Thanks

yifnfan commented 4 years ago

Hi @mjmuller68 , thanks for the report. I've checked the API we use(https://docs.cloud.oracle.com/en-us/iaas/api/#/en/api-gateway/20190501/DeploymentSummary/). it doesnt return the specification field because of the size and the authorization perspective. This is not an bug in the terraform provider. I will close this ticket. If you have more questions about it, feel free to contact with me or reopen the ticket.