Hi All,
terraform i
bob@iac-server ~/terraform via
default ➜ cat main.tf
provider “aws” {
region = “us-east-1”
}
resource “aws_s3_bucket” “public_bucket” {
bucket = “xfusion-s3-9469”
}
resource “aws_s3_bucket_acl” “example” {
bucket = aws_s3_bucket.public_bucket.id
acl = “public-read”
}
bob@iac-server ~/terraform via
default ➜
bob@iac-server ~/terraform via
default ➜ terraform inint
Terraform has no command named “inint”. Did you mean “taint”?
To see all of Terraform’s top-level commands, run:
terraform -help
bob@iac-server ~/terraform via
default
terraform init
bob@iac-server ~/terraform via
default
terraform init
Initializing the backend…
Initializing provider plugins…
- Finding latest version of hashicorp/aws…
- Installing hashicorp/aws v6.28.0…
- Installed hashicorp/aws v6.28.0 (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.
bob@iac-server ~/terraform via
default ➜ terraform fmt
bob@iac-server ~/terraform via
default ➜ terraform validate
Success! The configuration is valid.
bob@iac-server ~/terraform via
default ➜ terraform 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_s3_bucket.public_bucket will be created
- resource “aws_s3_bucket” “public_bucket” {
-
acceleration_status = (known after apply)
-
acl = (known after apply)
-
arn = (known after apply)
-
bucket = “xfusion-s3-9469”
-
bucket_domain_name = (known after apply)
-
bucket_prefix = (known after apply)
-
bucket_region = (known after apply)
-
bucket_regional_domain_name = (known after apply)
-
force_destroy = false
-
hosted_zone_id = (known after apply)
-
id = (known after apply)
-
object_lock_enabled = (known after apply)
-
policy = (known after apply)
-
region = “us-east-1”
-
request_payer = (known after apply)
-
tags_all = (known after apply)
-
website_domain = (known after apply)
-
website_endpoint = (known after apply)
-
cors_rule (known after apply)
-
grant (known after apply)
-
lifecycle_rule (known after apply)
-
logging (known after apply)
-
object_lock_configuration (known after apply)
-
replication_configuration (known after apply)
-
server_side_encryption_configuration (known after apply)
-
versioning (known after apply)
-
website (known after apply)
}
-
aws_s3_bucket_acl.example will be created
- resource “aws_s3_bucket_acl” “example” {
-
acl = “public-read”
-
bucket = (known after apply)
-
id = (known after apply)
-
region = “us-east-1”
-
access_control_policy (known after apply)
}
-
Plan: 2 to add, 0 to change, 0 to destroy.
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Note: You didn’t use the -out option to save this plan, so Terraform can’t guarantee to take exactly these actions if you run
“terraform apply” now.
bob@iac-server ~/terraform via
default ➜ terraform apply
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_s3_bucket.public_bucket will be created
- resource “aws_s3_bucket” “public_bucket” {
-
acceleration_status = (known after apply)
-
acl = (known after apply)
-
arn = (known after apply)
-
bucket = “xfusion-s3-9469”
-
bucket_domain_name = (known after apply)
-
bucket_prefix = (known after apply)
-
bucket_region = (known after apply)
-
bucket_regional_domain_name = (known after apply)
-
force_destroy = false
-
hosted_zone_id = (known after apply)
-
id = (known after apply)
-
object_lock_enabled = (known after apply)
-
policy = (known after apply)
-
region = “us-east-1”
-
request_payer = (known after apply)
-
tags_all = (known after apply)
-
website_domain = (known after apply)
-
website_endpoint = (known after apply)
-
cors_rule (known after apply)
-
grant (known after apply)
-
lifecycle_rule (known after apply)
-
logging (known after apply)
-
object_lock_configuration (known after apply)
-
replication_configuration (known after apply)
-
server_side_encryption_configuration (known after apply)
-
versioning (known after apply)
-
website (known after apply)
}
-
aws_s3_bucket_acl.example will be created
- resource “aws_s3_bucket_acl” “example” {
-
acl = “public-read”
-
bucket = (known after apply)
-
id = (known after apply)
-
region = “us-east-1”
-
access_control_policy (known after apply)
}
-
Plan: 2 to add, 0 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only ‘yes’ will be accepted to approve.
Enter a value: yes
aws_s3_bucket.public_bucket: Creating…
╷
│ Error: creating S3 Bucket (xfusion-s3-9469): operation error S3: CreateBucket, https response error StatusCode: 0, RequestID: , HostID: , request send failed, Put “http://xfusion-s3-9469.aws:4566/”: dial tcp: lookup xfusion-s3-9469.aws on 10.96.0.10:53: no such host
│
│ with aws_s3_bucket.public_bucket,
│ on main.tf line 4, in resource “aws_s3_bucket” “public_bucket”:
│ 4: resource “aws_s3_bucket” “public_bucket” {
│
╵
bob@iac-server ~/terraform via
default ![]()