Quantcast
Channel: Terraform - HashiCorp Discuss
Viewing all articles
Browse latest Browse all 11363

Provider's Schema - how to distinguish attributes from arguments?

$
0
0

@note wrote:

Hey,

I am working on Scala code generation out of terraform provider’s schema. To be more precise I use the output of terraform providers schema -json to generate some Scala code.

I am parsing attributes in the Block Representation which is described here: https://www.terraform.io/docs/commands/providers/schema.html#block-representation. I am having hard time to understand the meaning of required, optional and computed fields. There are some descriptions of them but they do not explain how those fields interact with each other. I also read https://www.terraform.io/docs/extend/schemas/schema-methods.html and https://github.com/hashicorp/terraform/issues/21278 but it did not help.

In particular I am interested in the difference between (computed: true) and (computed: true, optional: true). As the docs is not clear in that regard I hoped that I would be able to reverse engineer that by comparing schema of e.g. AWS Provider and its docs. However I was not able to identify a simple rule. Here are some (in my opinion) contradictory entries:

a) aws_acm_certificate.arn - (computed: true). According to docs it only output (i.e. attribute), cannot be passed as parameter
b) aws_dynamodb_table.stream_view_type - (computed: true). According to docs it’s an argument
c) aws_acm_certificate.subject_alternative_names - (computed: true, optional: true). According to docs it’s an argument

My point is that a) and b) have the same schema representation but have different semantics. b) and c) have the same semantics but different schema representation.

Can I really rely on schema representation to distinguish between attributes and arguments?

Posts: 4

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 11363

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>