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

Allow auto approval of backend #35

Open
ryanm101 opened this issue Oct 15, 2019 · 1 comment
Open

Allow auto approval of backend #35

ryanm101 opened this issue Oct 15, 2019 · 1 comment
Labels
enhancement New feature or request

Comments

@ryanm101
Copy link

ryanm101 commented Oct 15, 2019

I don't want to approve the creation of my TF back end however it should be created as a part of my CI/CD process.

it would be nice to have a pretf either take an switch or look for an env var with the approval in it. Currently I have:

from pretf.aws import provider_aws
from pretf.aws import terraform_backend_s3
from pretf import log

## Override 
log_accept_orig = log.accept

def log_accept_override(x):
    return True

def pretf_blocks(var):
    yield provider_aws(
        region=var.aws_region,
    )
    log.accept = log_accept_override
    yield terraform_backend_s3(
        bucket=f"pretf-tfstate{var.postfix[var.environment]}",
        dynamodb_table=f"pretf-tfstate{var.postfix[var.environment]}",
        key="terraform.tfstate",
        region=var.aws_region,
        encrypt=True
    )
    log.accept = log_accept_orig

Which is hacky, preferable would be:

yield terraform_backend_s3(
        bucket=f"pretf-tfstate{var.postfix[var.environment]}",
        dynamodb_table=f"pretf-tfstate{var.postfix[var.environment]}",
        key="terraform.tfstate",
        region=var.aws_region,
        encrypt=True,
        auto_approve=True
    )
@ryanm101
Copy link
Author

#34

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants