Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When its "property" metadata has "something" #447

Merged
merged 6 commits into from
Jan 18, 2021
Merged

When its "property" metadata has "something" #447

merged 6 commits into from
Jan 18, 2021

Conversation

Kudbettin
Copy link
Member

@Kudbettin Kudbettin commented Jan 15, 2021

Add Terraform's actions on the resource to the resource

Addresses #408 #426

Add the actions list on resource_changes to the respective resources as suggested by @mdesmarest

New Step

When its "property" metadata has "something"

This step filters a resource out if it has property metadata that has something value. Metadata are considered to be key, value pairs outside of values, which includes the properties of the resource.

Following is how an aws_instance example is represented in stash.

{'address': 'aws_instance.example',
 'mode': 'managed',
 'type': 'aws_instance',
 'name': 'example',
 'provider_name': 'registry.terraform.io/hashicorp/aws',
 'values': {
  'ami': 'ami-034bf895b736be04a',
  'arn': 'arn:aws:ec2:us-west-1:704778554736:instance/i-0d6a689453a806e50',
  'tags': {'Name': 'HelloWorldChange'},
  ...
  },
 'actions': ['update']
}

actions, provider_name, or address are considered to be metadata. However ami, arn, and tags are considered to be otherwise, as they are in values. The debugger could be used to see the metadata present at a given step.

When its "property" metadata does not have "something"

Works the same way but other way around. Note that not having "property" metadata will also let the resource pass.

Future directions

  • make it so that metadata like actions don't disappear during then steps
  • Then steps for metadata
  • More when steps (one without value and only key)
  • Ability to modify any step so that it uses/excludes whichever the data you would like:
    • values
    • metadata
  • regex / generalized regex

@Kudbettin
Copy link
Member Author

Adding module tests inflated the code quite a lot

@eerkunt eerkunt merged commit 1e24448 into master Jan 18, 2021
@eerkunt eerkunt deleted the actions branch January 18, 2021 10:45
@Kudbettin Kudbettin added the use case for website a use case within this issue/pr that needs to be incorporated into docs/examples label Jan 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement use case for website a use case within this issue/pr that needs to be incorporated into docs/examples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants