Access - Create Access Keys - Terraform
Aim
In this demo, we'll be creating some access keys. They are the preferred way to authenticate to Piranha using client software.
Terraform
$ cd terraform/
$ terraform init
Initializing the backend...
Initializing modules...
Initializing provider plugins...
- Reusing previous version of hashicorp/aws from the dependency lock file
- Using previously-installed hashicorp/aws v5.23.1
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
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:
# module.access-create-accesskeys.aws_iam_access_key.demoaccesskeys will be created
+ resource "aws_iam_access_key" "demoaccesskeys" {
+ create_date = (known after apply)
+ encrypted_secret = (known after apply)
+ encrypted_ses_smtp_password_v4 = (known after apply)
+ id = (known after apply)
+ key_fingerprint = (known after apply)
+ secret = (sensitive value)
+ ses_smtp_password_v4 = (sensitive value)
+ status = "Active"
+ user = "demoaccesskeys"
}
# module.access-create-accesskeys.aws_iam_user.demoaccesskeys will be created
+ resource "aws_iam_user" "demoaccesskeys" {
+ arn = (known after apply)
+ force_destroy = false
+ id = (known after apply)
+ name = "demoaccesskeys"
+ path = "/"
+ tags_all = (known after apply)
+ unique_id = (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.
$ 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:
# module.access-create-accesskeys.aws_iam_access_key.demoaccesskeys will be created
+ resource "aws_iam_access_key" "demoaccesskeys" {
+ create_date = (known after apply)
+ encrypted_secret = (known after apply)
+ encrypted_ses_smtp_password_v4 = (known after apply)
+ id = (known after apply)
+ key_fingerprint = (known after apply)
+ secret = (sensitive value)
+ ses_smtp_password_v4 = (sensitive value)
+ status = "Active"
+ user = "demoaccesskeys-tf"
}
Plan: 1 to add, 0 to change, 0 to destroy.
╷
│ Warning: AWS account ID not found for provider
│
│ with provider["registry.terraform.io/hashicorp/aws"],
│ on provider.tf line 1, in provider "aws":
│ 1: provider "aws" {
│
│ See https://www.terraform.io/docs/providers/aws/index.html#skip_requesting_account_id for implications.
╵
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
module.access-create-accesskeys.aws_iam_access_key.demoaccesskeys: Creating...
module.access-create-accesskeys.aws_iam_access_key.demoaccesskeys: Creation complete after 2s [id=AKIA5EF0FEC8B9CF26EF]
╷
│ Warning: AWS account ID not found for provider
│
│ with provider["registry.terraform.io/hashicorp/aws"],
│ on provider.tf line 1, in provider "aws":
│ 1: provider "aws" {
│
│ See https://www.terraform.io/docs/providers/aws/index.html#skip_requesting_account_id for implications.
╵
Apply complete! Resources: 1 added, 0 changed, 0 destroyed.