planすると注意される

planすると、以下のように注意されます。

terraform plan

 Error: Backend initialization required, please run "terraform init"
 
 Reason: Initial configuration of the requested backend "s3"
 
 The "backend" is the interface that Terraform uses to store state,
 perform operations, etc. If this message is showing up, it means that the
 Terraform configuration you're using is using a custom configuration for
 the Terraform backend.
 
 Changes to backend configurations require reinitialization. This allows
 Terraform to set up the new configuration, copy existing state, etc. Please run
 "terraform init" with either the "-reconfigure" or "-migrate-state" flags to
 use the current configuration.
 
 If the change reason above is incorrect, please verify your configuration
 hasn't changed and try again. At this point, no changes to your existing
 configuration or state have been made.

init

なので、initします。

terraform init

Initializing the backend...

Successfully configured the backend "s3"! Terraform will automatically
use this backend unless the backend configuration changes.
Initializing modules...
- cloudtrail in modules/cloudtrail
- config_ap-northeast-1 in modules/config
- guardduty-eu-north-1 in modules/guardduty
- notification in modules/notification

Initializing provider plugins...
- Finding hashicorp/aws versions matching "~> 5.6.0"...
- Installing hashicorp/aws v5.6.2...
- Installed hashicorp/aws v5.6.2 (signed by HashiCorp)

Terraform has created a lock file .terraform.lock.hcl to record the provider
selections it made above. Include this file in your version control repository
so that Terraform can guarantee to make the same selections by default when
you run "terraform init" in the future.

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.

plan

差分が出ないかをplanで確認します。No changes. Your infrastructure matches the configuration.差分が無いと確認できます。

terraform plan


data.aws_iam_policy.config: Reading...
module.cloudtrail.data.aws_caller_identity.current: Reading...

---途中省略---

No changes. Your infrastructure matches the configuration.

Terraform has compared your real infrastructure against your configuration and found no differences, so no
changes are needed.