Closed codybswaney closed 4 months ago
Hi @codybswaney! We do not read config if it's not managed in .tf configuration - it causes problems because some connectors always have some non-null fields and it produces unwanted changes even is config section is omited. But looks like it's a problem for import operation. We will take a look what could be done.
Excellent, thank you so much @beevital
Just a note @beevital that this doesn't seem to be fixed in either 1.1.16 nor 1.1.17, at least for destinations to BigQuery.
First upgrade to newer backend
$ terraform init -upgrade
Initializing the backend...
Initializing provider plugins...
- Finding fivetran/fivetran versions matching ">= 1.1.16"...
- Installing fivetran/fivetran v1.1.17...
- Installed fivetran/fivetran v1.1.17 (signed by a HashiCorp partner, key ID BD40EF4531102765)
Partner and community providers are signed by their developers.
If you'd like to know more about provider signing, you can read about it here:
https://www.terraform.io/docs/cli/plugins/signing.html
Terraform has made some changes to the provider dependency selections recorded
in the .terraform.lock.hcl file. Review those changes and commit them to your
version control system if they represent changes you intended to make.
Terraform has been successfully initialized!
You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.
If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
Now import into a record like this
resource "fivetran_destination" "example" {}
$ terraform import fivetran_destination.example perusal_furiously
fivetran_destination.example: Importing from ID "perusal_furiously"...
fivetran_destination.example: Import prepared!
Prepared fivetran_destination for import
fivetran_destination.example: Refreshing state... [id=perusal_furiously]
data.fivetran_connector.conn: Reading...
data.fivetran_connector.conn: Read complete after 5s [id=planned_placate]
Import successful!
The resources that were imported are shown above. These resources are now in
your Terraform state and will henceforth be managed by Terraform.
Now terraform show still has an empty config
# fivetran_destination.example:
resource "fivetran_destination" "example" {
group_id = "perusal_furiously"
id = "perusal_furiously"
region = "GCP_US_EAST4"
service = "big_query"
setup_status = "connected"
time_zone_offset = "-8"
config {}
}
Note that this is the case even if I specify some parts of config
before importing; i.e. with some config
block before the import, the state still shows no config
resource "fivetran_destination" "example" {
config {
project_id = "my-project-id"
}
}
Describe the bug When importing a connector via
terraform import fivetran_connector.example ${CONNECTOR_ID}
or importing a destination viaterraform import fivetran_destination.example ${DESTINATION_ID}
, theconfig
values are not populated into the state. However, when looking at data sources I am able to see these configurations.To Reproduce
First, define an empty connector (or destination)
Now import via
terraform import fivetran_connector.example ${CONNECTOR_ID}
On a
terraform show
, the config is missing:However, data sources show the config value. Given the following data resource....
A
terraform show
has config valuesExpected behavior Imports of existing connectors and destinations contain relevant config that matches what is fetched by data sources.
Logs & Output
Nothing of note when importing... terraform show plans above
Plugin version: 1.1.15
Additional context N/A