Skip to content

Instantly share code, notes, and snippets.

@jolexa
Created August 12, 2020 15:24
Show Gist options
  • Save jolexa/8e75a4ea6645d9932d4695f3ae12b500 to your computer and use it in GitHub Desktop.
Save jolexa/8e75a4ea6645d9932d4695f3ae12b500 to your computer and use it in GitHub Desktop.
terraform-provider-aws issue # <> terraform output
mbp:~/tmp
$ find .
.
./root.tf
./.tool-versions
./internal
./internal/main.tf
mbp:~/tmp
$ terraform init
Initializing modules...
- internal in internal
Initializing the backend...
Initializing provider plugins...
- Checking for available provider plugins...
- Downloading plugin for provider "aws" (hashicorp/aws) 2.70.0...
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.
mbp:~/tmp
$ aws-okta exec snd -- terraform plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.
data.aws_region.current: Refreshing state...
------------------------------------------------------------------------
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
+ create
<= read (data resources)
Terraform will perform the following actions:
# aws_cloudwatch_log_group.new will be created
+ resource "aws_cloudwatch_log_group" "new" {
+ arn = (known after apply)
+ id = (known after apply)
+ name = "new-log-group"
+ retention_in_days = 0
}
# module.internal.data.aws_cloudwatch_log_group.source will be read during apply
# (config refers to values not yet known)
<= data "aws_cloudwatch_log_group" "source" {
+ arn = (known after apply)
+ creation_time = (known after apply)
+ id = (known after apply)
+ kms_key_id = (known after apply)
+ name = "new-log-group"
+ retention_in_days = (known after apply)
+ tags = (known after apply)
}
Plan: 1 to add, 0 to change, 0 to destroy.
------------------------------------------------------------------------
Note: You didn't specify an "-out" parameter to save this plan, so Terraform
can't guarantee that exactly these actions will be performed if
"terraform apply" is subsequently run.
mbp:~/tmp
$ cat *tfstate*
cat: '*tfstate*': No such file or directory
mbp:~/tmp
$ aws-okta exec snd -- terraform apply -target data.aws_region.current
data.aws_region.current: Refreshing state...
Warning: Resource targeting is in effect
You are creating a plan with the -target option, which means that the result
of this plan may not represent all of the changes requested by the current
configuration.
The -target option is not for routine use, and is provided only for
exceptional situations such as recovering from errors or mistakes, or when
Terraform specifically suggests to use it as part of an error message.
Warning: Applied changes may be incomplete
The plan was created with the -target option in effect, so some changes
requested in the configuration may have been ignored and the output values may
not be fully updated. Run the following command to verify that no other
changes are pending:
terraform plan
Note that the -target option is not suitable for routine use, and is provided
only for exceptional situations such as recovering from errors or mistakes, or
when Terraform specifically suggests to use it as part of an error message.
Apply complete! Resources: 0 added, 0 changed, 0 destroyed.
mbp:~/tmp
$ cat *tfstate*
{
"version": 4,
"terraform_version": "0.12.29",
"serial": 1,
"lineage": "648e86e7-4b6d-876e-0d4b-d3e79c7a241c",
"outputs": {},
"resources": [
{
"mode": "data",
"type": "aws_region",
"name": "current",
"provider": "provider.aws",
"instances": [
{
"schema_version": 0,
"attributes": {
"current": null,
"description": "US West (Oregon)",
"endpoint": "ec2.us-west-2.amazonaws.com",
"id": "us-west-2",
"name": "us-west-2"
}
}
]
}
]
}
mbp:~/tmp
$ aws-okta exec snd -- terraform plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.
data.aws_region.current: Refreshing state...
module.internal.data.aws_cloudwatch_log_group.source: Refreshing state...
Error: No log group named new-log-group found
on internal/main.tf line 3, in data "aws_cloudwatch_log_group" "source":
3: data "aws_cloudwatch_log_group" "source" {
exit status 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment