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

Empty dns_records in fastly_tls_configuration #391

Closed
zaremjan opened this issue Mar 31, 2021 · 4 comments
Closed

Empty dns_records in fastly_tls_configuration #391

zaremjan opened this issue Mar 31, 2021 · 4 comments

Comments

@zaremjan
Copy link

Terraform Version

Terraform v0.14.9
+ provider registry.terraform.io/fastly/fastly v0.27.0

Affected Resource(s)

  • fastly_tls_configuration

Terraform Configuration Files

data "fastly_tls_configuration" "default_configuration" {
  default = true
}

data "fastly_tls_configuration" "configuration_by_id" {
  id = data.fastly_tls_configuration.default_configuration.id
}

output "defult_configuration_dns_records" {
  value = data.fastly_tls_configuration.default_configuration.dns_records
}

output "configuration_by_id_dns_records" {
  value = data.fastly_tls_configuration.configuration_by_id.dns_records
}

Expected Behavior

When obtaining fastly_tls_configuration by id it should have dns_records present. So for the configuration pasted above output configuration_by_id_dns_records should not be empty.

Actual Behavior

dns_records attribute is empty when fetching fastly_tls_configuration by id. So for the configuration pasted above output configuration_by_id_dns_records is an empty list.

Steps to Reproduce

  1. terraform apply

Other

My guess is that the issue is caused by the lack of Include in GetCustomTLSConfigurationInput here:

config, err := conn.GetCustomTLSConfiguration(&fastly.GetCustomTLSConfigurationInput{
ID: v.(string),
})

@Integralist
Copy link
Collaborator

Thanks @zaremjan we've implemented the fix in #392

@zaremjan
Copy link
Author

Awesome. Thank you. 🙇

@JuanFontes
Copy link

JuanFontes commented Apr 14, 2021

Is it working for you @zaremjan ? I've been trying to get those dns records with no success. I tried so many things and also I tried your code, but no success too.

Error: Your query returned more than one result. Please change try a more specific search criteria and try again.
I don't know what does it means since I can't see what's the result. I'm using the latest version, which is + provider.fastly v0.28.2

@Integralist
Copy link
Collaborator

Integralist commented Apr 14, 2021

@JuanFontes you can find the documentation for the fastly_tls_configuration data source here:

https://registry.terraform.io/providers/fastly/fastly/latest/docs/data-sources/tls_configuration

It describes the purpose of the data source as follows:

Use this data source to get the ID of a TLS configuration for use with other resources.

My understanding is that the data source is designed to return a single TLS configuration and so when the Terraform provider makes an API call to get the configuration, if there is more than one potential configuration returned then there's no way for the provider to know which one you want and so it returns the error:

Your query returned more than one result. Please try a more specific search criteria and try again.

If you take a look at the 'schema' section for that data source page you'll see a list of 'optional' attributes you can set when defining the data source.

I believe the more optional attributes you provide, then the more specific the API query will be, and subsequently the number of records returned from the API will be reduced (hopefully to the point where only a single TLS configuration is returned).

Hope this helps.

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

No branches or pull requests

3 participants