作者:涛涛哈帅_365 | 来源:互联网 | 2023-09-11 19:10
Terraform Version
Terraform 0.11.3
aws 1.14.0
Affected Resource(s)
Please list the resources as a list, for example:
- aws_athena_database
Terraform Configuration Files
1 2 3 4 5 6
| hcl
resource "aws_athena_database" "pccp_datalake" {
name = "PccpDevDatalake"
bucket = "${aws_s3_bucket.pccp_datalake.bucket}"
force_destroy = true
} |
Debug Output
https://gist.github.com/andrewmichael/4d1b1e5bf035b1e35264cd81111723c0
Expected Behavior
Athena database is created, and subsequent plan / apply commands operate correctly.
Actual Behavior
Plan output:-
1 2 3 4 5 6 7 8 9 10 11
| Terraform will perform the following actions:
+ aws_athena_database.pccp_datalake
id:
bucket: "pccp-dev-datalake"
force_destroy: "true"
name: "PccpDevDatalake"
Plan: 1 to add, 0 to change, 0 to destroy.
|
Apply end in error:-
1 2 3 4 5 6 7 8
| Error: Error applying plan:
1 error(s) occurred:
* aws_athena_database.pccp_datalake: 1 error(s) occurred:
* aws_athena_database.pccp_datalake: [ERROR] Athena not found database: PccpDevDatalake, query result: default
pccpdevdatalake |
Subsequent plan / apply fails.
1 2 3 4 5 6
| Error: Error refreshing state: 1 error(s) occurred:
* aws_athena_database.pccp_datalake: 1 error(s) occurred:
* aws_athena_database.pccp_datalake: aws_athena_database.pccp_datalake: [ERROR] Athena not found database: PccpDevDatalake, query result: default
pccpdevdatalake |
Observing the AWS console the database appears to have been created.
The only way out of this now is to manually deleting the Athena database, then revert to the previous version of remote state in S3.
Just reverting remote state, results in the following error:-
1 2 3 4 5 6 7
| Error: Error applying plan:
1 error(s) occurred:
* aws_athena_database.pccp_datalake: 1 error(s) occurred:
* aws_athena_database.pccp_datalake: reason: FAILED: Execution Error, return code 1 from org.apache.hadoop.hive.ql.exec.DDLTask. Database PccpDevDatalake already exists |
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
1.
1.
Important Factoids
IAM user has admin permissions
remote state is persisted in s3
该提问来源于开源项目:hashicorp/terraform-provider-aws
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!