Created
September 1, 2022 15:41
-
-
Save bgauduch/edd94e3129ec79a7864ad6002fe546b6 to your computer and use it in GitHub Desktop.
dagger test with Terraform
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package terraform | |
import ( | |
"dagger.io/dagger" | |
"dagger.io/dagger/core" | |
"universe.dagger.io/alpha/terraform" | |
) | |
dagger.#Plan & { | |
client: { | |
// Read env var containing inline JSON of the service account | |
env: G_APP_CRED: dagger.#Secret | |
// Write full action FS to local FS (:alembic:) | |
filesystem: { | |
"out.tfplan": { | |
write: contents: actions.plan.plan.output."/out.tfplan" | |
} | |
} | |
} | |
actions: { | |
plan: { | |
getCode: core.#Source & { | |
path: "." | |
} | |
init: terraform.#Init & { | |
source: getCode.output | |
} | |
plan: terraform.#Plan & { | |
env: { | |
// Export the google cloud cred to be used by Terraform | |
GOOGLE_CREDENTIALS: client.env.G_APP_CRED | |
} | |
source: init.output | |
} | |
// writePlan: core.#WriteFile & { | |
// input: dagger.#FS | |
// path: "tf.plan" | |
// contents: plan.output | |
// } | |
} | |
// dev: { | |
// initUpgrade: terraform.#Init & { | |
// source: getCode.output | |
// // passe "upgrade" arg ! | |
// } | |
// } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment