You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[root@centos7 demo-terraform-localstack]# make plan
sudo rm -rf .terraform
rm -f current.plan
rm -f *.tf.json
terraform init
Initializing the backend...
Successfully configured the backend "s3"! Terraform will automatically
use this backend unless the backend configuration changes.
Initializing provider plugins...
- Reusing previous version of hashicorp/aws from the dependency lock file
- Installing hashicorp/aws v3.69.0...
- Installed hashicorp/aws v3.69.0 (signed by HashiCorp)
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.
terraform plan -out current.plan
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:
# aws_dynamodb_table.terraform_state_lock will be created
+ resource "aws_dynamodb_table" "terraform_state_lock" {
+ arn = (known after apply)
+ billing_mode = "PAY_PER_REQUEST"
+ hash_key = "LockID"
+ id = (known after apply)
+ name = "terraform-lock"
+ read_capacity = 5
+ stream_arn = (known after apply)
+ stream_label = (known after apply)
+ stream_view_type = (known after apply)
+ tags_all = (known after apply)
+ write_capacity = 5
+ attribute {
+ name = "LockID"
+ type = "S"
}
+ point_in_time_recovery {
+ enabled = (known after apply)
}
+ server_side_encryption {
+ enabled = (known after apply)
+ kms_key_arn = (known after apply)
}
}
# aws_s3_bucket.terraform_state will be created
+ resource "aws_s3_bucket" "terraform_state" {
+ acceleration_status = (known after apply)
+ acl = "private"
+ arn = (known after apply)
+ bucket = "terraform-state"
+ bucket_domain_name = (known after apply)
+ bucket_regional_domain_name = (known after apply)
+ force_destroy = false
+ hosted_zone_id = (known after apply)
+ id = (known after apply)
+ region = (known after apply)
+ request_payer = (known after apply)
+ tags_all = (known after apply)
+ website_domain = (known after apply)
+ website_endpoint = (known after apply)
+ server_side_encryption_configuration {
+ rule {
+ apply_server_side_encryption_by_default {
+ sse_algorithm = "AES256"
}
}
}
+ versioning {
+ enabled = true
+ mfa_delete = false
}
}
# aws_s3_bucket_public_access_block.terraform_state_access will be created
+ resource "aws_s3_bucket_public_access_block" "terraform_state_access" {
+ block_public_acls = true
+ block_public_policy = true
+ bucket = (known after apply)
+ id = (known after apply)
+ ignore_public_acls = true
+ restrict_public_buckets = true
}
Plan: 3 to add, 0 to change, 0 to destroy.
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Saved the plan to: current.plan
To perform exactly these actions, run the following command to apply:
terraform apply "current.plan"
terraform show -no-color current.plan > txt.plan
[root@centos7 demo-terraform-localstack]# make apply
terraform apply -auto-approve current.plan
aws_dynamodb_table.terraform_state_lock: Creating...
aws_s3_bucket.terraform_state: Creating...
╷
│ Error: Error creating S3 bucket: BucketAlreadyOwnedByYou: Your previous request to create the named bucket succeeded and you already own it.
│ status code: 409, request id: 7XSDCUTVB020XY8JFXFVTDOJ8X99DKIDDYPD61PLB3A5QZS1GZ64, host id: MzRISOwyjmnup5A859874F966193B7/JypPGXLh0OVFGcJaaO3KW/hRAqKOpIEEp
│
│ with aws_s3_bucket.terraform_state,
│ on main.tf line 33, in resource "aws_s3_bucket" "terraform_state":
│ 33: resource "aws_s3_bucket" "terraform_state" {
│
╵
╷
│ Error: error creating DynamoDB Table: ResourceInUseException: Table already created
│
│ with aws_dynamodb_table.terraform_state_lock,
│ on main.tf line 62, in resource "aws_dynamodb_table" "terraform_state_lock":
│ 62: resource "aws_dynamodb_table" "terraform_state_lock" {
│
╵
make: *** [apply] Error 1
The text was updated successfully, but these errors were encountered:
hi davidlu,
非常感谢你的分享,我正在使用你的repository学习terraform。
目前我执行
make plan
成功,但是执行make apply
报错。你能帮我解决一下吗?报错如下:
The text was updated successfully, but these errors were encountered: